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

Unified Diff: media/filters/video_renderer_impl.cc

Issue 379343005: Introduce media::TimeSource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
Index: media/filters/video_renderer_impl.cc
diff --git a/media/filters/video_renderer_impl.cc b/media/filters/video_renderer_impl.cc
index 7bf14d7a5d87c41de548e0121a2218c2143a611b..5b3e8e2e64351ca05fff412d5bad5b18934426e4 100644
--- a/media/filters/video_renderer_impl.cc
+++ b/media/filters/video_renderer_impl.cc
@@ -85,7 +85,6 @@ void VideoRendererImpl::Stop(const base::Closure& callback) {
state_ = kStopped;
statistics_cb_.Reset();
- max_time_cb_.Reset();
DoStopOrError_Locked();
// Clean up our thread if present.
@@ -105,7 +104,7 @@ void VideoRendererImpl::Stop(const base::Closure& callback) {
video_frame_stream_.Stop(callback);
}
-void VideoRendererImpl::StartPlayingFrom(base::TimeDelta timestamp) {
+void VideoRendererImpl::StartPlaying() {
DCHECK(task_runner_->BelongsToCurrentThread());
base::AutoLock auto_lock(lock_);
DCHECK_EQ(state_, kFlushed);
@@ -114,7 +113,7 @@ void VideoRendererImpl::StartPlayingFrom(base::TimeDelta timestamp) {
DCHECK_EQ(buffering_state_, BUFFERING_HAVE_NOTHING);
state_ = kPlaying;
- start_timestamp_ = timestamp;
+ start_timestamp_ = get_time_cb_.Run();
AttemptRead_Locked();
}
@@ -122,7 +121,6 @@ void VideoRendererImpl::Initialize(DemuxerStream* stream,
bool low_delay,
const PipelineStatusCB& init_cb,
const StatisticsCB& statistics_cb,
- const TimeCB& max_time_cb,
const BufferingStateCB& buffering_state_cb,
const base::Closure& ended_cb,
const PipelineStatusCB& error_cb,
@@ -134,7 +132,6 @@ void VideoRendererImpl::Initialize(DemuxerStream* stream,
DCHECK_EQ(stream->type(), DemuxerStream::VIDEO);
DCHECK(!init_cb.is_null());
DCHECK(!statistics_cb.is_null());
- DCHECK(!max_time_cb.is_null());
DCHECK(!buffering_state_cb.is_null());
DCHECK(!ended_cb.is_null());
DCHECK(!get_time_cb.is_null());
@@ -145,7 +142,6 @@ void VideoRendererImpl::Initialize(DemuxerStream* stream,
init_cb_ = init_cb;
statistics_cb_ = statistics_cb;
- max_time_cb_ = max_time_cb;
buffering_state_cb_ = buffering_state_cb;
ended_cb_ = ended_cb;
error_cb_ = error_cb;
@@ -370,21 +366,7 @@ bool VideoRendererImpl::HaveEnoughData_Locked() {
void VideoRendererImpl::TransitionToHaveEnough_Locked() {
DCHECK_EQ(buffering_state_, BUFFERING_HAVE_NOTHING);
- if (received_end_of_stream_)
- max_time_cb_.Run(get_duration_cb_.Run());
-
if (!ready_frames_.empty()) {
- // Max time isn't reported while we're in a have nothing state as we could
- // be discarding frames to find |start_timestamp_|.
- if (!received_end_of_stream_) {
- base::TimeDelta max_timestamp = ready_frames_[0]->timestamp();
- for (size_t i = 1; i < ready_frames_.size(); ++i) {
- if (ready_frames_[i]->timestamp() > max_timestamp)
- max_timestamp = ready_frames_[i]->timestamp();
- }
- max_time_cb_.Run(max_timestamp);
- }
-
// Because the clock might remain paused in for an undetermined amount
// of time (e.g., seeking while paused), paint the first frame.
PaintNextReadyFrame_Locked();
@@ -413,13 +395,6 @@ void VideoRendererImpl::AddReadyFrame_Locked(
DCHECK_LE(ready_frames_.size(),
static_cast<size_t>(limits::kMaxVideoFrames));
- // FrameReady() may add frames but discard them when we're decoding frames to
- // reach |start_timestamp_|. In this case we'll only want to update the max
- // time when we know we've reached |start_timestamp_| and have buffered enough
- // frames to being playback.
- if (buffering_state_ == BUFFERING_HAVE_ENOUGH)
- max_time_cb_.Run(frame->timestamp());
-
// Avoid needlessly waking up |thread_| unless playing.
if (state_ == kPlaying)
frame_available_.Signal();

Powered by Google App Engine
This is Rietveld 408576698