1

I am asking this question with reference to my previous question here.
As I was not able to solve the ownership issue for the last frame of the mp4 file in Motorola xoom device, I thought of trying a frame by frame decoding version where I can somewhat control the input to the decoder and can know it reaches end of stream.
For that I wrote a class deriving the mediasource and overridden the read function.
When I implemented it, again in Karbonn A9+ device it worked somewhat fine. But in motorola xoom the decoder seems to take too much time for all resolutions and after each 3 - 4 frames the read returns with the folllowing error.

09-06 11:49:47.663: E/OMXCodec(1281): [OMX.Nvidia.h264.decode] 
Timed out waiting for output buffers: 0/1

Where it takes 3 seconds to get one frame otherwise it comes around 1.8 seconds.
Rarely I get the same problem in karbonn device too.

Here is code where I set up my metadata

err = calc_avcc_from_file(video_file, length_file, avcc);
len_avcc = sps_size + pps_size + 11;

//err = parseAVCCodecSpecificData(avcc, (size_t)len_avcc);
LOGP("avcc size = %d and error of parseAVCCodecSpecificData  %d", len_avcc, err);
meta_data->setData(kKeyAVCC, kTypeAVCC, avcc, (size_t)len_avcc);
meta_data->setCString(kKeyMIMEType, MEDIA_MIMETYPE_VIDEO_AVC);
meta_data->setInt32(kKeyWidth, mDisplayWidth);
meta_data->setInt32(kKeyHeight, mDisplayHeight);
meta_data->setInt32(kKeyFrameRate, 29);
meta_data->setInt32(kKeyBitRate, 15000);
meta_data->setInt32(kKeyStride, mDisplayWidth);
meta_data->setInt32(kKeySliceHeight, mDisplayHeight);

Actually at beginning I was not passing the avcc, the same issue was there. Then I thought of passing it by creating as follows but to find no improvement.

int custom_decoder::calc_avcc(char *enc_strm, int enc_param_len, void *avcc) 
{
   int err = OFI_VC_ERR_SUCCESS;
   char *temp = (char *)avcc;
   LOGP("calculating avcc");

   err = calc_sps_pps_size (enc_strm, enc_param_len);

   *temp++ = 1;
   *temp++ = 66;
   *temp++ = 66;
   *temp++ = 1;
   *temp++ = 3;
   *temp++ = 1;
   *temp++ = 0;
   *temp++ = sps_size;
   memcpy(temp, sps_data, sps_size);
   temp += sps_size;
   *temp++ = 1;
   *temp++ = 0;
   *temp++ = pps_size;
   memcpy(temp, pps_data, pps_size);

   return err;
}

What am I missing or what is going wrong...
Any help would be appreciated....

Community
  • 1
  • 1
Kevin K
  • 589
  • 2
  • 7
  • 28

0 Answers0