Media (Intel® oneAPI Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK

Some weird problem of MFX_ERR_MORE_DATA

dong_x_
Beginner
170 Views

 

HI,

     this is my function:

BOOL CIntelDecode::DecodeInputData(BYTE *pData , int size)
 {
  mfxStatus sts = MFX_ERR_NONE;
  BOOL ret = TRUE;

  _mfxBS.Data = (mfxU8 *)pData;
  _mfxBS.MaxLength = size;
  _mfxBS.DataLength = size;
  _mfxBS.DataOffset = 0;

  while (MFX_ERR_NONE <= sts || MFX_ERR_MORE_DATA == sts || MFX_ERR_MORE_SURFACE == sts)
  {

   if (MFX_WRN_DEVICE_BUSY == sts)
   {
    MSDK_SLEEP(1);  // Wait if device is busy, then repeat the same call to DecodeFrameAsync
   }

   if (MFX_ERR_MORE_DATA == sts)
   {
           break;    
   }

   if (MFX_ERR_MORE_SURFACE == sts || MFX_ERR_NONE == sts)
   {
    _currentIndex = GetFreeSurfaceIndex(_pmfxSurfaces, _numSurfaces);        // Find free frame surface
    if(MFX_ERR_NOT_FOUND == _currentIndex)
    {
     continue;
    }
   }

   sts = _mfxDEC->DecodeFrameAsync(&_mfxBS, _pmfxSurfaces[_currentIndex], &_pmfxOutSurface, &_syncp);
   if (MFX_ERR_NONE < sts && _syncp)
   {
    sts = MFX_ERR_NONE;
   }

   if (MFX_ERR_NONE == sts)
   {
    sts = _mfxSession.SyncOperation(_syncp, 60000);      // Synchronize. Wait until decoded frame is ready
   }

   if (MFX_ERR_NONE == sts)
   {
    ConvertToRGB(_pmfxOutSurface);
    break;
   }
  }

  return ret;
 }

 

    It's only different with "simple_decode"  at  MFX_ERR_MORE_DATA "break".

    I put "DecodeInputData" one frame each time, but the image was error.  When I instead "MFX_ERR_MORE_DATA break " of "read one frame" , the image is right.

  

0 Kudos
0 Replies
Reply