Chromium Code Reviews| Index: media/formats/mp4/aac.cc |
| diff --git a/media/formats/mp4/aac.cc b/media/formats/mp4/aac.cc |
| index 9aa749ca310cffe9eb0520c8c2c6395da439c4f0..2f0e91efc2a2226f1166b24c1009db3fb7f0352a 100644 |
| --- a/media/formats/mp4/aac.cc |
| +++ b/media/formats/mp4/aac.cc |
| @@ -38,6 +38,11 @@ bool AAC::Parse(const std::vector<uint8>& data, |
| frequency_ = 0; |
| extension_frequency_ = 0; |
| + // TODO(msu.koo): Need to update comments after checking which version of |
| + // ISO 14496-3 this implementation is according to. Also need to reflect |
| + // ISO 14496-3-2009 if ISO 14496-3-2005 was reflected here. |
| + // http://crbug.com/532281 |
|
wolenetz
2015/09/16 19:39:19
nit: s/http:/https:/
msu.koo
2015/09/17 02:49:26
Done.
|
| + |
| // The following code is written according to ISO 14496 Part 3 Table 1.13 - |
| // Syntax of AudioSpecificConfig. |
| @@ -58,9 +63,6 @@ bool AAC::Parse(const std::vector<uint8>& data, |
| RCHECK(reader.ReadBits(5, &profile_)); |
| } |
| - MEDIA_LOG(INFO, media_log) << "Audio codec: mp4a.40." << std::hex |
| - << static_cast<int>(profile_); |
| - |
| RCHECK(SkipDecoderGASpecificConfig(&reader)); |
| RCHECK(SkipErrorSpecificConfig()); |
| @@ -96,12 +98,26 @@ bool AAC::Parse(const std::vector<uint8>& data, |
| } |
| if (frequency_ == 0) { |
| - RCHECK(frequency_index_ < kADTSFrequencyTableSize); |
| + if (frequency_index_ >= kADTSFrequencyTableSize) { |
| + MEDIA_LOG(ERROR, media_log) |
| + << "Sampling Frequency Index(0x" |
| + << std::hex << static_cast<int>(frequency_index_) |
| + << ") is not supported. Please see ISO 14496-3-2005 Table 1.18 " |
|
wolenetz
2015/09/16 19:39:19
nit: in 2005 version, it's not 1.18. similar ditto
msu.koo
2015/09/17 02:49:26
Done.
|
| + << "for supported Sampling Frequencies."; |
| + return false; |
| + } |
| frequency_ = kADTSFrequencyTable[frequency_index_]; |
| } |
| if (extension_frequency_ == 0 && extension_frequency_index != 0xff) { |
| - RCHECK(extension_frequency_index < kADTSFrequencyTableSize); |
| + if (extension_frequency_index >= kADTSFrequencyTableSize) { |
| + MEDIA_LOG(ERROR, media_log) |
| + << "Extension Sampling Frequency Index(0x" |
| + << std::hex << static_cast<int>(extension_frequency_index) |
| + << ") is not supported. Please see ISO 14496-3-2005 Table 1.18 " |
| + << "for supported Sampling Frequencies."; |
| + return false; |
| + } |
| extension_frequency_ = kADTSFrequencyTable[extension_frequency_index]; |
| } |
| @@ -109,12 +125,32 @@ bool AAC::Parse(const std::vector<uint8>& data, |
| if (ps_present && channel_config_ == 1) { |
| channel_layout_ = CHANNEL_LAYOUT_STEREO; |
| } else { |
| - RCHECK(channel_config_ < kADTSChannelLayoutTableSize); |
| + if (channel_config_ >= kADTSChannelLayoutTableSize) { |
| + MEDIA_LOG(ERROR, media_log) |
| + << "Channel Configuration(" |
| + << static_cast<int>(channel_config_) |
| + << ") is not supported. Please see ISO 14496-3-2005 Table 1.19 " |
| + << "for supported Channel Configurations."; |
| + return false; |
| + } |
| channel_layout_ = kADTSChannelLayoutTable[channel_config_]; |
| } |
| - return frequency_ != 0 && channel_layout_ != CHANNEL_LAYOUT_NONE && |
| - profile_ >= 1 && profile_ <= 4; |
| + if (profile_ < 1 || profile_ > 4) { |
| + MEDIA_LOG(ERROR, media_log) |
| + << "Audio codec(mp4a.40." << static_cast<int>(profile_) |
| + << ") is not supported. Please see ISO 14496-3-2005 Table 1.3 " |
| + << "for Audio Profile Definitions."; |
| + return false; |
| + } |
| + |
| + MEDIA_LOG(INFO, media_log) |
| + << "Audio codec: mp4a.40." << static_cast<int>(profile_) |
| + << ". Sampling frequency: " << frequency_ << "Hz" |
| + << ". Sampling frequency(Extension): " << extension_frequency_ << "Hz" |
| + << ". Channel layout: " << channel_layout_ << "."; |
| + |
| + return true; |
| } |
| int AAC::GetOutputSamplesPerSecond(bool sbr_in_mimetype) const { |