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

Side by Side Diff: content/common/gpu/media/omx_video_decode_accelerator.cc

Issue 10916203: OMX: Avoid calling Fillbuffer while OMX is flushing. (Closed) Base URL: https://git.chromium.org/git/chromium/src@git-svn
Patch Set: OMX: Avoid calling Fillbuffer while OMX is flushing. Created 8 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/gpu/media/omx_video_decode_accelerator.h" 5 #include "content/common/gpu/media/omx_video_decode_accelerator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 return; 383 return;
384 if (!SendCommandToPort(OMX_CommandPortEnable, output_port_)) 384 if (!SendCommandToPort(OMX_CommandPortEnable, output_port_))
385 return; 385 return;
386 } 386 }
387 387
388 void OmxVideoDecodeAccelerator::ReusePictureBuffer(int32 picture_buffer_id) { 388 void OmxVideoDecodeAccelerator::ReusePictureBuffer(int32 picture_buffer_id) {
389 TRACE_EVENT1("Video Decoder", "OVDA::ReusePictureBuffer", 389 TRACE_EVENT1("Video Decoder", "OVDA::ReusePictureBuffer",
390 "Picture id", picture_buffer_id); 390 "Picture id", picture_buffer_id);
391 DCHECK_EQ(message_loop_, MessageLoop::current()); 391 DCHECK_EQ(message_loop_, MessageLoop::current());
392 392
393 // During port-flushing, do not call OMX FillThisBuffer.
394 if (current_state_change_ == RESETTING) {
395 queued_picture_buffer_ids_.push_back(picture_buffer_id);
396 return;
397 }
398
393 RETURN_ON_FAILURE(CanFillBuffer(), "Can't fill buffer", ILLEGAL_STATE,); 399 RETURN_ON_FAILURE(CanFillBuffer(), "Can't fill buffer", ILLEGAL_STATE,);
394 400
395 OutputPictureById::iterator it = pictures_.find(picture_buffer_id); 401 OutputPictureById::iterator it = pictures_.find(picture_buffer_id);
396 RETURN_ON_FAILURE(it != pictures_.end(), 402 RETURN_ON_FAILURE(it != pictures_.end(),
397 "Missing picture buffer id: " << picture_buffer_id, 403 "Missing picture buffer id: " << picture_buffer_id,
398 INVALID_ARGUMENT,); 404 INVALID_ARGUMENT,);
399 OutputPicture& output_picture = it->second; 405 OutputPicture& output_picture = it->second;
400 406
401 ++output_buffers_at_component_; 407 ++output_buffers_at_component_;
402 OMX_ERRORTYPE result = 408 OMX_ERRORTYPE result =
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 client_->ProvidePictureBuffers( 794 client_->ProvidePictureBuffers(
789 kNumPictureBuffers, 795 kNumPictureBuffers,
790 gfx::Size(vformat.nFrameWidth, vformat.nFrameHeight), 796 gfx::Size(vformat.nFrameWidth, vformat.nFrameHeight),
791 GL_TEXTURE_2D); 797 GL_TEXTURE_2D);
792 } 798 }
793 } 799 }
794 800
795 void OmxVideoDecodeAccelerator::OnOutputPortEnabled() { 801 void OmxVideoDecodeAccelerator::OnOutputPortEnabled() {
796 DCHECK_EQ(message_loop_, MessageLoop::current()); 802 DCHECK_EQ(message_loop_, MessageLoop::current());
797 803
804 if (current_state_change_ == RESETTING) {
805 for (OutputPictureById::iterator it = pictures_.begin();
806 it != pictures_.end(); ++it) {
807 queued_picture_buffer_ids_.push_back(it->first);
808 }
809 return;
810 }
811
798 if (!CanFillBuffer()) { 812 if (!CanFillBuffer()) {
799 StopOnError(ILLEGAL_STATE); 813 StopOnError(ILLEGAL_STATE);
800 return; 814 return;
801 } 815 }
802 816
803 // Provide output buffers to decoder. 817 // Provide output buffers to decoder.
804 for (OutputPictureById::iterator it = pictures_.begin(); 818 for (OutputPictureById::iterator it = pictures_.begin();
805 it != pictures_.end(); ++it) { 819 it != pictures_.end(); ++it) {
806 OMX_BUFFERHEADERTYPE* omx_buffer = it->second.omx_buffer_header; 820 OMX_BUFFERHEADERTYPE* omx_buffer = it->second.omx_buffer_header;
807 DCHECK(omx_buffer); 821 DCHECK(omx_buffer);
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 decoder->message_loop_->PostTask(FROM_HERE, base::Bind( 1130 decoder->message_loop_->PostTask(FROM_HERE, base::Bind(
1117 &OmxVideoDecodeAccelerator::FillBufferDoneTask, decoder->weak_this(), 1131 &OmxVideoDecodeAccelerator::FillBufferDoneTask, decoder->weak_this(),
1118 buffer)); 1132 buffer));
1119 return OMX_ErrorNone; 1133 return OMX_ErrorNone;
1120 } 1134 }
1121 1135
1122 bool OmxVideoDecodeAccelerator::CanFillBuffer() { 1136 bool OmxVideoDecodeAccelerator::CanFillBuffer() {
1123 DCHECK_EQ(message_loop_, MessageLoop::current()); 1137 DCHECK_EQ(message_loop_, MessageLoop::current());
1124 const CurrentStateChange csc = current_state_change_; 1138 const CurrentStateChange csc = current_state_change_;
1125 const OMX_STATETYPE cs = client_state_; 1139 const OMX_STATETYPE cs = client_state_;
1126 return (csc != DESTROYING && csc != ERRORING) && 1140 return (csc != DESTROYING && csc != ERRORING && csc != RESETTING) &&
1127 (cs == OMX_StateIdle || cs == OMX_StateExecuting || cs == OMX_StatePause); 1141 (cs == OMX_StateIdle || cs == OMX_StateExecuting || cs == OMX_StatePause);
1128 } 1142 }
1129 1143
1130 bool OmxVideoDecodeAccelerator::SendCommandToPort( 1144 bool OmxVideoDecodeAccelerator::SendCommandToPort(
1131 OMX_COMMANDTYPE cmd, int port_index) { 1145 OMX_COMMANDTYPE cmd, int port_index) {
1132 DCHECK_EQ(message_loop_, MessageLoop::current()); 1146 DCHECK_EQ(message_loop_, MessageLoop::current());
1133 OMX_ERRORTYPE result = OMX_SendCommand(component_handle_, 1147 OMX_ERRORTYPE result = OMX_SendCommand(component_handle_,
1134 cmd, port_index, 0); 1148 cmd, port_index, 0);
1135 RETURN_ON_OMX_FAILURE(result, "SendCommand() failed" << cmd, 1149 RETURN_ON_OMX_FAILURE(result, "SendCommand() failed" << cmd,
1136 PLATFORM_FAILURE, false); 1150 PLATFORM_FAILURE, false);
1137 return true; 1151 return true;
1138 } 1152 }
OLDNEW
« 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