Index: media/mp4/aac.cc |
diff --git a/media/mp4/aac.cc b/media/mp4/aac.cc |
index f7826363b80d8b0f92631676ecfbee1a83e67da7..f92dd2feb928b9fc69cf1e9c6337c1bb19f513dd 100644 |
--- a/media/mp4/aac.cc |
+++ b/media/mp4/aac.cc |
@@ -19,7 +19,7 @@ static const int kFrequencyMap[] = { |
namespace media { |
-static ChannelLayout GetChannelLayout(uint8 channel_config) { |
+static ChannelLayout ConvertChannelConfigToLayout(uint8 channel_config) { |
switch (channel_config) { |
case 1: |
return CHANNEL_LAYOUT_MONO; |
@@ -130,9 +130,9 @@ bool AAC::Parse(const std::vector<uint8>& data) { |
// When Parametric Stereo is on, mono will be played as stereo. |
if (ps_present && channel_config_ == 1) |
- channel_layout_ = GetChannelLayout(2); |
+ channel_layout_ = CHANNEL_LAYOUT_STEREO; |
else |
- channel_layout_ = GetChannelLayout(channel_config_); |
+ channel_layout_ = ConvertChannelConfigToLayout(channel_config_); |
return frequency_ != 0 && channel_layout_ != CHANNEL_LAYOUT_UNSUPPORTED && |
profile_ >= 1 && profile_ <= 4 && frequency_index_ != 0xf && |
@@ -154,7 +154,13 @@ int AAC::GetOutputSamplesPerSecond(bool sbr_in_mimetype) const { |
return std::min(2 * frequency_, 48000); |
} |
-ChannelLayout AAC::channel_layout() const { |
+ChannelLayout AAC::GetChannelLayout(bool sbr_in_mimetype) const { |
+ // Check for implicit signalling of HE-AAC and indicate stereo output |
+ // if the mono channel configuration is signalled. |
+ // See ISO-14496-3 Section 1.6.6.1.2 for details about this special casing. |
+ if (sbr_in_mimetype && channel_config_ == 1) |
+ return CHANNEL_LAYOUT_STEREO; |
+ |
return channel_layout_; |
} |