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

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

Issue 1094553002: Revert "Speculative revert by sheriff" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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/video_renderer_sink.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 #include "base/time/default_tick_clock.h" 8 #include "base/time/default_tick_clock.h"
9 9
10 namespace media { 10 namespace media {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 } 61 }
62 62
63 base::TimeTicks WallClockTimeSource::GetWallClockTime(base::TimeDelta time) { 63 base::TimeTicks WallClockTimeSource::GetWallClockTime(base::TimeDelta time) {
64 base::AutoLock auto_lock(lock_); 64 base::AutoLock auto_lock(lock_);
65 if (!ticking_ || playback_rate_ == 0.0) 65 if (!ticking_ || playback_rate_ == 0.0)
66 return base::TimeTicks(); 66 return base::TimeTicks();
67 67
68 // See notes about |time| values less than |base_time_| in TimeSource header. 68 // See notes about |time| values less than |base_time_| in TimeSource header.
69 return reference_wall_ticks_ + 69 return reference_wall_ticks_ +
70 base::TimeDelta::FromMicroseconds( 70 base::TimeDelta::FromMicroseconds(
71 (time - base_time_).InMicroseconds() * playback_rate_); 71 (time - base_time_).InMicroseconds() / playback_rate_);
72 } 72 }
73 73
74 void WallClockTimeSource::SetTickClockForTesting( 74 void WallClockTimeSource::SetTickClockForTesting(
75 scoped_ptr<base::TickClock> tick_clock) { 75 scoped_ptr<base::TickClock> tick_clock) {
76 tick_clock_.swap(tick_clock); 76 tick_clock_.swap(tick_clock);
77 } 77 }
78 78
79 base::TimeDelta WallClockTimeSource::CurrentMediaTime_Locked() { 79 base::TimeDelta WallClockTimeSource::CurrentMediaTime_Locked() {
80 lock_.AssertAcquired(); 80 lock_.AssertAcquired();
81 if (!ticking_ || playback_rate_ == 0.0) 81 if (!ticking_ || playback_rate_ == 0.0)
82 return base_time_; 82 return base_time_;
83 83
84 base::TimeTicks now = tick_clock_->NowTicks(); 84 base::TimeTicks now = tick_clock_->NowTicks();
85 return base_time_ + 85 return base_time_ +
86 base::TimeDelta::FromMicroseconds( 86 base::TimeDelta::FromMicroseconds(
87 (now - reference_wall_ticks_).InMicroseconds() * playback_rate_); 87 (now - reference_wall_ticks_).InMicroseconds() * playback_rate_);
88 } 88 }
89 89
90 } // namespace media 90 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_renderer_sink.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