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/timestamp_constants.h" | 8 #include "media/base/timestamp_constants.h" |
9 | 9 |
10 namespace media { | 10 namespace media { |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 return copied_buffer; | 40 return copied_buffer; |
41 } | 41 } |
42 | 42 |
43 scoped_refptr<StreamParserBuffer> StreamParserBuffer::CreateEOSBuffer() { | 43 scoped_refptr<StreamParserBuffer> StreamParserBuffer::CreateEOSBuffer() { |
44 return make_scoped_refptr(new StreamParserBuffer(NULL, 0, NULL, 0, false, | 44 return make_scoped_refptr(new StreamParserBuffer(NULL, 0, NULL, 0, false, |
45 DemuxerStream::UNKNOWN, 0)); | 45 DemuxerStream::UNKNOWN, 0)); |
46 } | 46 } |
47 | 47 |
48 scoped_refptr<StreamParserBuffer> StreamParserBuffer::CopyFrom( | 48 scoped_refptr<StreamParserBuffer> StreamParserBuffer::CopyFrom( |
49 const uint8* data, int data_size, bool is_key_frame, Type type, | 49 const uint8_t* data, |
| 50 int data_size, |
| 51 bool is_key_frame, |
| 52 Type type, |
50 TrackId track_id) { | 53 TrackId track_id) { |
51 return make_scoped_refptr( | 54 return make_scoped_refptr( |
52 new StreamParserBuffer(data, data_size, NULL, 0, is_key_frame, type, | 55 new StreamParserBuffer(data, data_size, NULL, 0, is_key_frame, type, |
53 track_id)); | 56 track_id)); |
54 } | 57 } |
55 | 58 |
56 scoped_refptr<StreamParserBuffer> StreamParserBuffer::CopyFrom( | 59 scoped_refptr<StreamParserBuffer> StreamParserBuffer::CopyFrom( |
57 const uint8* data, int data_size, | 60 const uint8_t* data, |
58 const uint8* side_data, int side_data_size, | 61 int data_size, |
59 bool is_key_frame, Type type, TrackId track_id) { | 62 const uint8_t* side_data, |
| 63 int side_data_size, |
| 64 bool is_key_frame, |
| 65 Type type, |
| 66 TrackId track_id) { |
60 return make_scoped_refptr( | 67 return make_scoped_refptr( |
61 new StreamParserBuffer(data, data_size, side_data, side_data_size, | 68 new StreamParserBuffer(data, data_size, side_data, side_data_size, |
62 is_key_frame, type, track_id)); | 69 is_key_frame, type, track_id)); |
63 } | 70 } |
64 | 71 |
65 DecodeTimestamp StreamParserBuffer::GetDecodeTimestamp() const { | 72 DecodeTimestamp StreamParserBuffer::GetDecodeTimestamp() const { |
66 if (decode_timestamp_ == kNoDecodeTimestamp()) | 73 if (decode_timestamp_ == kNoDecodeTimestamp()) |
67 return DecodeTimestamp::FromPresentationTime(timestamp()); | 74 return DecodeTimestamp::FromPresentationTime(timestamp()); |
68 return decode_timestamp_; | 75 return decode_timestamp_; |
69 } | 76 } |
70 | 77 |
71 void StreamParserBuffer::SetDecodeTimestamp(DecodeTimestamp timestamp) { | 78 void StreamParserBuffer::SetDecodeTimestamp(DecodeTimestamp timestamp) { |
72 decode_timestamp_ = timestamp; | 79 decode_timestamp_ = timestamp; |
73 if (preroll_buffer_.get()) | 80 if (preroll_buffer_.get()) |
74 preroll_buffer_->SetDecodeTimestamp(timestamp); | 81 preroll_buffer_->SetDecodeTimestamp(timestamp); |
75 } | 82 } |
76 | 83 |
77 StreamParserBuffer::StreamParserBuffer(const uint8* data, | 84 StreamParserBuffer::StreamParserBuffer(const uint8_t* data, |
78 int data_size, | 85 int data_size, |
79 const uint8* side_data, | 86 const uint8_t* side_data, |
80 int side_data_size, | 87 int side_data_size, |
81 bool is_key_frame, | 88 bool is_key_frame, |
82 Type type, | 89 Type type, |
83 TrackId track_id) | 90 TrackId track_id) |
84 : DecoderBuffer(data, data_size, side_data, side_data_size), | 91 : DecoderBuffer(data, data_size, side_data, side_data_size), |
85 decode_timestamp_(kNoDecodeTimestamp()), | 92 decode_timestamp_(kNoDecodeTimestamp()), |
86 config_id_(kInvalidConfigId), | 93 config_id_(kInvalidConfigId), |
87 type_(type), | 94 type_(type), |
88 track_id_(track_id), | 95 track_id_(track_id), |
89 is_duration_estimated_(false) { | 96 is_duration_estimated_(false) { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 std::make_pair(kInfiniteDuration(), base::TimeDelta())); | 233 std::make_pair(kInfiniteDuration(), base::TimeDelta())); |
227 } | 234 } |
228 | 235 |
229 void StreamParserBuffer::set_timestamp(base::TimeDelta timestamp) { | 236 void StreamParserBuffer::set_timestamp(base::TimeDelta timestamp) { |
230 DecoderBuffer::set_timestamp(timestamp); | 237 DecoderBuffer::set_timestamp(timestamp); |
231 if (preroll_buffer_.get()) | 238 if (preroll_buffer_.get()) |
232 preroll_buffer_->set_timestamp(timestamp); | 239 preroll_buffer_->set_timestamp(timestamp); |
233 } | 240 } |
234 | 241 |
235 } // namespace media | 242 } // namespace media |
OLD | NEW |