summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-01 22:42:51 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-01 22:42:51 +0000
commitf91ea4efba8d5366b78450ea3ea1a4afef94d57e (patch)
treeee0eec10b9747a7aa109611a7f7fa33e61111a0a
parent3510d4245d45a5dc301b87821ec8eb4fae190d9c (diff)
downloadchromium_src-f91ea4efba8d5366b78450ea3ea1a4afef94d57e.zip
chromium_src-f91ea4efba8d5366b78450ea3ea1a4afef94d57e.tar.gz
chromium_src-f91ea4efba8d5366b78450ea3ea1a4afef94d57e.tar.bz2
Don't hold the lock when calling VideoRendererBase::OnFrameAvailable().
There's one instance of the code where we hold on to the lock when calling OnFrameAvailable(), which means if the subclass can crash if it calls a locked method such as GetCurrentFrame(). BUG=none TEST=media_unittests Review URL: http://codereview.chromium.org/6260052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73362 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--media/filters/video_renderer_base.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/media/filters/video_renderer_base.cc b/media/filters/video_renderer_base.cc
index 1268ec3..16b1fbf 100644
--- a/media/filters/video_renderer_base.cc
+++ b/media/filters/video_renderer_base.cc
@@ -318,7 +318,6 @@ void VideoRendererBase::ThreadMain() {
}
if (new_frame_available) {
base::AutoUnlock auto_unlock(lock_);
- // Notify subclass that |current_frame_| has been updated.
OnFrameAvailable();
}
}
@@ -419,6 +418,7 @@ void VideoRendererBase::ConsumeVideoFrame(scoped_refptr<VideoFrame> frame) {
}
// Check for our preroll complete condition.
+ bool new_frame_available = false;
if (state_ == kSeeking) {
if (frames_queue_ready_.size() == Limits::kMaxVideoFrames ||
frame->IsEndOfStream()) {
@@ -435,7 +435,7 @@ void VideoRendererBase::ConsumeVideoFrame(scoped_refptr<VideoFrame> frame) {
frames_queue_ready_.pop_front();
current_frame_ = first_frame;
}
- OnFrameAvailable();
+ new_frame_available = true;
// If we reach prerolled state before Seek() is called by pipeline,
// |seek_callback_| is not set, we will return immediately during
@@ -448,6 +448,11 @@ void VideoRendererBase::ConsumeVideoFrame(scoped_refptr<VideoFrame> frame) {
} else if (state_ == kFlushing && pending_reads_ == 0 && !pending_paint_) {
OnFlushDone();
}
+
+ if (new_frame_available) {
+ base::AutoUnlock auto_unlock(lock_);
+ OnFrameAvailable();
+ }
}
VideoDecoder* VideoRendererBase::GetDecoder() {