Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Unified Diff: content/common/gpu/media/omx_video_decode_accelerator.cc

Issue 10824281: Defer OMX Flush() when no input buffers are available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ppapi/examples/video_decode/video_decode.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/media/omx_video_decode_accelerator.cc
diff --git a/content/common/gpu/media/omx_video_decode_accelerator.cc b/content/common/gpu/media/omx_video_decode_accelerator.cc
index 956742d7eca9ae5154efd2f92414462acbb9f0f4..9c3620809f5936d9dcde9262721d17a41cfee1df 100644
--- a/content/common/gpu/media/omx_video_decode_accelerator.cc
+++ b/content/common/gpu/media/omx_video_decode_accelerator.cc
@@ -289,7 +289,8 @@ void OmxVideoDecodeAccelerator::Decode(
return;
}
- RETURN_ON_FAILURE(current_state_change_ == NO_TRANSITION &&
+ RETURN_ON_FAILURE((current_state_change_ == NO_TRANSITION ||
+ current_state_change_ == FLUSHING) &&
(client_state_ == OMX_StateIdle ||
client_state_ == OMX_StateExecuting),
"Call to Decode() during invalid state or transition: "
@@ -299,6 +300,19 @@ void OmxVideoDecodeAccelerator::Decode(
OMX_BUFFERHEADERTYPE* omx_buffer = free_input_buffers_.front();
free_input_buffers_.pop();
+ if (bitstream_buffer.id() == -1 && bitstream_buffer.size() == 0) {
+ // Cook up an empty buffer w/ EOS set and feed it to OMX.
+ omx_buffer->nFilledLen = 0;
+ omx_buffer->nAllocLen = omx_buffer->nFilledLen;
+ omx_buffer->nFlags |= OMX_BUFFERFLAG_EOS;
+ omx_buffer->nTimeStamp = -2;
+ OMX_ERRORTYPE result = OMX_EmptyThisBuffer(component_handle_, omx_buffer);
+ RETURN_ON_OMX_FAILURE(result, "OMX_EmptyThisBuffer() failed",
+ PLATFORM_FAILURE,);
+ input_buffers_at_component_++;
+ return;
+ }
+
// Setup |omx_buffer|.
scoped_ptr<base::SharedMemory> shm(
new base::SharedMemory(bitstream_buffer.handle(), true));
@@ -364,6 +378,7 @@ void OmxVideoDecodeAccelerator::ReusePictureBuffer(int32 picture_buffer_id) {
TRACE_EVENT1("Video Decoder", "OVDA::ReusePictureBuffer",
"Picture id", picture_buffer_id);
DCHECK_EQ(message_loop_, MessageLoop::current());
+
RETURN_ON_FAILURE(CanFillBuffer(), "Can't fill buffer", ILLEGAL_STATE,);
OutputPictureById::iterator it = pictures_.find(picture_buffer_id);
@@ -385,17 +400,7 @@ void OmxVideoDecodeAccelerator::Flush() {
DCHECK_EQ(client_state_, OMX_StateExecuting);
current_state_change_ = FLUSHING;
- // Cook up an empty buffer w/ EOS set and feed it to OMX.
- OMX_BUFFERHEADERTYPE* omx_buffer = free_input_buffers_.front();
- free_input_buffers_.pop();
- omx_buffer->nFilledLen = 0;
- omx_buffer->nAllocLen = omx_buffer->nFilledLen;
- omx_buffer->nFlags |= OMX_BUFFERFLAG_EOS;
- omx_buffer->nTimeStamp = -2;
- OMX_ERRORTYPE result = OMX_EmptyThisBuffer(component_handle_, omx_buffer);
- RETURN_ON_OMX_FAILURE(result, "OMX_EmptyThisBuffer() failed",
- PLATFORM_FAILURE,);
- input_buffers_at_component_++;
+ Decode(media::BitstreamBuffer(-1, base::SharedMemoryHandle(), 0));
}
void OmxVideoDecodeAccelerator::OnReachedEOSInFlushing() {
@@ -535,6 +540,10 @@ void OmxVideoDecodeAccelerator::OnReachedPauseInResetting() {
void OmxVideoDecodeAccelerator::DecodeQueuedBitstreamBuffers() {
BitstreamBufferList buffers;
buffers.swap(queued_bitstream_buffers_);
+ if (current_state_change_ == DESTROYING ||
+ current_state_change_ == ERRORING) {
+ return;
+ }
for (size_t i = 0; i < buffers.size(); ++i)
Decode(buffers[i]);
}
« no previous file with comments | « no previous file | ppapi/examples/video_decode/video_decode.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698