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

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

Issue 10961059: Correctly decrement OmxVideoDecodeAccelerator::output_buffers_at_component_ during Reset/Destroy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | Annotate | Revision Log
« 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 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 ++output_buffers_at_component_; 811 ++output_buffers_at_component_;
812 OMX_ERRORTYPE result = OMX_FillThisBuffer(component_handle_, omx_buffer); 812 OMX_ERRORTYPE result = OMX_FillThisBuffer(component_handle_, omx_buffer);
813 RETURN_ON_OMX_FAILURE(result, "OMX_FillThisBuffer() failed", 813 RETURN_ON_OMX_FAILURE(result, "OMX_FillThisBuffer() failed",
814 PLATFORM_FAILURE,); 814 PLATFORM_FAILURE,);
815 } 815 }
816 } 816 }
817 817
818 void OmxVideoDecodeAccelerator::FillBufferDoneTask( 818 void OmxVideoDecodeAccelerator::FillBufferDoneTask(
819 OMX_BUFFERHEADERTYPE* buffer) { 819 OMX_BUFFERHEADERTYPE* buffer) {
820 820
821 // If we are destroying and then get a fillbuffer callback, calling into any
822 // openmax function will put us in error mode, so bail now. In the RESETTING
823 // case we still need to enqueue the picture ids but have to avoid giving
824 // them to the client (this is handled below).
825 if (current_state_change_ == DESTROYING ||
826 current_state_change_ == ERRORING)
827 return;
828
829 media::Picture* picture = 821 media::Picture* picture =
830 reinterpret_cast<media::Picture*>(buffer->pAppPrivate); 822 reinterpret_cast<media::Picture*>(buffer->pAppPrivate);
831 int picture_buffer_id = picture ? picture->picture_buffer_id() : -1; 823 int picture_buffer_id = picture ? picture->picture_buffer_id() : -1;
832 TRACE_EVENT2("Video Decoder", "OVDA::FillBufferDoneTask", 824 TRACE_EVENT2("Video Decoder", "OVDA::FillBufferDoneTask",
833 "Buffer id", buffer->nTimeStamp, 825 "Buffer id", buffer->nTimeStamp,
834 "Picture id", picture_buffer_id); 826 "Picture id", picture_buffer_id);
835 DCHECK_EQ(message_loop_, MessageLoop::current()); 827 DCHECK_EQ(message_loop_, MessageLoop::current());
836 DCHECK_GT(output_buffers_at_component_, 0); 828 DCHECK_GT(output_buffers_at_component_, 0);
837 --output_buffers_at_component_; 829 --output_buffers_at_component_;
838 830
831 // If we are destroying and then get a fillbuffer callback, calling into any
832 // openmax function will put us in error mode, so bail now. In the RESETTING
833 // case we still need to enqueue the picture ids but have to avoid giving
834 // them to the client (this is handled below).
835 if (current_state_change_ == DESTROYING ||
836 current_state_change_ == ERRORING)
837 return;
838
839 if (fake_output_buffers_.size() && fake_output_buffers_.count(buffer)) { 839 if (fake_output_buffers_.size() && fake_output_buffers_.count(buffer)) {
840 size_t erased = fake_output_buffers_.erase(buffer); 840 size_t erased = fake_output_buffers_.erase(buffer);
841 DCHECK_EQ(erased, 1U); 841 DCHECK_EQ(erased, 1U);
842 OMX_ERRORTYPE result = 842 OMX_ERRORTYPE result =
843 OMX_FreeBuffer(component_handle_, output_port_, buffer); 843 OMX_FreeBuffer(component_handle_, output_port_, buffer);
844 RETURN_ON_OMX_FAILURE(result, "OMX_FreeBuffer failed", PLATFORM_FAILURE,); 844 RETURN_ON_OMX_FAILURE(result, "OMX_FreeBuffer failed", PLATFORM_FAILURE,);
845 return; 845 return;
846 } 846 }
847 DCHECK(!fake_output_buffers_.size()); 847 DCHECK(!fake_output_buffers_.size());
848 848
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 1129
1130 bool OmxVideoDecodeAccelerator::SendCommandToPort( 1130 bool OmxVideoDecodeAccelerator::SendCommandToPort(
1131 OMX_COMMANDTYPE cmd, int port_index) { 1131 OMX_COMMANDTYPE cmd, int port_index) {
1132 DCHECK_EQ(message_loop_, MessageLoop::current()); 1132 DCHECK_EQ(message_loop_, MessageLoop::current());
1133 OMX_ERRORTYPE result = OMX_SendCommand(component_handle_, 1133 OMX_ERRORTYPE result = OMX_SendCommand(component_handle_,
1134 cmd, port_index, 0); 1134 cmd, port_index, 0);
1135 RETURN_ON_OMX_FAILURE(result, "SendCommand() failed" << cmd, 1135 RETURN_ON_OMX_FAILURE(result, "SendCommand() failed" << cmd,
1136 PLATFORM_FAILURE, false); 1136 PLATFORM_FAILURE, false);
1137 return true; 1137 return true;
1138 } 1138 }
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