OLD | NEW |
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 #include "base/time/default_tick_clock.h" | 8 #include "base/time/default_tick_clock.h" |
9 | 9 |
10 namespace media { | 10 namespace media { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 base::TimeDelta WallClockTimeSource::CurrentMediaTime() { | 50 base::TimeDelta WallClockTimeSource::CurrentMediaTime() { |
51 if (!ticking_) | 51 if (!ticking_) |
52 return base_time_; | 52 return base_time_; |
53 | 53 |
54 base::TimeTicks now = tick_clock_->NowTicks(); | 54 base::TimeTicks now = tick_clock_->NowTicks(); |
55 return base_time_ + | 55 return base_time_ + |
56 base::TimeDelta::FromMicroseconds( | 56 base::TimeDelta::FromMicroseconds( |
57 (now - reference_wall_ticks_).InMicroseconds() * playback_rate_); | 57 (now - reference_wall_ticks_).InMicroseconds() * playback_rate_); |
58 } | 58 } |
59 | 59 |
60 base::TimeDelta WallClockTimeSource::CurrentMediaTimeForSyncingVideo() { | |
61 return CurrentMediaTime(); | |
62 } | |
63 | |
64 void WallClockTimeSource::SetTickClockForTesting( | 60 void WallClockTimeSource::SetTickClockForTesting( |
65 scoped_ptr<base::TickClock> tick_clock) { | 61 scoped_ptr<base::TickClock> tick_clock) { |
66 tick_clock_.swap(tick_clock); | 62 tick_clock_.swap(tick_clock); |
67 } | 63 } |
68 | 64 |
69 } // namespace media | 65 } // namespace media |
OLD | NEW |