OLD | NEW |
1 // Copyright (c) 2010 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_HEAP_H_ | 5 #ifndef MEDIA_BASE_PTS_HEAP_H_ |
6 #define MEDIA_BASE_PTS_HEAP_H_ | 6 #define MEDIA_BASE_PTS_HEAP_H_ |
7 | 7 |
8 // The compressed frame are often in decode timestamp (dts) order, which | 8 // The compressed frame are often in decode timestamp (dts) order, which |
9 // may not always be in presentation timestamp (pts) order. However, the | 9 // may not always be in presentation timestamp (pts) order. However, the |
10 // decoded frames will always be returned in pts order. Ideally, the pts could | 10 // decoded frames will always be returned in pts order. Ideally, the pts could |
11 // be attached as metadata to each comprsesed frame, and the decoder would | 11 // be attached as metadata to each comprsesed frame, and the decoder would |
(...skipping 12 matching lines...) Expand all Loading... |
24 // 5 6 4 <-' incorrect, which is why we sort and | 24 // 5 6 4 <-' incorrect, which is why we sort and |
25 // 6 5 5 queue incoming timestamps | 25 // 6 5 5 queue incoming timestamps |
26 // | 26 // |
27 // The PtsHeap expects that for every Pop(), there was a corresponding Push(). | 27 // The PtsHeap expects that for every Pop(), there was a corresponding Push(). |
28 // It will CHECK fail otherwise. | 28 // It will CHECK fail otherwise. |
29 | 29 |
30 #include <queue> | 30 #include <queue> |
31 #include <vector> | 31 #include <vector> |
32 | 32 |
33 #include "base/time.h" | 33 #include "base/time.h" |
| 34 #include "media/base/media_export.h" |
34 | 35 |
35 namespace media { | 36 namespace media { |
36 | 37 |
37 class PtsHeap { | 38 class MEDIA_EXPORT PtsHeap { |
38 public: | 39 public: |
39 PtsHeap(); | 40 PtsHeap(); |
40 ~PtsHeap(); | 41 ~PtsHeap(); |
41 | 42 |
42 void Push(const base::TimeDelta& pts); | 43 void Push(const base::TimeDelta& pts); |
43 void Pop(); | 44 void Pop(); |
44 | 45 |
45 const base::TimeDelta& Top() const { return queue_.top(); } | 46 const base::TimeDelta& Top() const { return queue_.top(); } |
46 bool IsEmpty() const { return queue_.empty(); } | 47 bool IsEmpty() const { return queue_.empty(); } |
47 | 48 |
(...skipping 11 matching lines...) Expand all Loading... |
59 PtsHeapOrdering> TimeQueue; | 60 PtsHeapOrdering> TimeQueue; |
60 | 61 |
61 TimeQueue queue_; | 62 TimeQueue queue_; |
62 | 63 |
63 DISALLOW_COPY_AND_ASSIGN(PtsHeap); | 64 DISALLOW_COPY_AND_ASSIGN(PtsHeap); |
64 }; | 65 }; |
65 | 66 |
66 } // namespace media | 67 } // namespace media |
67 | 68 |
68 #endif // MEDIA_BASE_PTS_HEAP_H_ | 69 #endif // MEDIA_BASE_PTS_HEAP_H_ |
OLD | NEW |