| Index: media/base/time_source.h
|
| diff --git a/media/base/time_source.h b/media/base/time_source.h
|
| index d025de2a6ccb53cdebee6b1f71dd78eab6b11c50..d0607686dbaab4e294530b954a6901fe28b41d03 100644
|
| --- a/media/base/time_source.h
|
| +++ b/media/base/time_source.h
|
| @@ -5,6 +5,9 @@
|
| #ifndef MEDIA_BASE_TIME_SOURCE_H_
|
| #define MEDIA_BASE_TIME_SOURCE_H_
|
|
|
| +#include <vector>
|
| +
|
| +#include "base/callback.h"
|
| #include "base/time/time.h"
|
| #include "media/base/media_export.h"
|
|
|
| @@ -13,6 +16,11 @@ namespace media {
|
| // A TimeSource is capable of providing the current media time.
|
| class MEDIA_EXPORT TimeSource {
|
| public:
|
| + // Helper alias for converting media timestamps into a wall clock timestamps.
|
| + using WallClockTimeCB =
|
| + base::Callback<bool(const std::vector<base::TimeDelta>&,
|
| + std::vector<base::TimeTicks>*)>;
|
| +
|
| TimeSource() {}
|
| virtual ~TimeSource() {}
|
|
|
| @@ -26,7 +34,7 @@ class MEDIA_EXPORT TimeSource {
|
|
|
| // Updates the current playback rate. It is expected that values from
|
| // CurrentMediaTime() will eventually reflect the new playback rate (e.g., the
|
| - // media time will advance at half speed if the rate was set to 0.5f).
|
| + // media time will advance at half speed if the rate was set to 0.5).
|
| virtual void SetPlaybackRate(double playback_rate) = 0;
|
|
|
| // Sets the media time to start ticking from. Only valid to call while the
|
| @@ -41,16 +49,27 @@ class MEDIA_EXPORT TimeSource {
|
| // will never go backwards, the frequency at which they update may be low.
|
| virtual base::TimeDelta CurrentMediaTime() = 0;
|
|
|
| - // Converts a media timestamp into a wall clock time. If the media time is
|
| - // stopped, returns a null TimeTicks.
|
| + // Converts a vector of media timestamps into a vector of wall clock times. If
|
| + // the media time is stopped, returns false and does not modify the output
|
| + // vector. Returns true and converts all timestamps otherwise. Guarantees that
|
| + // wall clock time does not go backwards for monotonically increasing media
|
| + // timestamps.
|
| + //
|
| + // Each timestamp converted from |media_timestamps| will be pushed into
|
| + // |wall_clock_times| such that after all timestamps are converted, the two
|
| + // vectors are parallel (media_timestamps[i] -> wall_clock_times[i]).
|
| //
|
| - // |media_time| values too far ahead of the current media time will return an
|
| - // estimated value; as such, these values may go backwards in time slightly.
|
| + // |media_timestamps| values too far ahead of the current media time will
|
| + // be converted to an estimated value; as such, these values may go backwards
|
| + // in time slightly between calls to GetWallClockTimes().
|
| //
|
| - // |media_time| values behind the current media time may be significantly
|
| - // incorrect if the playback rate has changed recently. The only guarantee is
|
| - // that the returned time will be less than the current wall clock time.
|
| - virtual base::TimeTicks GetWallClockTime(base::TimeDelta media_time) = 0;
|
| + // |media_timestamps| values behind the current media time may be
|
| + // significantly incorrect if the playback rate has changed recently. The only
|
| + // guarantee is that the returned time will be less than the current wall
|
| + // clock time.
|
| + virtual bool GetWallClockTimes(
|
| + const std::vector<base::TimeDelta>& media_timestamps,
|
| + std::vector<base::TimeTicks>* wall_clock_times) = 0;
|
| };
|
|
|
| } // namespace media
|
|
|