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

Unified Diff: media/filters/video_renderer_base.cc

Issue 9155003: Fix media timeline so that thumb never exceeds buffered data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 11 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
Index: media/filters/video_renderer_base.cc
diff --git a/media/filters/video_renderer_base.cc b/media/filters/video_renderer_base.cc
index df7350c23d6b640df37cb2101c18a0fe12b30b52..12c981d2619f06deba672296e43a6fd561902602 100644
--- a/media/filters/video_renderer_base.cc
+++ b/media/filters/video_renderer_base.cc
@@ -64,6 +64,8 @@ void VideoRendererBase::Stop(const base::Closure& callback) {
base::AutoLock auto_lock(lock_);
state_ = kStopped;
+ statistics_callback_.Reset();
+ video_time_cb_.Reset();
if (!pending_paint_ && !pending_paint_with_last_available_)
DoStopOrError_Locked();
@@ -100,16 +102,19 @@ void VideoRendererBase::Seek(base::TimeDelta time, const FilterStatusCB& cb) {
}
void VideoRendererBase::Initialize(VideoDecoder* decoder,
- const base::Closure& callback,
- const StatisticsCallback& stats_callback) {
+ const base::Closure& init_cb,
+ const StatisticsCallback& stats_callback,
+ const VideoTimeCB& video_time_cb) {
base::AutoLock auto_lock(lock_);
DCHECK(decoder);
- DCHECK(!callback.is_null());
+ DCHECK(!init_cb.is_null());
DCHECK(!stats_callback.is_null());
+ DCHECK(!video_time_cb.is_null());
DCHECK_EQ(kUninitialized, state_);
decoder_ = decoder;
statistics_callback_ = stats_callback;
+ video_time_cb_ = video_time_cb;
// Notify the pipeline of the video dimensions.
host()->SetNaturalVideoSize(decoder_->natural_size());
@@ -128,7 +133,7 @@ void VideoRendererBase::Initialize(VideoDecoder* decoder,
NOTREACHED() << "Video thread creation failed";
state_ = kError;
host()->SetError(PIPELINE_ERROR_INITIALIZATION_FAILED);
- callback.Run();
+ init_cb.Run();
return;
}
@@ -137,7 +142,7 @@ void VideoRendererBase::Initialize(VideoDecoder* decoder,
// TODO(scherkus): find out if this is necessary, but it seems to help.
::SetThreadPriority(thread_, THREAD_PRIORITY_ABOVE_NORMAL);
#endif // defined(OS_WIN)
- callback.Run();
+ init_cb.Run();
}
bool VideoRendererBase::HasEnded() {
@@ -374,6 +379,8 @@ void VideoRendererBase::FrameReady(scoped_refptr<VideoFrame> frame) {
// This one's a keeper! Place it in the ready queue.
ready_frames_.push_back(frame);
DCHECK_LE(NumFrames_Locked(), limits::kMaxVideoFrames);
+ if (!frame->IsEndOfStream())
+ video_time_cb_.Run(frame->GetTimestamp() + frame->GetDuration());
frame_available_.Signal();
PipelineStatistics statistics;

Powered by Google App Engine
This is Rietveld 408576698