OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_PTS_STREAM_H_ | 5 #ifndef MEDIA_BASE_PTS_STREAM_H_ |
6 #define MEDIA_BASE_PTS_STREAM_H_ | 6 #define MEDIA_BASE_PTS_STREAM_H_ |
7 | 7 |
8 // Under some conditions the decoded frames can get invalid or wrong timestamps: | 8 // Under some conditions the decoded frames can get invalid or wrong timestamps: |
9 // - compressed frames are often in decode timestamp (dts) order, which | 9 // - compressed frames are often in decode timestamp (dts) order, which |
10 // may not always be in presentation timestamp (pts) order; | 10 // may not always be in presentation timestamp (pts) order; |
11 // - decoder may report invalid timestamps for the decoded frames; | 11 // - decoder may report invalid timestamps for the decoded frames; |
12 // - parser may report invalid timestamps for the compressed frames. | 12 // - parser may report invalid timestamps for the compressed frames. |
13 // | 13 // |
14 // To ensure that the decoded frames are displayed in the proper order, the | 14 // To ensure that the decoded frames are displayed in the proper order, the |
15 // PtsStream class assembles the time information from different sources and | 15 // PtsStream class assembles the time information from different sources and |
16 // combines it into the "best guess" timestamp and duration for the current | 16 // combines it into the "best guess" timestamp and duration for the current |
17 // frame. Data inside the decoded frame (if provided) is trusted the most, | 17 // frame. Data inside the decoded frame (if provided) is trusted the most, |
18 // followed by data from the packet stream. Estimation based on the last known | 18 // followed by data from the packet stream. Estimation based on the last known |
19 // PTS and frame rate is reserved as a last-ditch effort. | 19 // PTS and frame rate is reserved as a last-ditch effort. |
20 | 20 |
21 #include "base/time.h" | 21 #include "base/time.h" |
22 #include "media/base/pts_heap.h" | 22 #include "media/base/pts_heap.h" |
23 | 23 |
24 namespace media { | 24 namespace media { |
25 | 25 |
26 class StreamSample; | 26 class StreamSample; |
27 | 27 |
28 class MEDIA_EXPORT PtsStream { | 28 class PtsStream { |
29 public: | 29 public: |
30 PtsStream(); | 30 PtsStream(); |
31 ~PtsStream(); | 31 ~PtsStream(); |
32 | 32 |
33 // Initializes an instance using |frame_duration| as default. In absence of | 33 // Initializes an instance using |frame_duration| as default. In absence of |
34 // other PTS information PtsStream will produce timestamps separated in time | 34 // other PTS information PtsStream will produce timestamps separated in time |
35 // by this duration. | 35 // by this duration. |
36 void Initialize(const base::TimeDelta& frame_duration); | 36 void Initialize(const base::TimeDelta& frame_duration); |
37 | 37 |
38 // Sets the |current_pts_| to specified |timestamp| and flushes all enqueued | 38 // Sets the |current_pts_| to specified |timestamp| and flushes all enqueued |
(...skipping 22 matching lines...) Expand all Loading... |
61 | 61 |
62 base::TimeDelta current_pts_; | 62 base::TimeDelta current_pts_; |
63 base::TimeDelta current_duration_; | 63 base::TimeDelta current_duration_; |
64 | 64 |
65 DISALLOW_COPY_AND_ASSIGN(PtsStream); | 65 DISALLOW_COPY_AND_ASSIGN(PtsStream); |
66 }; | 66 }; |
67 | 67 |
68 } // namespace media | 68 } // namespace media |
69 | 69 |
70 #endif // MEDIA_BASE_PTS_STREAM_H_ | 70 #endif // MEDIA_BASE_PTS_STREAM_H_ |
OLD | NEW |