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

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 02022698cc1b34b1886c185818cf660ea06cec76..b35d1e0de3b48eed234011540697f6188c9f10ec 100644
--- a/media/filters/video_renderer_base.cc
+++ b/media/filters/video_renderer_base.cc
@@ -63,6 +63,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();
@@ -99,16 +101,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());
@@ -127,7 +132,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;
}
@@ -136,7 +141,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() {
@@ -369,6 +374,7 @@ void VideoRendererBase::FrameReady(scoped_refptr<VideoFrame> frame) {
ready_frames_.push_back(frame);
DCHECK_LE(ready_frames_.size(),
static_cast<size_t>(limits::kMaxVideoFrames));
+ video_time_cb_.Run(frame->GetTimestamp() + frame->GetDuration());
frame_available_.Signal();
PipelineStatistics statistics;

Powered by Google App Engine
This is Rietveld 408576698