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/stream_parser_buffer.h" | 5 #include "media/base/stream_parser_buffer.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace media { | 9 namespace media { |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 base::TimeDelta StreamParserBuffer::GetDecodeTimestamp() const { | 21 base::TimeDelta StreamParserBuffer::GetDecodeTimestamp() const { |
22 if (decode_timestamp_ == kNoTimestamp()) | 22 if (decode_timestamp_ == kNoTimestamp()) |
23 return GetTimestamp(); | 23 return GetTimestamp(); |
24 return decode_timestamp_; | 24 return decode_timestamp_; |
25 } | 25 } |
26 | 26 |
27 void StreamParserBuffer::SetDecodeTimestamp(const base::TimeDelta& timestamp) { | 27 void StreamParserBuffer::SetDecodeTimestamp(const base::TimeDelta& timestamp) { |
28 decode_timestamp_ = timestamp; | 28 decode_timestamp_ = timestamp; |
29 } | 29 } |
30 | 30 |
31 base::TimeDelta StreamParserBuffer::GetEndTimestamp() const { | |
32 DCHECK(GetDecodeTimestamp() != kNoTimestamp()); | |
33 DCHECK(GetDuration() != kNoTimestamp()); | |
34 return GetDecodeTimestamp() + GetDuration(); | |
35 } | |
36 | |
37 StreamParserBuffer::StreamParserBuffer(const uint8* data, int data_size, | 31 StreamParserBuffer::StreamParserBuffer(const uint8* data, int data_size, |
38 bool is_keyframe) | 32 bool is_keyframe) |
39 : DecoderBuffer(data, data_size), | 33 : DecoderBuffer(data, data_size), |
40 is_keyframe_(is_keyframe), | 34 is_keyframe_(is_keyframe), |
41 decode_timestamp_(kNoTimestamp()) { | 35 decode_timestamp_(kNoTimestamp()) { |
42 SetDuration(kNoTimestamp()); | 36 SetDuration(kNoTimestamp()); |
43 } | 37 } |
44 | 38 |
45 | |
46 StreamParserBuffer::~StreamParserBuffer() { | 39 StreamParserBuffer::~StreamParserBuffer() { |
47 } | 40 } |
48 | 41 |
49 } // namespace media | 42 } // namespace media |
OLD | NEW |