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.h" | 5 #include "media/base/decoder_buffer.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "media/base/decrypt_config.h" | 8 #include "media/base/decrypt_config.h" |
9 | 9 |
10 namespace media { | 10 namespace media { |
(...skipping 15 matching lines...) Expand all Loading... | |
26 Initialize(); | 26 Initialize(); |
27 memcpy(data_.get(), data, size_); | 27 memcpy(data_.get(), data, size_); |
28 } | 28 } |
29 | 29 |
30 DecoderBuffer::DecoderBuffer(const uint8* data, int size, | 30 DecoderBuffer::DecoderBuffer(const uint8* data, int size, |
31 const uint8* side_data, int side_data_size) | 31 const uint8* side_data, int side_data_size) |
32 : size_(size), | 32 : size_(size), |
33 side_data_size_(side_data_size) { | 33 side_data_size_(side_data_size) { |
34 if (!data) { | 34 if (!data) { |
35 CHECK_EQ(size_, 0); | 35 CHECK_EQ(size_, 0); |
36 CHECK(!side_data); | |
36 return; | 37 return; |
37 } | 38 } |
38 | 39 |
39 Initialize(); | 40 Initialize(); |
40 memcpy(data_.get(), data, size_); | 41 memcpy(data_.get(), data, size_); |
41 memcpy(side_data_.get(), side_data, side_data_size_); | 42 if (side_data_size_ > 0) |
acolwell GONE FROM CHROMIUM
2013/05/21 19:47:48
nit: Per offline discussion. s/side_data_size_/sid
vignesh
2013/05/21 21:05:21
Done.
| |
43 memcpy(side_data_.get(), side_data, side_data_size_); | |
42 } | 44 } |
43 | 45 |
44 DecoderBuffer::~DecoderBuffer() {} | 46 DecoderBuffer::~DecoderBuffer() {} |
45 | 47 |
46 void DecoderBuffer::Initialize() { | 48 void DecoderBuffer::Initialize() { |
47 CHECK_GE(size_, 0); | 49 CHECK_GE(size_, 0); |
48 data_.reset(reinterpret_cast<uint8*>( | 50 data_.reset(reinterpret_cast<uint8*>( |
49 base::AlignedAlloc(size_ + kPaddingSize, kAlignmentSize))); | 51 base::AlignedAlloc(size_ + kPaddingSize, kAlignmentSize))); |
50 memset(data_.get() + size_, 0, kPaddingSize); | 52 memset(data_.get() + size_, 0, kPaddingSize); |
51 if (side_data_size_ > 0) { | 53 if (side_data_size_ > 0) { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
147 std::ostringstream s; | 149 std::ostringstream s; |
148 s << "timestamp: " << timestamp_.InMicroseconds() | 150 s << "timestamp: " << timestamp_.InMicroseconds() |
149 << " duration: " << duration_.InMicroseconds() | 151 << " duration: " << duration_.InMicroseconds() |
150 << " size: " << size_ | 152 << " size: " << size_ |
151 << " side_data_size: " << side_data_size_ | 153 << " side_data_size: " << side_data_size_ |
152 << " encrypted: " << (decrypt_config_ != NULL); | 154 << " encrypted: " << (decrypt_config_ != NULL); |
153 return s.str(); | 155 return s.str(); |
154 } | 156 } |
155 | 157 |
156 } // namespace media | 158 } // namespace media |
OLD | NEW |