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 #include "media/base/buffers.h" | 8 #include "media/base/buffers.h" |
9 | 9 |
10 namespace media { | 10 namespace media { |
(...skipping 11 matching lines...) Expand all Loading... |
22 scoped_refptr<StreamParserBuffer> StreamParserBuffer::CopyFrom( | 22 scoped_refptr<StreamParserBuffer> StreamParserBuffer::CopyFrom( |
23 const uint8* data, int data_size, | 23 const uint8* data, int data_size, |
24 const uint8* side_data, int side_data_size, bool is_keyframe) { | 24 const uint8* side_data, int side_data_size, bool is_keyframe) { |
25 return make_scoped_refptr( | 25 return make_scoped_refptr( |
26 new StreamParserBuffer(data, data_size, side_data, side_data_size, | 26 new StreamParserBuffer(data, data_size, side_data, side_data_size, |
27 is_keyframe)); | 27 is_keyframe)); |
28 } | 28 } |
29 | 29 |
30 base::TimeDelta StreamParserBuffer::GetDecodeTimestamp() const { | 30 base::TimeDelta StreamParserBuffer::GetDecodeTimestamp() const { |
31 if (decode_timestamp_ == kNoTimestamp()) | 31 if (decode_timestamp_ == kNoTimestamp()) |
32 return GetTimestamp(); | 32 return timestamp(); |
33 return decode_timestamp_; | 33 return decode_timestamp_; |
34 } | 34 } |
35 | 35 |
36 void StreamParserBuffer::SetDecodeTimestamp(const base::TimeDelta& timestamp) { | 36 void StreamParserBuffer::SetDecodeTimestamp(const base::TimeDelta& timestamp) { |
37 decode_timestamp_ = timestamp; | 37 decode_timestamp_ = timestamp; |
38 } | 38 } |
39 | 39 |
40 StreamParserBuffer::StreamParserBuffer(const uint8* data, int data_size, | 40 StreamParserBuffer::StreamParserBuffer(const uint8* data, int data_size, |
41 const uint8* side_data, | 41 const uint8* side_data, |
42 int side_data_size, bool is_keyframe) | 42 int side_data_size, bool is_keyframe) |
43 : DecoderBuffer(data, data_size, side_data, side_data_size), | 43 : DecoderBuffer(data, data_size, side_data, side_data_size), |
44 is_keyframe_(is_keyframe), | 44 is_keyframe_(is_keyframe), |
45 decode_timestamp_(kNoTimestamp()), | 45 decode_timestamp_(kNoTimestamp()), |
46 config_id_(kInvalidConfigId) { | 46 config_id_(kInvalidConfigId) { |
47 // TODO(scherkus): Should DataBuffer constructor accept a timestamp and | 47 // TODO(scherkus): Should DataBuffer constructor accept a timestamp and |
48 // duration to force clients to set them? Today they end up being zero which | 48 // duration to force clients to set them? Today they end up being zero which |
49 // is both a common and valid value and could lead to bugs. | 49 // is both a common and valid value and could lead to bugs. |
50 if (data) { | 50 if (data) { |
51 SetDuration(kNoTimestamp()); | 51 set_duration(kNoTimestamp()); |
52 } | 52 } |
53 } | 53 } |
54 | 54 |
55 StreamParserBuffer::~StreamParserBuffer() { | 55 StreamParserBuffer::~StreamParserBuffer() { |
56 } | 56 } |
57 | 57 |
58 int StreamParserBuffer::GetConfigId() const { | 58 int StreamParserBuffer::GetConfigId() const { |
59 return config_id_; | 59 return config_id_; |
60 } | 60 } |
61 | 61 |
62 void StreamParserBuffer::SetConfigId(int config_id) { | 62 void StreamParserBuffer::SetConfigId(int config_id) { |
63 config_id_ = config_id; | 63 config_id_ = config_id; |
64 } | 64 } |
65 | 65 |
66 } // namespace media | 66 } // namespace media |
OLD | NEW |