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

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

Issue 1129323003: Allow callers of TimeSource::GetWallClockTime() to suspend time. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments. Created 5 years, 7 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 "base/synchronization/lock.h" 9 #include "base/synchronization/lock.h"
10 #include "media/base/media_export.h" 10 #include "media/base/media_export.h"
(...skipping 10 matching lines...) Expand all
21 public: 21 public:
22 WallClockTimeSource(); 22 WallClockTimeSource();
23 ~WallClockTimeSource() override; 23 ~WallClockTimeSource() override;
24 24
25 // TimeSource implementation. 25 // TimeSource implementation.
26 void StartTicking() override; 26 void StartTicking() override;
27 void StopTicking() override; 27 void StopTicking() override;
28 void SetPlaybackRate(double playback_rate) override; 28 void SetPlaybackRate(double playback_rate) override;
29 void SetMediaTime(base::TimeDelta time) override; 29 void SetMediaTime(base::TimeDelta time) override;
30 base::TimeDelta CurrentMediaTime() override; 30 base::TimeDelta CurrentMediaTime() override;
31 base::TimeTicks GetWallClockTime(base::TimeDelta time) override; 31 base::TimeTicks GetWallClockTime(base::TimeDelta time,
32 int request_flags) override;
32 33
33 void SetTickClockForTesting(scoped_ptr<base::TickClock> tick_clock); 34 void SetTickClockForTesting(scoped_ptr<base::TickClock> tick_clock);
34 35
35 private: 36 private:
36 base::TimeDelta CurrentMediaTime_Locked(); 37 base::TimeDelta CurrentMediaTime_Locked();
37 38
38 scoped_ptr<base::TickClock> tick_clock_; 39 scoped_ptr<base::TickClock> tick_clock_;
39 bool ticking_; 40 bool ticking_;
40 41
41 // While ticking we can interpolate the current media time by measuring the 42 // While ticking we can interpolate the current media time by measuring the
42 // delta between our reference ticks and the current system ticks and scaling 43 // delta between our reference ticks and the current system ticks and scaling
43 // that time by the playback rate. 44 // that time by the playback rate.
44 double playback_rate_; 45 double playback_rate_;
45 base::TimeDelta base_time_; 46 base::TimeDelta base_time_;
46 base::TimeTicks reference_wall_ticks_; 47 base::TimeTicks reference_wall_ticks_;
47 48
48 // TODO(scherkus): Remove internal locking from this class after access to 49 // TODO(scherkus): Remove internal locking from this class after access to
49 // Renderer::CurrentMediaTime() is single threaded http://crbug.com/370634 50 // Renderer::CurrentMediaTime() is single threaded http://crbug.com/370634
50 base::Lock lock_; 51 base::Lock lock_;
51 52
52 DISALLOW_COPY_AND_ASSIGN(WallClockTimeSource); 53 DISALLOW_COPY_AND_ASSIGN(WallClockTimeSource);
53 }; 54 };
54 55
55 } // namespace media 56 } // namespace media
56 57
57 #endif // MEDIA_BASE_WALL_CLOCK_TIME_SOURCE_H_ 58 #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