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" | |
8 #include "media/base/buffers.h" | |
9 #include "media/base/decrypt_config.h" | |
10 | 7 |
11 namespace media { | 8 namespace media { |
12 | 9 |
13 // Allocates a block of memory which is padded for use with the SIMD | 10 // Allocates a block of memory which is padded for use with the SIMD |
14 // optimizations used by FFmpeg. | 11 // optimizations used by FFmpeg. |
15 static uint8* AllocateFFmpegSafeBlock(int size) { | 12 static uint8* AllocateFFmpegSafeBlock(int size) { |
16 uint8* const block = reinterpret_cast<uint8*>(base::AlignedAlloc( | 13 uint8* const block = reinterpret_cast<uint8*>(base::AlignedAlloc( |
17 size + DecoderBuffer::kPaddingSize, DecoderBuffer::kAlignmentSize)); | 14 size + DecoderBuffer::kPaddingSize, DecoderBuffer::kAlignmentSize)); |
18 memset(block + size, 0, DecoderBuffer::kPaddingSize); | 15 memset(block + size, 0, DecoderBuffer::kPaddingSize); |
19 return block; | 16 return block; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 side_data_size_ = side_data_size; | 113 side_data_size_ = side_data_size; |
117 side_data_.reset(AllocateFFmpegSafeBlock(side_data_size_)); | 114 side_data_.reset(AllocateFFmpegSafeBlock(side_data_size_)); |
118 memcpy(side_data_.get(), side_data, side_data_size_); | 115 memcpy(side_data_.get(), side_data, side_data_size_); |
119 } else { | 116 } else { |
120 side_data_.reset(); | 117 side_data_.reset(); |
121 side_data_size_ = 0; | 118 side_data_size_ = 0; |
122 } | 119 } |
123 } | 120 } |
124 | 121 |
125 } // namespace media | 122 } // namespace media |
OLD | NEW |