OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Timestamps are derived directly from the encoded media file and are commonly | 5 // Timestamps are derived directly from the encoded media file and are commonly |
6 // known as the presentation timestamp (PTS). Durations are a best-guess and | 6 // known as the presentation timestamp (PTS). Durations are a best-guess and |
7 // are usually derived from the sample/frame rate of the media file. | 7 // are usually derived from the sample/frame rate of the media file. |
8 // | 8 // |
9 // Due to encoding and transmission errors, it is not guaranteed that timestamps | 9 // Due to encoding and transmission errors, it is not guaranteed that timestamps |
10 // arrive in a monotonically increasing order nor that the next timestamp will | 10 // arrive in a monotonically increasing order nor that the next timestamp will |
11 // be equal to the previous timestamp plus the duration. | 11 // be equal to the previous timestamp plus the duration. |
12 // | 12 // |
13 // In the ideal scenario for a 25fps movie, buffers are timestamped as followed: | 13 // In the ideal scenario for a 25fps movie, buffers are timestamped as followed: |
14 // | 14 // |
15 // Buffer0 Buffer1 Buffer2 ... BufferN | 15 // Buffer0 Buffer1 Buffer2 ... BufferN |
16 // Timestamp: 0us 40000us 80000us ... (N*40000)us | 16 // Timestamp: 0us 40000us 80000us ... (N*40000)us |
17 // Duration*: 40000us 40000us 40000us ... 40000us | 17 // Duration*: 40000us 40000us 40000us ... 40000us |
18 // | 18 // |
19 // *25fps = 0.04s per frame = 40000us per frame | 19 // *25fps = 0.04s per frame = 40000us per frame |
20 | 20 |
21 #ifndef MEDIA_BASE_BUFFERS_H_ | 21 #ifndef MEDIA_BASE_BUFFERS_H_ |
22 #define MEDIA_BASE_BUFFERS_H_ | 22 #define MEDIA_BASE_BUFFERS_H_ |
23 | 23 |
24 #include "base/basictypes.h" | 24 #include "base/basictypes.h" |
25 #include "base/memory/ref_counted.h" | 25 #include "base/memory/ref_counted.h" |
26 #include "base/time.h" | 26 #include "base/time/time.h" |
27 #include "media/base/media_export.h" | 27 #include "media/base/media_export.h" |
28 | 28 |
29 namespace media { | 29 namespace media { |
30 | 30 |
31 // TODO(scherkus): Move the contents of this file elsewhere. | 31 // TODO(scherkus): Move the contents of this file elsewhere. |
32 | 32 |
33 // Indicates an invalid or missing timestamp. | 33 // Indicates an invalid or missing timestamp. |
34 MEDIA_EXPORT extern inline base::TimeDelta kNoTimestamp() { | 34 MEDIA_EXPORT extern inline base::TimeDelta kNoTimestamp() { |
35 return base::TimeDelta::FromMicroseconds(kint64min); | 35 return base::TimeDelta::FromMicroseconds(kint64min); |
36 } | 36 } |
37 | 37 |
38 // Represents an infinite stream duration. | 38 // Represents an infinite stream duration. |
39 MEDIA_EXPORT extern inline base::TimeDelta kInfiniteDuration() { | 39 MEDIA_EXPORT extern inline base::TimeDelta kInfiniteDuration() { |
40 return base::TimeDelta::FromMicroseconds(kint64max); | 40 return base::TimeDelta::FromMicroseconds(kint64max); |
41 } | 41 } |
42 | 42 |
43 } // namespace media | 43 } // namespace media |
44 | 44 |
45 #endif // MEDIA_BASE_BUFFERS_H_ | 45 #endif // MEDIA_BASE_BUFFERS_H_ |
OLD | NEW |