Index: media/filters/opus_audio_decoder.cc |
diff --git a/media/filters/opus_audio_decoder.cc b/media/filters/opus_audio_decoder.cc |
index 7aa931930aecc1bc249f06fe7e9e73a0f0a57f96..2278467c2b9878cb4b3066733af6f249ca820559 100644 |
--- a/media/filters/opus_audio_decoder.cc |
+++ b/media/filters/opus_audio_decoder.cc |
@@ -459,7 +459,7 @@ bool OpusAudioDecoder::ConfigureDecoder() { |
// Allocate the output buffer if necessary. |
if (!output_buffer_) |
- output_buffer_.reset(new int16[kMaxOpusOutputPacketSizeSamples]); |
+ output_buffer_.reset(new float[kMaxOpusOutputPacketSizeSamples]); |
// Parse the Opus Extra Data. |
OpusExtraData opus_extra_data; |
@@ -535,12 +535,13 @@ void OpusAudioDecoder::ResetTimestampState() { |
bool OpusAudioDecoder::Decode(const scoped_refptr<DecoderBuffer>& input, |
scoped_refptr<AudioBuffer>* output_buffer) { |
- int frames_decoded = opus_multistream_decode(opus_decoder_, |
- input->data(), |
- input->data_size(), |
- &output_buffer_[0], |
- kMaxOpusOutputPacketSizeSamples, |
- 0); |
+ int frames_decoded = |
+ opus_multistream_decode_float(opus_decoder_, |
+ input->data(), |
+ input->data_size(), |
+ &output_buffer_[0], |
+ kMaxOpusOutputPacketSizeSamples, |
+ 0); |
if (frames_decoded < 0) { |
DVLOG(0) << "opus_multistream_decode failed for" |
<< " timestamp: " << input->timestamp().InMicroseconds() |
@@ -572,7 +573,7 @@ bool OpusAudioDecoder::Decode(const scoped_refptr<DecoderBuffer>& input, |
// Copy the audio samples into an output buffer. |
uint8* data[] = { decoded_audio_data }; |
*output_buffer = AudioBuffer::CopyFrom( |
- kSampleFormatS16, |
+ kSampleFormatF32, |
ChannelLayoutToChannelCount(channel_layout_), |
frames_decoded, |
data, |
@@ -601,11 +602,13 @@ bool OpusAudioDecoder::Decode(const scoped_refptr<DecoderBuffer>& input, |
// Decoding finished successfully, update statistics. |
PipelineStatistics statistics; |
- statistics.audio_bytes_decoded = |
- frames_decoded * |
- demuxer_stream_->audio_decoder_config().bytes_per_frame(); |
+ statistics.audio_bytes_decoded = bytes_decoded; |
vignesh
2013/12/11 20:10:18
not sure if this change is required. even though w
acolwell GONE FROM CHROMIUM
2013/12/11 20:22:32
This is actually still wrong. This stat is suppose
DaleCurtis
2013/12/11 22:19:36
Done.
|
statistics_cb_.Run(statistics); |
+ // Discard the buffer to indicate we need more data. |
+ if (!frames_decoded) |
+ *output_buffer = NULL; |
+ |
return true; |
} |