Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(921)

Unified Diff: media/base/audio_decoder_config.cc

Issue 2752323002: Support Opus Ambisonics playback (Closed)
Patch Set: another fix for unreliable ffmpeg channels vs layout Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/audio_decoder_config.h ('k') | media/base/fake_audio_renderer_sink.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.";
« no previous file with comments | « media/base/audio_decoder_config.h ('k') | media/base/fake_audio_renderer_sink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698