Commit b0d85bf7 authored by marcheu@chromium.org's avatar marcheu@chromium.org

OMX: Don't try to send buffers when in resetting state.

If we do this, the OMX_FillThisBuffer function will fail, and will put the OMX
class in error mode. Then resource freeing will not happen. This is especially
annoying since this can happen during Destroy and leads to resource leaks.

BUG=chrome-os-partner:12316
TEST=by hand: play a video, look for buffer leaks.

Change-Id: If14311d188f1a2048c11b5bb6186dbf5fc20c1f5


Review URL: https://chromiumcodereview.appspot.com/10837212

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151396 0039d316-1c4b-4281-b951-d872f2087c98
parent 7af6e84e
......@@ -344,6 +344,17 @@ void OmxVideoDecodeAccelerator::Decode(
void OmxVideoDecodeAccelerator::AssignPictureBuffers(
const std::vector<media::PictureBuffer>& buffers) {
DCHECK_EQ(message_loop_, MessageLoop::current());
// If we are resetting/destroying/erroring, don't bother, as
// OMX_FillThisBuffer will fail anyway. In case we're in the middle of
// closing, this will put the Accelerator in ERRORING mode, which has the
// unwanted side effect of not going through the OMX_FreeBuffers path and
// leaks memory.
if (current_state_change_ == RESETTING ||
current_state_change_ == DESTROYING ||
current_state_change_ == ERRORING)
return;
RETURN_ON_FAILURE(CanFillBuffer(), "Can't fill buffer", ILLEGAL_STATE,);
DCHECK_EQ(output_buffers_at_component_, 0);
......@@ -815,8 +826,7 @@ void OmxVideoDecodeAccelerator::FillBufferDoneTask(
if (buffer->nFlags & OMX_BUFFERFLAG_EOS) {
buffer->nFlags &= ~OMX_BUFFERFLAG_EOS;
OnReachedEOSInFlushing();
if (current_state_change_ != DESTROYING)
ReusePictureBuffer(picture_buffer_id);
ReusePictureBuffer(picture_buffer_id);
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment