| Index: media/filters/ffmpeg_audio_decoder.cc
|
| diff --git a/media/filters/ffmpeg_audio_decoder.cc b/media/filters/ffmpeg_audio_decoder.cc
|
| index 1ebf584d05fea70518a4984fe3ac8a8ed7123817..bcd291a8a95aaa370ed949a0203a6a55d8442a31 100644
|
| --- a/media/filters/ffmpeg_audio_decoder.cc
|
| +++ b/media/filters/ffmpeg_audio_decoder.cc
|
| @@ -226,10 +226,9 @@ bool FFmpegAudioDecoder::FFmpegDecode(
|
|
|
| bool is_sample_rate_change =
|
| av_frame_->sample_rate != config_.samples_per_second();
|
| - bool is_config_stale =
|
| - is_sample_rate_change ||
|
| - channels != ChannelLayoutToChannelCount(config_.channel_layout()) ||
|
| - av_frame_->format != av_sample_format_;
|
| + bool is_config_stale = is_sample_rate_change ||
|
| + channels != config_.channels() ||
|
| + av_frame_->format != av_sample_format_;
|
|
|
| // Only consider channel layout changes for AAC.
|
| // TODO(tguilbert, dalecurtis): Due to http://crbug.com/600538 we need to
|
| @@ -249,8 +248,7 @@ bool FFmpegAudioDecoder::FFmpegDecode(
|
| << config_.samples_per_second()
|
| << ", ChannelLayout: " << channel_layout << " vs "
|
| << config_.channel_layout() << ", Channels: " << channels
|
| - << " vs "
|
| - << ChannelLayoutToChannelCount(config_.channel_layout());
|
| + << " vs " << config_.channels();
|
| config_.Initialize(config_.codec(), config_.sample_format(),
|
| channel_layout, av_frame_->sample_rate,
|
| config_.extra_data(), config_.encryption_scheme(),
|
| @@ -263,7 +261,7 @@ bool FFmpegAudioDecoder::FFmpegDecode(
|
| << "Unsupported midstream configuration change!"
|
| << " Sample Rate: " << av_frame_->sample_rate << " vs "
|
| << config_.samples_per_second() << ", Channels: " << channels
|
| - << " vs " << ChannelLayoutToChannelCount(config_.channel_layout())
|
| + << " vs " << config_.channels()
|
| << ", Sample Format: " << av_frame_->format << " vs "
|
| << av_sample_format_;
|
| // This is an unrecoverable error, so bail out.
|
| @@ -277,8 +275,7 @@ bool FFmpegAudioDecoder::FFmpegDecode(
|
| output = reinterpret_cast<AudioBuffer*>(
|
| av_buffer_get_opaque(av_frame_->buf[0]));
|
|
|
| - DCHECK_EQ(ChannelLayoutToChannelCount(config_.channel_layout()),
|
| - output->channel_count());
|
| + DCHECK_EQ(config_.channels(), output->channel_count());
|
| const int unread_frames = output->frame_count() - av_frame_->nb_samples;
|
| DCHECK_GE(unread_frames, 0);
|
| if (unread_frames > 0)
|
| @@ -343,11 +340,9 @@ bool FFmpegAudioDecoder::ConfigureDecoder(const AudioDecoderConfig& config) {
|
| av_frame_.reset(av_frame_alloc());
|
| av_sample_format_ = codec_context_->sample_fmt;
|
|
|
| - if (codec_context_->channels !=
|
| - ChannelLayoutToChannelCount(config.channel_layout())) {
|
| + if (codec_context_->channels != config.channels()) {
|
| MEDIA_LOG(ERROR, media_log_)
|
| - << "Audio configuration specified "
|
| - << ChannelLayoutToChannelCount(config.channel_layout())
|
| + << "Audio configuration specified " << config.channels()
|
| << " channels, but FFmpeg thinks the file contains "
|
| << codec_context_->channels << " channels";
|
| ReleaseFFmpegResources();
|
| @@ -415,17 +410,14 @@ int FFmpegAudioDecoder::GetAudioBuffer(struct AVCodecContext* s,
|
| int frames_required = buffer_size_in_bytes / bytes_per_channel / channels;
|
| DCHECK_GE(frames_required, frame->nb_samples);
|
|
|
| - ChannelLayout channel_layout =
|
| - ChannelLayoutToChromeChannelLayout(s->channel_layout, s->channels);
|
| -
|
| - if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED) {
|
| + if (config_.channel_layout() == CHANNEL_LAYOUT_UNSUPPORTED) {
|
| DLOG(ERROR) << "Unsupported channel layout.";
|
| return AVERROR(EINVAL);
|
| }
|
|
|
| - scoped_refptr<AudioBuffer> buffer =
|
| - AudioBuffer::CreateBuffer(sample_format, channel_layout, channels,
|
| - s->sample_rate, frames_required, pool_);
|
| + scoped_refptr<AudioBuffer> buffer = AudioBuffer::CreateBuffer(
|
| + sample_format, config_.channel_layout(), channels, s->sample_rate,
|
| + frames_required, pool_);
|
|
|
| // Initialize the data[] and extended_data[] fields to point into the memory
|
| // allocated for AudioBuffer. |number_of_planes| will be 1 for interleaved
|
|
|