| Index: media/base/audio_decoder_config.cc
|
| diff --git a/media/base/audio_decoder_config.cc b/media/base/audio_decoder_config.cc
|
| index 225f19a7f796c34c42c31e2dfcf78dd11f8181d5..527187615e41a66b4c2d454cdf4d85f2adf52181 100644
|
| --- a/media/base/audio_decoder_config.cc
|
| +++ b/media/base/audio_decoder_config.cc
|
| @@ -51,8 +51,10 @@ void AudioDecoderConfig::Initialize(AudioCodec codec,
|
| seek_preroll_ = seek_preroll;
|
| codec_delay_ = codec_delay;
|
|
|
| - int channels = ChannelLayoutToChannelCount(channel_layout_);
|
| - bytes_per_frame_ = channels * bytes_per_channel_;
|
| + // If |channel_layout_| is CHANNEL_LAYOUT_DISCRETE, |channels_| and
|
| + // |bytes_per_frame_| will be overwritten in SetChannelsForDiscrete()
|
| + channels_ = ChannelLayoutToChannelCount(channel_layout_);
|
| + bytes_per_frame_ = channels_ * bytes_per_channel_;
|
| }
|
|
|
| AudioDecoderConfig::~AudioDecoderConfig() {}
|
| @@ -85,7 +87,7 @@ std::string AudioDecoderConfig::AsHumanReadableString() const {
|
| std::ostringstream s;
|
| s << "codec: " << GetCodecName(codec())
|
| << " bytes_per_channel: " << bytes_per_channel()
|
| - << " channel_layout: " << channel_layout()
|
| + << " channel_layout: " << channel_layout() << " channels: " << channels()
|
| << " samples_per_second: " << samples_per_second()
|
| << " sample_format: " << sample_format()
|
| << " bytes_per_frame: " << bytes_per_frame()
|
| @@ -96,6 +98,13 @@ std::string AudioDecoderConfig::AsHumanReadableString() const {
|
| return s.str();
|
| }
|
|
|
| +void AudioDecoderConfig::SetChannelsForDiscrete(int channels) {
|
| + DCHECK(channel_layout_ == CHANNEL_LAYOUT_DISCRETE ||
|
| + channels == ChannelLayoutToChannelCount(channel_layout_));
|
| + channels_ = channels;
|
| + bytes_per_frame_ = channels_ * bytes_per_channel_;
|
| +}
|
| +
|
| void AudioDecoderConfig::SetIsEncrypted(bool is_encrypted) {
|
| if (!is_encrypted) {
|
| DCHECK(encryption_scheme_.is_encrypted()) << "Config is already clear.";
|
|
|