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

Unified Diff: media/renderers/video_renderer_impl.cc

Issue 1136513004: Switch GetWallClockTime to using vectors for input and output. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comments. Created 5 years, 7 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/renderers/video_renderer_impl.h ('k') | media/renderers/video_renderer_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/renderers/video_renderer_impl.cc
diff --git a/media/renderers/video_renderer_impl.cc b/media/renderers/video_renderer_impl.cc
index 8d3f2ae0e41c75f9cbdc64fa902829294493961b..2657bb809d73e98970b7f04d43fa88f9a0082939 100644
--- a/media/renderers/video_renderer_impl.cc
+++ b/media/renderers/video_renderer_impl.cc
@@ -144,7 +144,7 @@ void VideoRendererImpl::Initialize(
const BufferingStateCB& buffering_state_cb,
const base::Closure& ended_cb,
const PipelineStatusCB& error_cb,
- const WallClockTimeCB& wall_clock_time_cb,
+ const TimeSource::WallClockTimeCB& wall_clock_time_cb,
const base::Closure& waiting_for_decryption_key_cb) {
DCHECK(task_runner_->BelongsToCurrentThread());
base::AutoLock auto_lock(lock_);
@@ -348,7 +348,7 @@ void VideoRendererImpl::ThreadMain() {
}
base::TimeTicks target_paint_time =
- wall_clock_time_cb_.Run(ready_frames_.front()->timestamp());
+ ConvertMediaTimestamp(ready_frames_.front()->timestamp());
// If media time has stopped, don't attempt to paint any more frames.
if (target_paint_time.is_null()) {
@@ -422,7 +422,7 @@ void VideoRendererImpl::PaintNextReadyFrame_Locked() {
scoped_refptr<VideoFrame> next_frame = ready_frames_.front();
ready_frames_.pop_front();
- last_media_time_ = wall_clock_time_cb_.Run(next_frame->timestamp());
+ last_media_time_ = ConvertMediaTimestamp(next_frame->timestamp());
paint_cb_.Run(next_frame);
@@ -437,8 +437,7 @@ void VideoRendererImpl::DropNextReadyFrame_Locked() {
lock_.AssertAcquired();
- last_media_time_ =
- wall_clock_time_cb_.Run(ready_frames_.front()->timestamp());
+ last_media_time_ = ConvertMediaTimestamp(ready_frames_.front()->timestamp());
ready_frames_.pop_front();
frames_dropped_++;
@@ -743,4 +742,13 @@ size_t VideoRendererImpl::MaybeFireEndedCallback() {
return effective_frames;
}
+base::TimeTicks VideoRendererImpl::ConvertMediaTimestamp(
+ base::TimeDelta media_time) {
+ std::vector<base::TimeDelta> media_times(1, media_time);
+ std::vector<base::TimeTicks> wall_clock_times;
+ if (!wall_clock_time_cb_.Run(media_times, &wall_clock_times))
+ return base::TimeTicks();
+ return wall_clock_times[0];
+}
+
} // namespace media
« no previous file with comments | « media/renderers/video_renderer_impl.h ('k') | media/renderers/video_renderer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698