| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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" | |
| 35 | 34 |
| 36 namespace media { | 35 namespace media { |
| 37 | 36 |
| 38 class MEDIA_EXPORT PtsHeap { | 37 class PtsHeap { |
| 39 public: | 38 public: |
| 40 PtsHeap(); | 39 PtsHeap(); |
| 41 ~PtsHeap(); | 40 ~PtsHeap(); |
| 42 | 41 |
| 43 void Push(const base::TimeDelta& pts); | 42 void Push(const base::TimeDelta& pts); |
| 44 void Pop(); | 43 void Pop(); |
| 45 | 44 |
| 46 const base::TimeDelta& Top() const { return queue_.top(); } | 45 const base::TimeDelta& Top() const { return queue_.top(); } |
| 47 bool IsEmpty() const { return queue_.empty(); } | 46 bool IsEmpty() const { return queue_.empty(); } |
| 48 | 47 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 60 PtsHeapOrdering> TimeQueue; | 59 PtsHeapOrdering> TimeQueue; |
| 61 | 60 |
| 62 TimeQueue queue_; | 61 TimeQueue queue_; |
| 63 | 62 |
| 64 DISALLOW_COPY_AND_ASSIGN(PtsHeap); | 63 DISALLOW_COPY_AND_ASSIGN(PtsHeap); |
| 65 }; | 64 }; |
| 66 | 65 |
| 67 } // namespace media | 66 } // namespace media |
| 68 | 67 |
| 69 #endif // MEDIA_BASE_PTS_HEAP_H_ | 68 #endif // MEDIA_BASE_PTS_HEAP_H_ |
| OLD | NEW |