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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // Returns the current media timestamp relative to the timestamp set by | 44 // Returns the current media timestamp relative to the timestamp set by |
45 // SetMediaTime(). | 45 // SetMediaTime(). |
46 // | 46 // |
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 and does not modify the output | 53 // the media time is stopped, returns false and does not modify the output |
54 // vector. Returns true and converts all timestamps otherwise. Guarantees that | 54 // vector. Returns true and converts all timestamps otherwise. |
55 // wall clock time does not go backwards for monotonically increasing media | 55 // |
56 // timestamps. | 56 // Within a single call to GetWallClockTimes() the returned wall clock times |
| 57 // are a strictly increasing function of the given media times. There is no |
| 58 // such guarantee between calls though; e.g., playback rate or audio delay may |
| 59 // change on other threads within the pipeline. |
57 // | 60 // |
58 // Each timestamp converted from |media_timestamps| will be pushed into | 61 // Each timestamp converted from |media_timestamps| will be pushed into |
59 // |wall_clock_times| such that after all timestamps are converted, the two | 62 // |wall_clock_times| such that after all timestamps are converted, the two |
60 // vectors are parallel (media_timestamps[i] -> wall_clock_times[i]). | 63 // vectors are parallel (media_timestamps[i] -> wall_clock_times[i]). |
61 // | 64 // |
62 // |media_timestamps| values too far ahead of the current media time will | 65 // |media_timestamps| values too far ahead of the current media time will |
63 // be converted to an estimated value; as such, these values may go backwards | 66 // be converted to an estimated value; as such, these values may go backwards |
64 // in time slightly between calls to GetWallClockTimes(). | 67 // in time slightly between calls to GetWallClockTimes(). |
65 // | 68 // |
66 // |media_timestamps| values behind the current media time may be | 69 // |media_timestamps| values behind the current media time may be |
67 // significantly incorrect if the playback rate has changed recently. The only | 70 // significantly incorrect if the playback rate has changed recently. The only |
68 // guarantee is that the returned time will be less than the current wall | 71 // guarantee is that the returned time will be less than the current wall |
69 // clock time. | 72 // clock time. |
70 virtual bool GetWallClockTimes( | 73 virtual bool GetWallClockTimes( |
71 const std::vector<base::TimeDelta>& media_timestamps, | 74 const std::vector<base::TimeDelta>& media_timestamps, |
72 std::vector<base::TimeTicks>* wall_clock_times) = 0; | 75 std::vector<base::TimeTicks>* wall_clock_times) = 0; |
73 }; | 76 }; |
74 | 77 |
75 } // namespace media | 78 } // namespace media |
76 | 79 |
77 #endif // MEDIA_BASE_TIME_SOURCE_H_ | 80 #endif // MEDIA_BASE_TIME_SOURCE_H_ |
OLD | NEW |