Chromium Code Reviews| Index: media/ffmpeg/ffmpeg_common.cc |
| diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc |
| index 950b9c0fd103672103d65048a7ad47ab48b89ee7..4453b4cef9cc1977aa777cf83629ed74f7f151df 100644 |
| --- a/media/ffmpeg/ffmpeg_common.cc |
| +++ b/media/ffmpeg/ffmpeg_common.cc |
| @@ -324,8 +324,16 @@ bool AVCodecContextToAudioDecoderConfig( |
| SampleFormat sample_format = AVSampleFormatToSampleFormat( |
| codec_context->sample_fmt, codec_context->codec_id); |
| - ChannelLayout channel_layout = ChannelLayoutToChromeChannelLayout( |
| - codec_context->channel_layout, codec_context->channels); |
| + bool is_opus_discrete = false; |
| + if (codec == kCodecOpus && codec_context->extradata_size >= 19) { |
| + int mapping_family = codec_context->extradata[18]; |
| + is_opus_discrete = mapping_family == 2; |
| + } |
| + ChannelLayout channel_layout = |
| + is_opus_discrete && codec_context->channels > 8 |
|
DaleCurtis
2017/05/24 00:49:58
Did you ever figure out if this > 8 check could be
flim-chromium
2017/05/25 00:04:25
I'm not familiar enough with the potential problem
DaleCurtis
2017/05/25 00:29:16
Leaving sgtm for now, though I think WebAudio does
|
| + ? CHANNEL_LAYOUT_DISCRETE |
| + : ChannelLayoutToChromeChannelLayout(codec_context->channel_layout, |
| + codec_context->channels); |
| int sample_rate = codec_context->sample_rate; |
| switch (codec) { |
| @@ -371,6 +379,7 @@ bool AVCodecContextToAudioDecoderConfig( |
| config->Initialize(codec, sample_format, channel_layout, sample_rate, |
| extra_data, encryption_scheme, seek_preroll, |
| codec_context->delay); |
| + config->SetChannelsForDiscrete(codec_context->channels); |
|
DaleCurtis
2017/05/24 00:49:58
Probably you don't want to always do this. channel
flim-chromium
2017/05/25 00:04:26
Right, I ran into this problem with the ffmpeg tes
|
| #if BUILDFLAG(ENABLE_AC3_EAC3_AUDIO_DEMUXING) |
| // These are bitstream formats unknown to ffmpeg, so they don't have |
| @@ -419,8 +428,7 @@ void AudioDecoderConfigToAVCodecContext(const AudioDecoderConfig& config, |
| // TODO(scherkus): should we set |channel_layout|? I'm not sure if FFmpeg uses |
| // said information to decode. |
| - codec_context->channels = |
| - ChannelLayoutToChannelCount(config.channel_layout()); |
| + codec_context->channels = config.channels(); |
| codec_context->sample_rate = config.samples_per_second(); |
| if (config.extra_data().empty()) { |