Skip to content

Commit 45bc9a4

Browse files
zhengxiongCommit bot
zhengxiong
authored and
Commit bot
committed
Always create OPUS decoder buffer with kSampleFormatF32
The libopus call used always returns interleaved fp samples, which can cause issues if the provided audio config contains a sample_format other than interleaved fp. BUG= Review URL: https://codereview.chromium.org/1452913003 Cr-Commit-Position: refs/heads/master@{#360408}
1 parent 2fddf3b commit 45bc9a4

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

media/filters/opus_audio_decoder.cc

+5-8
Original file line numberDiff line numberDiff line change
@@ -317,15 +317,12 @@ bool OpusAudioDecoder::Decode(const scoped_refptr<DecoderBuffer>& input,
317317
scoped_refptr<AudioBuffer>* output_buffer) {
318318
// Allocate a buffer for the output samples.
319319
*output_buffer = AudioBuffer::CreateBuffer(
320-
config_.sample_format(),
321-
config_.channel_layout(),
320+
kSampleFormatF32, config_.channel_layout(),
322321
ChannelLayoutToChannelCount(config_.channel_layout()),
323-
config_.samples_per_second(),
324-
kMaxOpusOutputPacketSizeSamples);
325-
const int buffer_size =
326-
output_buffer->get()->channel_count() *
327-
output_buffer->get()->frame_count() *
328-
SampleFormatToBytesPerChannel(config_.sample_format());
322+
config_.samples_per_second(), kMaxOpusOutputPacketSizeSamples);
323+
const int buffer_size = output_buffer->get()->channel_count() *
324+
output_buffer->get()->frame_count() *
325+
SampleFormatToBytesPerChannel(kSampleFormatF32);
329326

330327
float* float_output_buffer = reinterpret_cast<float*>(
331328
output_buffer->get()->channel_data()[0]);

0 commit comments

Comments
 (0)