Index: media/base/clock.h |
diff --git a/media/base/clock.h b/media/base/clock.h |
index 267666f668aeefc63682b7dcd4fc0e24ec7d2d14..6a86106c17781a38733f9c6585b67276909582c6 100644 |
--- a/media/base/clock.h |
+++ b/media/base/clock.h |
@@ -10,16 +10,16 @@ |
#include "media/base/media_export.h" |
namespace base { |
-class Clock; |
+class TickClock; |
} // namespace base |
namespace media { |
// A clock represents a single source of time to allow audio and video streams |
// to synchronize with each other. Clock essentially tracks the media time with |
-// respect to some other source of time, whether that may be the system clock or |
-// updates via SetTime(). Clock uses linear interpolation to calculate the |
-// current media time since the last time SetTime() was called. |
+// respect to some other source of time, whether that may be the monotonic |
+// system clock or updates via SetTime(). Clock uses linear interpolation to |
+// calculate the current media time since the last time SetTime() was called. |
// |
// Clocks start off paused with a playback rate of 1.0f and a media time of 0. |
// |
@@ -28,9 +28,12 @@ namespace media { |
// TODO(scherkus): Clock will some day be responsible for executing callbacks |
// given a media time. This will be used primarily by video renderers. For now |
// we'll keep using a poll-and-sleep solution. |
+// |
+// TODO(miu): Rename media::Clock to avoid confusion (and tripping up the media |
+// PRESUBMIT script on future changes). |
class MEDIA_EXPORT Clock { |
public: |
- explicit Clock(base::Clock* clock); |
+ explicit Clock(base::TickClock* clock); |
~Clock(); |
// Returns true if the clock is running. |
@@ -88,13 +91,13 @@ class MEDIA_EXPORT Clock { |
// the |max_time_| cap. |
base::TimeDelta EstimatedElapsedTime(); |
- // Returns the current media time treating the given time as the latest |
- // value as returned by |time_provider_|. |
- base::TimeDelta ElapsedViaProvidedTime(const base::Time& time) const; |
+ // Translates |time| into the current media time, based on the perspective of |
+ // the monotonically-increasing system clock. |
+ base::TimeDelta ElapsedViaProvidedTime(const base::TimeTicks& time) const; |
base::TimeDelta ClampToValidTimeRange(base::TimeDelta time) const; |
- base::Clock* const clock_; |
+ base::TickClock* const clock_; |
// Whether the clock is running. |
bool playing_; |
@@ -103,9 +106,9 @@ class MEDIA_EXPORT Clock { |
// allowed. |
bool underflow_; |
- // The system clock time when this clock last starting playing or had its |
- // time set via SetTime(). |
- base::Time reference_; |
+ // The monotonic system clock time when this Clock last started playing or had |
+ // its time set via SetTime(). |
+ base::TimeTicks reference_; |
// Current accumulated amount of media time. The remaining portion must be |
// calculated by comparing the system time to the reference time. |