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

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, 4 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..665e90cb487cd679f9a71cdab9b9319d777310e4 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)
+ << "Unsupported Sampling Frequency Index with value 0x"
+ << std::hex << static_cast<int>(frequency_index_)
+ << ". Please see ISO 14496 Part 3 Table 1.16 "
+ << "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)
+ << "Unsupported Sampling Frequency Index with value 0x"
wolenetz 2015/08/28 23:29:35 ISTM text like "Unsupported Extension Sampling Fre
msu.koo 2015/08/29 09:36:51 Done.
+ << std::hex << static_cast<int>(frequency_index_)
+ << ". Please see ISO 14496 Part 3 Table 1.16 "
+ << "for supported Sampling Frequencies.";
+ return false;
+ }
extension_frequency_ = kADTSFrequencyTable[extension_frequency_index];
}
@@ -109,12 +120,37 @@ 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)
+ << "Unsupported Channel Configuration with value "
+ << static_cast<int>(channel_config_) << "."
wolenetz 2015/08/28 23:29:35 nit: s/"."/". "/
msu.koo 2015/08/29 09:36:51 Done.
+ << "Please see ISO 14496 Part 3 Table 1.17 "
+ << "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(frequency_ != 0, media_log,
+ "Audio frequency is invalid with value 0.");
+ RCHECK_MEDIA_LOGGED(channel_layout_ != CHANNEL_LAYOUT_NONE, media_log,
+ "Undefined Audio Channel layout with value "
+ "CHANNEL_LAYOUT_NONE.");
+ if (profile_ < 1 || profile_ > 4) {
wolenetz 2015/08/28 23:29:35 side note: Looking over this logic, I've filed crb
msu.koo 2015/08/29 09:36:51 OK, I also agree with you opinion. More investigat
+ MEDIA_LOG(ERROR, media_log)
+ << "Audio codec: mp4a.40." << static_cast<int>(profile_)
+ << " is not supported."
wolenetz 2015/08/28 23:29:35 nit ditto: s/"."/". "/
msu.koo 2015/08/29 09:36:51 Done.
+ <<"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"
+ << ", Extension Sampling frequency: " << extension_frequency_ << "Hz"
+ << ", Channel_layout: " << channel_layout_;
wolenetz 2015/08/28 23:29:35 nit: s/Channel_layout/Channel layout/
msu.koo 2015/08/29 09:36:51 Done.
+ 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