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/filters/ffmpeg_audio_decoder.h" | 5 #include "media/filters/ffmpeg_audio_decoder.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "media/base/audio_buffer.h" | 9 #include "media/base/audio_buffer.h" |
10 #include "media/base/audio_bus.h" | 10 #include "media/base/audio_bus.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 for (; i < AV_NUM_DATA_POINTERS; ++i) | 113 for (; i < AV_NUM_DATA_POINTERS; ++i) |
114 frame->extended_data[i] = frame->data[i] = buffer->channel_data()[i]; | 114 frame->extended_data[i] = frame->data[i] = buffer->channel_data()[i]; |
115 for (; i < number_of_planes; ++i) | 115 for (; i < number_of_planes; ++i) |
116 frame->extended_data[i] = buffer->channel_data()[i]; | 116 frame->extended_data[i] = buffer->channel_data()[i]; |
117 } | 117 } |
118 | 118 |
119 // Now create an AVBufferRef for the data just allocated. It will own the | 119 // Now create an AVBufferRef for the data just allocated. It will own the |
120 // reference to the AudioBuffer object. | 120 // reference to the AudioBuffer object. |
121 void* opaque = NULL; | 121 void* opaque = NULL; |
122 buffer.swap(reinterpret_cast<AudioBuffer**>(&opaque)); | 122 buffer.swap(reinterpret_cast<AudioBuffer**>(&opaque)); |
| 123 frame->type = FF_BUFFER_TYPE_USER; |
123 frame->buf[0] = av_buffer_create( | 124 frame->buf[0] = av_buffer_create( |
124 frame->data[0], buffer_size_in_bytes, ReleaseAudioBufferImpl, opaque, 0); | 125 frame->data[0], buffer_size_in_bytes, ReleaseAudioBufferImpl, opaque, 0); |
125 return 0; | 126 return 0; |
126 } | 127 } |
127 | 128 |
128 FFmpegAudioDecoder::FFmpegAudioDecoder( | 129 FFmpegAudioDecoder::FFmpegAudioDecoder( |
129 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 130 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
130 const LogCB& log_cb) | 131 const LogCB& log_cb) |
131 : task_runner_(task_runner), | 132 : task_runner_(task_runner), |
132 state_(kUninitialized), | 133 state_(kUninitialized), |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 | 455 |
455 ResetTimestampState(); | 456 ResetTimestampState(); |
456 return true; | 457 return true; |
457 } | 458 } |
458 | 459 |
459 void FFmpegAudioDecoder::ResetTimestampState() { | 460 void FFmpegAudioDecoder::ResetTimestampState() { |
460 discard_helper_->Reset(config_.codec_delay()); | 461 discard_helper_->Reset(config_.codec_delay()); |
461 } | 462 } |
462 | 463 |
463 } // namespace media | 464 } // namespace media |
OLD | NEW |