Index: media/mp4/mp4_stream_parser.cc |
diff --git a/media/mp4/mp4_stream_parser.cc b/media/mp4/mp4_stream_parser.cc |
index 3f9b016c31287e83b1d1a471c59c4eda7ed031aa..970c51693b20d93be6706737f1f933723d41235a 100644 |
--- a/media/mp4/mp4_stream_parser.cc |
+++ b/media/mp4/mp4_stream_parser.cc |
@@ -23,7 +23,8 @@ namespace mp4 { |
// TODO(xhwang): Figure out the init data type appropriately once it's spec'ed. |
static const char kMp4InitDataType[] = "video/mp4"; |
-MP4StreamParser::MP4StreamParser(bool has_sbr) |
+MP4StreamParser::MP4StreamParser(const std::set<int>& audio_object_types, |
+ bool has_sbr) |
: state_(kWaitingForInit), |
moof_head_(0), |
mdat_tail_(0), |
@@ -31,6 +32,7 @@ MP4StreamParser::MP4StreamParser(bool has_sbr) |
has_video_(false), |
audio_track_id_(0), |
video_track_id_(0), |
+ audio_object_types_(audio_object_types), |
has_sbr_(has_sbr), |
is_audio_track_encrypted_(false), |
is_video_track_encrypted_(false) { |
@@ -202,11 +204,21 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) { |
<< std::hex << entry.format << " in stsd box."; |
return false; |
} |
- // Check if it is MPEG4 AAC defined in ISO 14496 Part 3. |
- if (entry.esds.object_type != kISO_14496_3) { |
+ |
+ int audio_type = entry.esds.object_type; |
+ DVLOG(1) << "audio_type " << std::hex << audio_type; |
+ if (audio_object_types_.find(audio_type) == audio_object_types_.end()) { |
+ MEDIA_LOG(log_cb_) << "audio object type 0x" << std::hex << audio_type |
+ << " does not match what is specified in the" |
+ << " mimetype."; |
+ return false; |
+ } |
+ |
+ // Check if it is MPEG4 AAC defined in ISO 14496 Part 3 or |
+ // supported MPEG2 AAC varients. |
+ if (audio_type != kISO_14496_3 && audio_type != kISO_13818_7_AAC_LC) { |
MEDIA_LOG(log_cb_) << "Unsupported audio object type 0x" << std::hex |
- << static_cast<int>(entry.esds.object_type) |
- << " in esds."; |
+ << audio_type << " in esds."; |
return false; |
} |