diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-14 23:33:47 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-14 23:33:47 +0000 |
commit | 05982e124709e5a7ea5e04d2c0d0ef2d3597c8ea (patch) | |
tree | 9870fc20a68ee4e0e45cd1a348bb93b94c4e47d6 /media | |
parent | f8558c835edee1830b730797f829731466d9edad (diff) | |
download | chromium_src-05982e124709e5a7ea5e04d2c0d0ef2d3597c8ea.zip chromium_src-05982e124709e5a7ea5e04d2c0d0ef2d3597c8ea.tar.gz chromium_src-05982e124709e5a7ea5e04d2c0d0ef2d3597c8ea.tar.bz2 |
Fix OpenMAX video decoding hanging
Avoid OpenMAX to hold many decoded frames to keep decoding
going.
BUG=no
TEST=tree stays gree
Submitted for: wjia@chromium.org
Reviewer: http://codereview.chromium.org/2031010/show
Review URL: http://codereview.chromium.org/2105003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47335 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/omx/omx_codec.cc | 8 | ||||
-rw-r--r-- | media/omx/omx_codec_unittest.cc | 31 |
2 files changed, 26 insertions, 13 deletions
diff --git a/media/omx/omx_codec.cc b/media/omx/omx_codec.cc index d47e3d0..48c8cb0 100644 --- a/media/omx/omx_codec.cc +++ b/media/omx/omx_codec.cc @@ -981,6 +981,8 @@ void OmxCodec::EmptyBufferCompleteTask(OMX_BUFFERHEADERTYPE* buffer) { // Try to feed more data into the decoder. EmptyBufferTask(); + + FulfillOneRead(); } void OmxCodec::EmptyBufferTask() { @@ -1085,6 +1087,12 @@ void OmxCodec::FulfillOneRead() { callback->Run(static_cast<OMX_BUFFERHEADERTYPE*>(NULL)); } delete callback; + } else if (!output_queue_.empty() && + !available_input_buffers_.empty() && !input_eos_) { + ReadCallback* callback = output_queue_.front(); + output_queue_.pop(); + callback->Run(static_cast<OMX_BUFFERHEADERTYPE*>(NULL)); + delete callback; } } diff --git a/media/omx/omx_codec_unittest.cc b/media/omx/omx_codec_unittest.cc index adf8132..f4a98d1 100644 --- a/media/omx/omx_codec_unittest.cc +++ b/media/omx/omx_codec_unittest.cc @@ -390,24 +390,29 @@ TEST_F(OmxCodecTest, OutputFlowControl) { // 1. Make a read request to OmxCodec. // 2. Fake a response for FillBufferDone(). // 3. Expect read response received. - for (int i = 0; i < kBufferCount; ++i) { + // 4. NULL buffer is returned in first time + for (int i = 0; i < kBufferCount + 1; ++i) { // 1. First make a read request. - // Since a buffer is given back to OmxCodec. A FillThisBuffer() is called - // to OmxCodec. - EXPECT_CALL(*MockOmx::get(), FillThisBuffer(NotNull())) + // Since a buffer is given back to OmxCodec component after first time, + // a FillThisBuffer() is called to OmxCodec component. + if (i > 0) { + EXPECT_CALL(*MockOmx::get(), FillThisBuffer(NotNull())) .WillOnce(Return(OMX_ErrorNone)) .RetiresOnSaturation(); + } MakeReadRequest(); - // 2. Then fake a response from OpenMAX. - OMX_BUFFERHEADERTYPE* buffer = fill_this_buffer_received_.front(); - fill_this_buffer_received_.pop_front(); - buffer->nFlags = 0; - buffer->nFilledLen = kBufferSize; - (*MockOmx::get()->callbacks()->FillBufferDone)( - MockOmx::get()->component(), - MockOmx::get()->component()->pApplicationPrivate, - buffer); + // 2. Then fake a response from OpenMAX, only |kBufferCount| times + if (i < kBufferCount) { + OMX_BUFFERHEADERTYPE* buffer = fill_this_buffer_received_.front(); + fill_this_buffer_received_.pop_front(); + buffer->nFlags = 0; + buffer->nFilledLen = kBufferSize; + (*MockOmx::get()->callbacks()->FillBufferDone)( + MockOmx::get()->component(), + MockOmx::get()->component()->pApplicationPrivate, + buffer); + } // Make sure actions are completed. message_loop_.RunAllPending(); |