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 return; | 36 return; |
acolwell GONE FROM CHROMIUM
2013/05/21 17:14:11
Should there be a CHECK(!side_data) here? I'm assu
vignesh
2013/05/21 18:57:56
Done.
| |
37 } | 37 } |
38 | 38 |
39 Initialize(); | 39 Initialize(); |
40 memcpy(data_.get(), data, size_); | 40 memcpy(data_.get(), data, size_); |
41 memcpy(side_data_.get(), side_data, side_data_size_); | 41 if (side_data_size > 0) |
fgalligan1
2013/05/21 00:02:43
nit: Check side_data_size_
vignesh
2013/05/21 18:57:56
Done.
| |
42 memcpy(side_data_.get(), side_data, side_data_size_); | |
acolwell GONE FROM CHROMIUM
2013/05/21 17:14:11
Why is this change needed? Are you seeing negative
vignesh
2013/05/21 18:57:56
I made this change because i replaced the private
| |
42 } | 43 } |
43 | 44 |
44 DecoderBuffer::~DecoderBuffer() {} | 45 DecoderBuffer::~DecoderBuffer() {} |
45 | 46 |
46 void DecoderBuffer::Initialize() { | 47 void DecoderBuffer::Initialize() { |
47 CHECK_GE(size_, 0); | 48 CHECK_GE(size_, 0); |
48 data_.reset(reinterpret_cast<uint8*>( | 49 data_.reset(reinterpret_cast<uint8*>( |
49 base::AlignedAlloc(size_ + kPaddingSize, kAlignmentSize))); | 50 base::AlignedAlloc(size_ + kPaddingSize, kAlignmentSize))); |
50 memset(data_.get() + size_, 0, kPaddingSize); | 51 memset(data_.get() + size_, 0, kPaddingSize); |
51 if (side_data_size_ > 0) { | 52 if (side_data_size_ > 0) { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
147 std::ostringstream s; | 148 std::ostringstream s; |
148 s << "timestamp: " << timestamp_.InMicroseconds() | 149 s << "timestamp: " << timestamp_.InMicroseconds() |
149 << " duration: " << duration_.InMicroseconds() | 150 << " duration: " << duration_.InMicroseconds() |
150 << " size: " << size_ | 151 << " size: " << size_ |
151 << " side_data_size: " << side_data_size_ | 152 << " side_data_size: " << side_data_size_ |
152 << " encrypted: " << (decrypt_config_ != NULL); | 153 << " encrypted: " << (decrypt_config_ != NULL); |
153 return s.str(); | 154 return s.str(); |
154 } | 155 } |
155 | 156 |
156 } // namespace media | 157 } // namespace media |
OLD | NEW |