Skip to content

Commit

Permalink
squash: [omxplayer] Handle failures from FillThisBuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed Mar 26, 2015
1 parent 06f3e35 commit d9baf53
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,11 @@ int CActiveAEResamplePi::Resample(uint8_t **dst_buffer, int dst_samples, uint8_t
}
omx_err = m_omx_mixer.FillThisBuffer(m_encoded_buffer);
if (omx_err != OMX_ErrorNone)
{
CLog::Log(LOGERROR, "%s::%s m_omx_mixer.FillThisBuffer result(0x%x)", CLASSNAME, __func__, omx_err);
m_omx_mixer.DecoderFillBufferDone(m_omx_mixer.GetComponent(), m_encoded_buffer);
return false;

}
omx_err = m_omx_mixer.WaitForOutputDone(1000);
if (omx_err != OMX_ErrorNone)
{
Expand Down
24 changes: 20 additions & 4 deletions xbmc/cores/omxplayer/OMXImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,7 @@ bool COMXImageDec::HandlePortSettingChange(unsigned int resize_width, unsigned i
if(omx_err != OMX_ErrorNone)
{
CLog::Log(LOGERROR, "%s::%s m_omx_resize FillThisBuffer result(0x%x)\n", CLASSNAME, __func__, omx_err);
m_omx_resize.DecoderFillBufferDone(m_omx_resize.GetComponent(), m_decoded_buffer);
return false;
}
}
Expand Down Expand Up @@ -1241,8 +1242,17 @@ COMXImageEnc::~COMXImageEnc()

OMX_INIT_STRUCTURE(m_encoded_format);
m_encoded_buffer = NULL;
if(m_omx_encoder.IsInitialized())
m_omx_encoder.Deinitialize();
if (!m_success)
{
if(m_omx_encoder.IsInitialized())
{
m_omx_encoder.SetStateForComponent(OMX_StateIdle);
m_omx_encoder.FlushAll();
m_omx_encoder.FreeInputBuffers();
m_omx_encoder.FreeOutputBuffers();
m_omx_encoder.Deinitialize();
}
}
limit_calls_leave();
}

Expand Down Expand Up @@ -1399,12 +1409,15 @@ bool COMXImageEnc::Encode(unsigned char *buffer, int size, unsigned width, unsig

omx_err = m_omx_encoder.FillThisBuffer(m_encoded_buffer);
if(omx_err != OMX_ErrorNone)
{
CLog::Log(LOGERROR, "%s::%s m_omx_encoder.FillThisBuffer result(0x%x)\n", CLASSNAME, __func__, omx_err);
m_omx_encoder.DecoderFillBufferDone(m_omx_encoder.GetComponent(), m_encoded_buffer);
return false;

}
omx_err = m_omx_encoder.WaitForOutputDone(1000);
if(omx_err != OMX_ErrorNone)
{
CLog::Log(LOGERROR, "%s::%s m_omx_resize.WaitForOutputDone result(0x%x)\n", CLASSNAME, __func__, omx_err);
CLog::Log(LOGERROR, "%s::%s m_omx_encoder.WaitForOutputDone result(0x%x)\n", CLASSNAME, __func__, omx_err);
return false;
}

Expand Down Expand Up @@ -1447,6 +1460,7 @@ bool COMXImageEnc::CreateThumbnailFromSurface(unsigned char* buffer, unsigned in
return true;
}

m_success = true;
return false;
}

Expand Down Expand Up @@ -1883,6 +1897,7 @@ bool COMXImageReEnc::ReEncode(COMXImageFile &srcFile, unsigned int maxWidth, uns
if(omx_err != OMX_ErrorNone)
{
CLog::Log(LOGERROR, "%s::%s %s FillThisBuffer() failed (%x)\n", CLASSNAME, __func__, srcFile.GetFilename(), omx_err);
m_omx_encoder.DecoderFillBufferDone(m_omx_encoder.GetComponent(), m_encoded_buffer);
return false;
}
}
Expand Down Expand Up @@ -2252,6 +2267,7 @@ bool COMXTexture::Decode(const uint8_t *demuxer_content, unsigned demuxer_bytes,
if (omx_err != OMX_ErrorNone)
{
CLog::Log(LOGERROR, "%s::%s error m_omx_egl_render.FillThisBuffer (%x)", CLASSNAME, __func__, omx_err);
m_omx_egl_render.DecoderFillBufferDone(m_omx_egl_render.GetComponent(), m_egl_buffer);
return false;
}

Expand Down

0 comments on commit d9baf53

Please sign in to comment.