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

Side by Side Diff: media/base/wall_clock_time_source.cc

Issue 2322393002: Clear reference time after SetMediaTime in video-only time source. (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « media/base/time_source.h ('k') | media/base/wall_clock_time_source_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/base/wall_clock_time_source.h" 5 #include "media/base/wall_clock_time_source.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace media { 9 namespace media {
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } 43 }
44 44
45 playback_rate_ = playback_rate; 45 playback_rate_ = playback_rate;
46 } 46 }
47 47
48 void WallClockTimeSource::SetMediaTime(base::TimeDelta time) { 48 void WallClockTimeSource::SetMediaTime(base::TimeDelta time) {
49 DVLOG(1) << __func__ << "(" << time.InMicroseconds() << ")"; 49 DVLOG(1) << __func__ << "(" << time.InMicroseconds() << ")";
50 base::AutoLock auto_lock(lock_); 50 base::AutoLock auto_lock(lock_);
51 CHECK(!ticking_); 51 CHECK(!ticking_);
52 base_timestamp_ = time; 52 base_timestamp_ = time;
53 reference_time_ = base::TimeTicks();
53 } 54 }
54 55
55 base::TimeDelta WallClockTimeSource::CurrentMediaTime() { 56 base::TimeDelta WallClockTimeSource::CurrentMediaTime() {
56 base::AutoLock auto_lock(lock_); 57 base::AutoLock auto_lock(lock_);
57 return CurrentMediaTime_Locked(); 58 return CurrentMediaTime_Locked();
58 } 59 }
59 60
60 bool WallClockTimeSource::GetWallClockTimes( 61 bool WallClockTimeSource::GetWallClockTimes(
61 const std::vector<base::TimeDelta>& media_timestamps, 62 const std::vector<base::TimeDelta>& media_timestamps,
62 std::vector<base::TimeTicks>* wall_clock_times) { 63 std::vector<base::TimeTicks>* wall_clock_times) {
(...skipping 22 matching lines...) Expand all
85 if (!ticking_ || !playback_rate_) 86 if (!ticking_ || !playback_rate_)
86 return base_timestamp_; 87 return base_timestamp_;
87 88
88 base::TimeTicks now = tick_clock_->NowTicks(); 89 base::TimeTicks now = tick_clock_->NowTicks();
89 return base_timestamp_ + 90 return base_timestamp_ +
90 base::TimeDelta::FromMicroseconds( 91 base::TimeDelta::FromMicroseconds(
91 (now - reference_time_).InMicroseconds() * playback_rate_); 92 (now - reference_time_).InMicroseconds() * playback_rate_);
92 } 93 }
93 94
94 } // namespace media 95 } // namespace media
OLDNEW
« no previous file with comments | « media/base/time_source.h ('k') | media/base/wall_clock_time_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698