summaryrefslogtreecommitdiffstats
path: root/media/mp4
diff options
context:
space:
mode:
authoracolwell@chromium.org <acolwell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-16 23:03:42 +0000
committeracolwell@chromium.org <acolwell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-16 23:03:42 +0000
commitbd4380a58a06e0614264c071fbb5a3e4d18ac0d2 (patch)
treeb2b3cba527ba90bf12b7545f53b0cf7df0da16f5 /media/mp4
parente62624d9f5116b16a20a5ee6c03b90347959337f (diff)
downloadchromium_src-bd4380a58a06e0614264c071fbb5a3e4d18ac0d2.zip
chromium_src-bd4380a58a06e0614264c071fbb5a3e4d18ac0d2.tar.gz
chromium_src-bd4380a58a06e0614264c071fbb5a3e4d18ac0d2.tar.bz2
Add support for accepting MPEG2 AAC-LC bitstreams.
BUG=168891 TEST=MP4StreamParserTest.TestMPEG2_AAC_LC Review URL: https://chromiumcodereview.appspot.com/11819013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177246 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/mp4')
-rw-r--r--media/mp4/es_descriptor.h3
-rw-r--r--media/mp4/mp4_stream_parser.cc22
-rw-r--r--media/mp4/mp4_stream_parser.h5
-rw-r--r--media/mp4/mp4_stream_parser_unittest.cc14
4 files changed, 35 insertions, 9 deletions
diff --git a/media/mp4/es_descriptor.h b/media/mp4/es_descriptor.h
index daddbc0..65b9cd2 100644
--- a/media/mp4/es_descriptor.h
+++ b/media/mp4/es_descriptor.h
@@ -20,7 +20,8 @@ namespace mp4 {
// objectTypeIndication Values. Only values currently in use are included.
enum ObjectType {
kForbidden = 0,
- kISO_14496_3 = 0x40 // MPEG4 AAC
+ kISO_14496_3 = 0x40, // MPEG4 AAC
+ kISO_13818_7_AAC_LC = 0x67 // MPEG2 AAC-LC
};
// This class parse object type and decoder specific information from an
diff --git a/media/mp4/mp4_stream_parser.cc b/media/mp4/mp4_stream_parser.cc
index 3f9b016..970c516 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;
}
diff --git a/media/mp4/mp4_stream_parser.h b/media/mp4/mp4_stream_parser.h
index 05206ef..0fc65c6 100644
--- a/media/mp4/mp4_stream_parser.h
+++ b/media/mp4/mp4_stream_parser.h
@@ -5,6 +5,7 @@
#ifndef MEDIA_MP4_MP4_STREAM_PARSER_H_
#define MEDIA_MP4_MP4_STREAM_PARSER_H_
+#include <set>
#include <vector>
#include "base/basictypes.h"
@@ -24,7 +25,7 @@ class BoxReader;
class MEDIA_EXPORT MP4StreamParser : public StreamParser {
public:
- MP4StreamParser(bool has_sbr);
+ MP4StreamParser(const std::set<int>& audio_object_types, bool has_sbr);
virtual ~MP4StreamParser();
virtual void Init(const InitCB& init_cb, const NewConfigCB& config_cb,
@@ -107,6 +108,8 @@ class MEDIA_EXPORT MP4StreamParser : public StreamParser {
bool has_video_;
uint32 audio_track_id_;
uint32 video_track_id_;
+ // The object types allowed for audio tracks.
+ std::set<int> audio_object_types_;
bool has_sbr_;
bool is_audio_track_encrypted_;
bool is_video_track_encrypted_;
diff --git a/media/mp4/mp4_stream_parser_unittest.cc b/media/mp4/mp4_stream_parser_unittest.cc
index 99aa206..252d490 100644
--- a/media/mp4/mp4_stream_parser_unittest.cc
+++ b/media/mp4/mp4_stream_parser_unittest.cc
@@ -15,6 +15,7 @@
#include "media/base/stream_parser_buffer.h"
#include "media/base/test_data_util.h"
#include "media/base/video_decoder_config.h"
+#include "media/mp4/es_descriptor.h"
#include "media/mp4/mp4_stream_parser.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -29,8 +30,10 @@ static const char kMp4InitDataType[] = "video/mp4";
class MP4StreamParserTest : public testing::Test {
public:
MP4StreamParserTest()
- : parser_(new MP4StreamParser(false)),
- configs_received_(false) {
+ : configs_received_(false) {
+ std::set<int> audio_object_types;
+ audio_object_types.insert(kISO_14496_3);
+ parser_.reset(new MP4StreamParser(audio_object_types, false));
}
protected:
@@ -164,6 +167,13 @@ TEST_F(MP4StreamParserTest, TestReinitialization) {
512));
}
+TEST_F(MP4StreamParserTest, TestMPEG2_AAC_LC) {
+ std::set<int> audio_object_types;
+ audio_object_types.insert(kISO_13818_7_AAC_LC);
+ parser_.reset(new MP4StreamParser(audio_object_types, false));
+ ParseMP4File("bear-mpeg2-aac-only_frag.mp4", 512);
+}
+
// TODO(strobe): Create and test media which uses CENC auxiliary info stored
// inside a private box