diff options
author | wolenetz <wolenetz@chromium.org> | 2014-11-25 12:22:50 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-25 20:23:08 +0000 |
commit | 2a1e948cc3bc735ac13e9ffa125a512e9cf2e2db (patch) | |
tree | db7ad62561173af1b295d21efc2ff45a696b2066 /media/filters/stream_parser_factory.cc | |
parent | cea221bc9d741848e165e4d7ae93a31bb76cc682 (diff) | |
download | chromium_src-2a1e948cc3bc735ac13e9ffa125a512e9cf2e2db.zip chromium_src-2a1e948cc3bc735ac13e9ffa125a512e9cf2e2db.tar.gz chromium_src-2a1e948cc3bc735ac13e9ffa125a512e9cf2e2db.tar.bz2 |
MSE and non-MSE: Support HE-AACv2 "mp4a.40.29" codec string
Adds codec string support for HE-AACv2 to match existing
support/lack of support of HE-AACv1 "mp4a.40.5" codec string.
Also fixes a pre-existing MPEG4 AAC codec string parsing error in
stream_parser_factory.cc that interpreted the object type id xx in
"mp4a.40.xx" as hexadecimal (which was ok for just 2 and 5, but not 29).
BUG=315566
R=servolk@chromium.org,qinmin@chromium.org,dalecurtis@chromium.org,rsleevi@chromium.org
TEST=Updated MediaCanPlayTypeTest.CodecSupportTest_*,
* manual confirmation of MediaSource.isTypeSupported(), and
* dashif.org reference player 1.2.0 "Multiple Audio Representations 6"
plays audio when proprietary codecs are included in local build
Review URL: https://codereview.chromium.org/746253004
Cr-Commit-Position: refs/heads/master@{#305684}
Diffstat (limited to 'media/filters/stream_parser_factory.cc')
-rw-r--r-- | media/filters/stream_parser_factory.cc | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/media/filters/stream_parser_factory.cc b/media/filters/stream_parser_factory.cc index b47fa75..f22756a 100644 --- a/media/filters/stream_parser_factory.cc +++ b/media/filters/stream_parser_factory.cc @@ -102,14 +102,24 @@ static StreamParser* BuildWebMParser( // AAC Object Type IDs that Chrome supports. static const int kAACLCObjectType = 2; static const int kAACSBRObjectType = 5; +static const int kAACPSObjectType = 29; static int GetMP4AudioObjectType(const std::string& codec_id, const LogCB& log_cb) { + // From RFC 6381 section 3.3 (ISO Base Media File Format Name Space): + // When the first element of a ['codecs' parameter value] is 'mp4a' ..., + // the second element is a hexadecimal representation of the MP4 Registration + // Authority ObjectTypeIndication (OTI). Note that MP4RA uses a leading "0x" + // with these values, which is omitted here and hence implied. std::vector<std::string> tokens; if (Tokenize(codec_id, ".", &tokens) == 3 && tokens[0] == "mp4a" && tokens[1] == "40") { + // From RFC 6381 section 3.3: + // One of the OTI values for 'mp4a' is 40 (identifying MPEG-4 audio). For + // this value, the third element identifies the audio ObjectTypeIndication + // (OTI) ... expressed as a decimal number. int audio_object_type; - if (base::HexStringToInt(tokens[2], &audio_object_type)) + if (base::StringToInt(tokens[2], &audio_object_type)) return audio_object_type; } @@ -120,12 +130,12 @@ static int GetMP4AudioObjectType(const std::string& codec_id, bool ValidateMP4ACodecID(const std::string& codec_id, const LogCB& log_cb) { int audio_object_type = GetMP4AudioObjectType(codec_id, log_cb); if (audio_object_type == kAACLCObjectType || - audio_object_type == kAACSBRObjectType) { + audio_object_type == kAACSBRObjectType || + audio_object_type == kAACPSObjectType) { return true; } - MEDIA_LOG(log_cb) << "Unsupported audio object type " - << "0x" << std::hex << audio_object_type + MEDIA_LOG(log_cb) << "Unsupported audio object type " << audio_object_type << " in codec '" << codec_id << "'"; return false; } @@ -170,7 +180,8 @@ static StreamParser* BuildMP4Parser( audio_object_types.insert(mp4::kISO_14496_3); - if (audio_object_type == kAACSBRObjectType) { + if (audio_object_type == kAACSBRObjectType || + audio_object_type == kAACPSObjectType) { has_sbr = true; break; } @@ -219,9 +230,12 @@ static StreamParser* BuildMP2TParser( bool has_sbr = false; for (size_t i = 0; i < codecs.size(); ++i) { std::string codec_id = codecs[i]; - if (MatchPattern(codec_id, kMPEG4AACCodecInfo.pattern) && - GetMP4AudioObjectType(codec_id, log_cb) == kAACSBRObjectType) { - has_sbr = true; + if (MatchPattern(codec_id, kMPEG4AACCodecInfo.pattern)) { + int audio_object_type = GetMP4AudioObjectType(codec_id, log_cb); + if (audio_object_type == kAACSBRObjectType || + audio_object_type == kAACPSObjectType) { + has_sbr = true; + } } } |