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

Unified Diff: media/formats/mp4/aac.cc

Issue 1316273002: Updated AAC:Parse() to emit better error logs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 | « no previous file | media/formats/mp4/aac_unittest.cc » ('j') | media/formats/mp4/aac_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/formats/mp4/aac.cc
diff --git a/media/formats/mp4/aac.cc b/media/formats/mp4/aac.cc
index 9aa749ca310cffe9eb0520c8c2c6395da439c4f0..308a12d5255e4078b4681b6704890b22716c86eb 100644
--- a/media/formats/mp4/aac.cc
+++ b/media/formats/mp4/aac.cc
@@ -58,9 +58,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 +93,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 Part 3 Table 1.18 "
+ << "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 Part 3 Table 1.18 "
+ << "for supported Sampling Frequencies.";
+ return false;
+ }
extension_frequency_ = kADTSFrequencyTable[extension_frequency_index];
}
@@ -109,12 +120,35 @@ 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 Part 3 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;
+ RCHECK_MEDIA_LOGGED(channel_layout_ != CHANNEL_LAYOUT_NONE, media_log,
wolenetz 2015/09/15 23:53:17 nit: it looks like this log is also possible to te
msu.koo 2015/09/16 08:16:23 This code block is dead. "|channel_config_| == 0"
wolenetz 2015/09/16 19:39:19 Acknowledged. Since the helper method might change
msu.koo 2015/09/17 02:49:26 Done.
+ "Undefined Audio Channel layout with value "
+ "CHANNEL_LAYOUT_NONE.");
+ 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 Part 3 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 {
« no previous file with comments | « no previous file | media/formats/mp4/aac_unittest.cc » ('j') | media/formats/mp4/aac_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698