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 #include "media/base/decoder_buffer_queue.h" | 5 #include "media/base/decoder_buffer_queue.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/numerics/safe_conversions.h" | 8 #include "base/numerics/safe_conversions.h" |
9 #include "media/base/decoder_buffer.h" | 9 #include "media/base/decoder_buffer.h" |
10 #include "media/base/timestamp_constants.h" | 10 #include "media/base/timestamp_constants.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 return buffer; | 68 return buffer; |
69 } | 69 } |
70 | 70 |
71 void DecoderBufferQueue::Clear() { | 71 void DecoderBufferQueue::Clear() { |
72 queue_.clear(); | 72 queue_.clear(); |
73 data_size_ = 0; | 73 data_size_ = 0; |
74 in_order_queue_.clear(); | 74 in_order_queue_.clear(); |
75 earliest_valid_timestamp_ = kNoTimestamp(); | 75 earliest_valid_timestamp_ = kNoTimestamp(); |
76 } | 76 } |
77 | 77 |
78 bool DecoderBufferQueue::IsEmpty() { | 78 bool DecoderBufferQueue::IsEmpty() const { |
79 return queue_.empty(); | 79 return queue_.empty(); |
80 } | 80 } |
81 | 81 |
82 base::TimeDelta DecoderBufferQueue::Duration() { | 82 base::TimeDelta DecoderBufferQueue::Duration() { |
83 if (in_order_queue_.size() < 2) | 83 if (in_order_queue_.size() < 2) |
84 return base::TimeDelta(); | 84 return base::TimeDelta(); |
85 | 85 |
86 base::TimeDelta start = in_order_queue_.front()->timestamp(); | 86 base::TimeDelta start = in_order_queue_.front()->timestamp(); |
87 base::TimeDelta end = in_order_queue_.back()->timestamp(); | 87 base::TimeDelta end = in_order_queue_.back()->timestamp(); |
88 return end - start; | 88 return end - start; |
89 } | 89 } |
90 | 90 |
91 } // namespace media | 91 } // namespace media |
OLD | NEW |