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

Unified Diff: media/base/wall_clock_time_source.cc

Issue 1027553002: Change the TimeSource interface to return wallclock time for video. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove underflow changes. Created 5 years, 9 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/base/wall_clock_time_source.h ('k') | media/filters/audio_clock.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/wall_clock_time_source.cc
diff --git a/media/base/wall_clock_time_source.cc b/media/base/wall_clock_time_source.cc
index 408de93e05e830867278d3e667bc3ff4ad59abb2..d8325464c1038ae154fa8ad1985ece3e4f0378f0 100644
--- a/media/base/wall_clock_time_source.cc
+++ b/media/base/wall_clock_time_source.cc
@@ -60,8 +60,15 @@ base::TimeDelta WallClockTimeSource::CurrentMediaTime() {
return CurrentMediaTime_Locked();
}
-base::TimeDelta WallClockTimeSource::CurrentMediaTimeForSyncingVideo() {
- return CurrentMediaTime();
+base::TimeTicks WallClockTimeSource::GetWallClockTime(base::TimeDelta time) {
+ base::AutoLock auto_lock(lock_);
+ if (!ticking_ || playback_rate_ == 0.0)
+ return base::TimeTicks();
+
+ // See notes about |time| values less than |base_time_| in TimeSource header.
+ return reference_wall_ticks_ +
+ base::TimeDelta::FromMicroseconds(
+ (time - base_time_).InMicroseconds() * playback_rate_);
}
void WallClockTimeSource::SetTickClockForTesting(
@@ -71,7 +78,7 @@ void WallClockTimeSource::SetTickClockForTesting(
base::TimeDelta WallClockTimeSource::CurrentMediaTime_Locked() {
lock_.AssertAcquired();
- if (!ticking_)
+ if (!ticking_ || playback_rate_ == 0.0)
return base_time_;
base::TimeTicks now = tick_clock_->NowTicks();
« no previous file with comments | « media/base/wall_clock_time_source.h ('k') | media/filters/audio_clock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698