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

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

Issue 10837212: OMX: Don't try to send buffers when in resetting state. (Closed) Base URL: https://git.chromium.org/git/chromium/src@git-svn
Patch Set: Also handle the case of destroy/error. 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 | no next file » | 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 de862197752cc2d491d7c388b15a5266ccc374a3..41cdcb0bf9c657a6f2124f7a19d2742c773dff8e 100644
--- a/content/common/gpu/media/omx_video_decode_accelerator.cc
+++ b/content/common/gpu/media/omx_video_decode_accelerator.cc
@@ -359,6 +359,17 @@ void OmxVideoDecodeAccelerator::ReusePictureBuffer(int32 picture_buffer_id) {
TRACE_EVENT1("Video Decoder", "OVDA::ReusePictureBuffer",
"Picture id", picture_buffer_id);
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,);
OutputPictureById::iterator it = pictures_.find(picture_buffer_id);
@@ -800,8 +811,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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698