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 namespace media { | 7 namespace media { |
8 | 8 |
9 // Allocates a block of memory which is padded for use with the SIMD | 9 // Allocates a block of memory which is padded for use with the SIMD |
10 // optimizations used by FFmpeg. | 10 // optimizations used by FFmpeg. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 DCHECK_GT(side_data_size_, 0u); | 43 DCHECK_GT(side_data_size_, 0u); |
44 memcpy(side_data_.get(), side_data, side_data_size_); | 44 memcpy(side_data_.get(), side_data, side_data_size_); |
45 } | 45 } |
46 | 46 |
47 DecoderBuffer::~DecoderBuffer() {} | 47 DecoderBuffer::~DecoderBuffer() {} |
48 | 48 |
49 void DecoderBuffer::Initialize() { | 49 void DecoderBuffer::Initialize() { |
50 data_.reset(AllocateFFmpegSafeBlock(size_)); | 50 data_.reset(AllocateFFmpegSafeBlock(size_)); |
51 if (side_data_size_ > 0) | 51 if (side_data_size_ > 0) |
52 side_data_.reset(AllocateFFmpegSafeBlock(side_data_size_)); | 52 side_data_.reset(AllocateFFmpegSafeBlock(side_data_size_)); |
53 splice_timestamp_ = kNoTimestamp(); | 53 splice_timestamp_ = kNoTimestamp; |
54 } | 54 } |
55 | 55 |
56 // static | 56 // static |
57 scoped_refptr<DecoderBuffer> DecoderBuffer::CopyFrom(const uint8_t* data, | 57 scoped_refptr<DecoderBuffer> DecoderBuffer::CopyFrom(const uint8_t* data, |
58 size_t data_size) { | 58 size_t data_size) { |
59 // If you hit this CHECK you likely have a bug in a demuxer. Go fix it. | 59 // If you hit this CHECK you likely have a bug in a demuxer. Go fix it. |
60 CHECK(data); | 60 CHECK(data); |
61 return make_scoped_refptr(new DecoderBuffer(data, data_size, NULL, 0)); | 61 return make_scoped_refptr(new DecoderBuffer(data, data_size, NULL, 0)); |
62 } | 62 } |
63 | 63 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 side_data_size_ = side_data_size; | 110 side_data_size_ = side_data_size; |
111 side_data_.reset(AllocateFFmpegSafeBlock(side_data_size_)); | 111 side_data_.reset(AllocateFFmpegSafeBlock(side_data_size_)); |
112 memcpy(side_data_.get(), side_data, side_data_size_); | 112 memcpy(side_data_.get(), side_data, side_data_size_); |
113 } else { | 113 } else { |
114 side_data_.reset(); | 114 side_data_.reset(); |
115 side_data_size_ = 0; | 115 side_data_size_ = 0; |
116 } | 116 } |
117 } | 117 } |
118 | 118 |
119 } // namespace media | 119 } // namespace media |
OLD | NEW |