OLD | NEW |
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_TIME_SOURCE_H_ | 5 #ifndef MEDIA_BASE_TIME_SOURCE_H_ |
6 #define MEDIA_BASE_TIME_SOURCE_H_ | 6 #define MEDIA_BASE_TIME_SOURCE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // Values returned are intended for informational purposes, such as displaying | 47 // Values returned are intended for informational purposes, such as displaying |
48 // UI with the current minute and second count. While it is guaranteed values | 48 // UI with the current minute and second count. While it is guaranteed values |
49 // will never go backwards, the frequency at which they update may be low. | 49 // will never go backwards, the frequency at which they update may be low. |
50 virtual base::TimeDelta CurrentMediaTime() = 0; | 50 virtual base::TimeDelta CurrentMediaTime() = 0; |
51 | 51 |
52 // Converts a vector of media timestamps into a vector of wall clock times; if | 52 // Converts a vector of media timestamps into a vector of wall clock times; if |
53 // the media time is stopped, returns false, otherwise returns true. Even if | 53 // the media time is stopped, returns false, otherwise returns true. Even if |
54 // time is stopped, timestamps will be converted. | 54 // time is stopped, timestamps will be converted. |
55 // | 55 // |
56 // Passing an empty |media_timestamps| vector will return the last known media | 56 // Passing an empty |media_timestamps| vector will return the last known media |
57 // time as a wall clock time. | 57 // time as a wall clock time. After SetMediaTime() and prior to StartTicking() |
| 58 // the returned wall clock time must be zero. |
58 // | 59 // |
59 // Within a single call to GetWallClockTimes() the returned wall clock times | 60 // Within a single call to GetWallClockTimes() the returned wall clock times |
60 // are a strictly increasing function of the given media times. There is no | 61 // are a strictly increasing function of the given media times. There is no |
61 // such guarantee between calls though; e.g., playback rate or audio delay may | 62 // such guarantee between calls though; e.g., playback rate or audio delay may |
62 // change on other threads within the pipeline. | 63 // change on other threads within the pipeline. |
63 // | 64 // |
64 // Each timestamp converted from |media_timestamps| will be pushed into | 65 // Each timestamp converted from |media_timestamps| will be pushed into |
65 // |wall_clock_times| such that after all timestamps are converted, the two | 66 // |wall_clock_times| such that after all timestamps are converted, the two |
66 // vectors are parallel (media_timestamps[i] -> wall_clock_times[i]). | 67 // vectors are parallel (media_timestamps[i] -> wall_clock_times[i]). |
67 // | 68 // |
68 // |media_timestamps| values too far ahead of the current media time will | 69 // |media_timestamps| values too far ahead of the current media time will |
69 // be converted to an estimated value; as such, these values may go backwards | 70 // be converted to an estimated value; as such, these values may go backwards |
70 // in time slightly between calls to GetWallClockTimes(). | 71 // in time slightly between calls to GetWallClockTimes(). |
71 // | 72 // |
72 // |media_timestamps| values behind the current media time may be | 73 // |media_timestamps| values behind the current media time may be |
73 // significantly incorrect if the playback rate has changed recently. The only | 74 // significantly incorrect if the playback rate has changed recently. The only |
74 // guarantee is that the returned time will be less than the current wall | 75 // guarantee is that the returned time will be less than the current wall |
75 // clock time. | 76 // clock time. |
76 virtual bool GetWallClockTimes( | 77 virtual bool GetWallClockTimes( |
77 const std::vector<base::TimeDelta>& media_timestamps, | 78 const std::vector<base::TimeDelta>& media_timestamps, |
78 std::vector<base::TimeTicks>* wall_clock_times) = 0; | 79 std::vector<base::TimeTicks>* wall_clock_times) = 0; |
79 }; | 80 }; |
80 | 81 |
81 } // namespace media | 82 } // namespace media |
82 | 83 |
83 #endif // MEDIA_BASE_TIME_SOURCE_H_ | 84 #endif // MEDIA_BASE_TIME_SOURCE_H_ |
OLD | NEW |