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

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

Issue 557333002: Revert of Switch to using media::TimeSource inside media::RendererImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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/video_renderer.h ('k') | media/base/wall_clock_time_source.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 #ifndef MEDIA_BASE_WALL_CLOCK_TIME_SOURCE_H_ 5 #ifndef MEDIA_BASE_WALL_CLOCK_TIME_SOURCE_H_
6 #define MEDIA_BASE_WALL_CLOCK_TIME_SOURCE_H_ 6 #define MEDIA_BASE_WALL_CLOCK_TIME_SOURCE_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "media/base/media_export.h" 9 #include "media/base/media_export.h"
10 #include "media/base/time_source.h" 10 #include "media/base/time_source.h"
11 11
12 namespace base { 12 namespace base {
13 class TickClock; 13 class TickClock;
14 } 14 }
15 15
16 namespace media { 16 namespace media {
17 17
18 // A time source that uses interpolation based on the system clock. 18 // A time source that uses interpolation based on the system clock.
19 class MEDIA_EXPORT WallClockTimeSource : public TimeSource { 19 class MEDIA_EXPORT WallClockTimeSource : public TimeSource {
20 public: 20 public:
21 WallClockTimeSource(); 21 WallClockTimeSource();
22 virtual ~WallClockTimeSource(); 22 virtual ~WallClockTimeSource();
23 23
24 // TimeSource implementation. 24 // TimeSource implementation.
25 virtual void StartTicking() OVERRIDE; 25 virtual void StartTicking() OVERRIDE;
26 virtual void StopTicking() OVERRIDE; 26 virtual void StopTicking() OVERRIDE;
27 virtual void SetPlaybackRate(float playback_rate) OVERRIDE; 27 virtual void SetPlaybackRate(float playback_rate) OVERRIDE;
28 virtual void SetMediaTime(base::TimeDelta time) OVERRIDE; 28 virtual void SetMediaTime(base::TimeDelta time) OVERRIDE;
29 virtual base::TimeDelta CurrentMediaTime() OVERRIDE; 29 virtual base::TimeDelta CurrentMediaTime() OVERRIDE;
30 virtual base::TimeDelta CurrentMediaTimeForSyncingVideo() OVERRIDE;
31 30
32 void SetTickClockForTesting(scoped_ptr<base::TickClock> tick_clock); 31 void SetTickClockForTesting(scoped_ptr<base::TickClock> tick_clock);
33 32
34 private: 33 private:
35 scoped_ptr<base::TickClock> tick_clock_; 34 scoped_ptr<base::TickClock> tick_clock_;
36 bool ticking_; 35 bool ticking_;
37 36
38 // While ticking we can interpolate the current media time by measuring the 37 // While ticking we can interpolate the current media time by measuring the
39 // delta between our reference ticks and the current system ticks and scaling 38 // delta between our reference ticks and the current system ticks and scaling
40 // that time by the playback rate. 39 // that time by the playback rate.
41 float playback_rate_; 40 float playback_rate_;
42 base::TimeDelta base_time_; 41 base::TimeDelta base_time_;
43 base::TimeTicks reference_wall_ticks_; 42 base::TimeTicks reference_wall_ticks_;
44 43
45 DISALLOW_COPY_AND_ASSIGN(WallClockTimeSource); 44 DISALLOW_COPY_AND_ASSIGN(WallClockTimeSource);
46 }; 45 };
47 46
48 } // namespace media 47 } // namespace media
49 48
50 #endif // MEDIA_BASE_WALL_CLOCK_TIME_SOURCE_H_ 49 #endif // MEDIA_BASE_WALL_CLOCK_TIME_SOURCE_H_
OLDNEW
« no previous file with comments | « media/base/video_renderer.h ('k') | media/base/wall_clock_time_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698