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

Unified Diff: media/filters/video_renderer_base.cc

Issue 10824141: Remove VideoDecoder::natural_size() & added VideoFrame::natural_size(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix copyright year. Created 8 years, 5 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 | « media/filters/video_renderer_base.h ('k') | media/filters/video_renderer_base_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/video_renderer_base.cc
diff --git a/media/filters/video_renderer_base.cc b/media/filters/video_renderer_base.cc
index 481c7840173bf210ab098d960af7c395a253b524..e4d90c78d2fe70e6fccb40691f393122791d533e 100644
--- a/media/filters/video_renderer_base.cc
+++ b/media/filters/video_renderer_base.cc
@@ -137,9 +137,6 @@ void VideoRendererBase::Initialize(const scoped_refptr<VideoDecoder>& decoder,
get_time_cb_ = get_time_cb;
get_duration_cb_ = get_duration_cb;
- // Notify the pipeline of the video dimensions.
- size_changed_cb_.Run(decoder_->natural_size());
-
// We're all good! Consider ourselves flushed. (ThreadMain() should never
// see us in the kUninitialized state).
// Since we had an initial Preroll(), we consider ourself flushed, because we
@@ -300,8 +297,7 @@ void VideoRendererBase::ThreadMain() {
// signal to the client that a new frame is available.
DCHECK(!pending_paint_);
DCHECK(!ready_frames_.empty());
- current_frame_ = ready_frames_.front();
- ready_frames_.pop_front();
+ SetCurrentFrameToNextReadyFrame();
AttemptRead_Locked();
base::AutoUnlock auto_unlock(lock_);
@@ -309,6 +305,18 @@ void VideoRendererBase::ThreadMain() {
}
}
+void VideoRendererBase::SetCurrentFrameToNextReadyFrame() {
+ current_frame_ = ready_frames_.front();
+ ready_frames_.pop_front();
+
+ // Notify the pipeline of natural_size() changes.
+ const gfx::Size& natural_size = current_frame_->natural_size();
+ if (natural_size != last_natural_size_) {
+ size_changed_cb_.Run(natural_size);
+ last_natural_size_ = natural_size;
+ }
+}
+
void VideoRendererBase::GetCurrentFrame(scoped_refptr<VideoFrame>* frame_out) {
base::AutoLock auto_lock(lock_);
DCHECK(!pending_paint_ && !pending_paint_with_last_available_);
@@ -457,10 +465,8 @@ void VideoRendererBase::FrameReady(VideoDecoder::DecoderStatus status,
// Because we might remain in the prerolled state for an undetermined amount
// of time (i.e., we were not playing before we started prerolling), we'll
// manually update the current frame and notify the subclass below.
- if (!ready_frames_.front()->IsEndOfStream()) {
- current_frame_ = ready_frames_.front();
- ready_frames_.pop_front();
- }
+ if (!ready_frames_.front()->IsEndOfStream())
+ SetCurrentFrameToNextReadyFrame();
// ...and we're done prerolling!
DCHECK(!preroll_cb_.is_null());
« no previous file with comments | « media/filters/video_renderer_base.h ('k') | media/filters/video_renderer_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698