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 #ifndef MEDIA_BASE_DECODER_BUFFER_QUEUE_H_ | 5 #ifndef MEDIA_BASE_DECODER_BUFFER_QUEUE_H_ |
6 #define MEDIA_BASE_DECODER_BUFFER_QUEUE_H_ | 6 #define MEDIA_BASE_DECODER_BUFFER_QUEUE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 // Returns true if this queue is empty. | 44 // Returns true if this queue is empty. |
45 bool IsEmpty(); | 45 bool IsEmpty(); |
46 | 46 |
47 // Returns the duration of encoded data stored in this queue as measured by | 47 // Returns the duration of encoded data stored in this queue as measured by |
48 // the timestamps of the earliest and latest buffers, ignoring out of order | 48 // the timestamps of the earliest and latest buffers, ignoring out of order |
49 // buffers. | 49 // buffers. |
50 // | 50 // |
51 // Returns zero if the queue is empty. | 51 // Returns zero if the queue is empty. |
52 base::TimeDelta Duration(); | 52 base::TimeDelta Duration(); |
53 | 53 |
54 // Returns the total size of buffers inside the queue. | |
55 int data_size() const { return data_size_; } | |
DaleCurtis
2014/02/19 18:59:25
I'd just make this a size_t to minimize the CHECKs
damienv1
2014/02/19 19:21:10
I agree that size_t should have been used in a fir
| |
56 | |
54 private: | 57 private: |
55 typedef std::deque<scoped_refptr<DecoderBuffer> > Queue; | 58 typedef std::deque<scoped_refptr<DecoderBuffer> > Queue; |
56 Queue queue_; | 59 Queue queue_; |
57 | 60 |
58 // A subset of |queue_| that contains buffers that are in strictly | 61 // A subset of |queue_| that contains buffers that are in strictly |
59 // increasing timestamp order. Used to calculate Duration() while ignoring | 62 // increasing timestamp order. Used to calculate Duration() while ignoring |
60 // out-of-order buffers. | 63 // out-of-order buffers. |
61 Queue in_order_queue_; | 64 Queue in_order_queue_; |
62 | 65 |
63 base::TimeDelta earliest_valid_timestamp_; | 66 base::TimeDelta earliest_valid_timestamp_; |
64 | 67 |
68 // Total size in bytes of buffers in the queue. | |
69 int data_size_; | |
70 | |
65 DISALLOW_COPY_AND_ASSIGN(DecoderBufferQueue); | 71 DISALLOW_COPY_AND_ASSIGN(DecoderBufferQueue); |
66 }; | 72 }; |
67 | 73 |
68 } // namespace media | 74 } // namespace media |
69 | 75 |
70 #endif // MEDIA_BASE_DECODER_BUFFER_QUEUE_H_ | 76 #endif // MEDIA_BASE_DECODER_BUFFER_QUEUE_H_ |
OLD | NEW |