| Index: net/base/mime_util.cc
|
| diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc
|
| index 7b51b41faf5c112e329effd848907c605b1e1875..d4ebbf452810bd913e3c4912b1b35b485c25926b 100644
|
| --- a/net/base/mime_util.cc
|
| +++ b/net/base/mime_util.cc
|
| @@ -523,10 +523,18 @@ static const char kMP4AudioCodecsExpression[] =
|
| "mp4a.66,mp4a.67,mp4a.68,mp4a.69,mp4a.6B,mp4a.40.2,mp4a.40.02,mp4a.40.5,"
|
| "mp4a.40.05,mp4a.40.29";
|
| static const char kMP4VideoCodecsExpression[] =
|
| + // This is not a complete list of supported avc1 codecs. It is simply used
|
| + // to register support for the corresponding Codec enum. Instead of using
|
| + // strings in these three arrays, we should use the Codec enum values.
|
| + // This will avoid confusion and unnecessary parsing at runtime.
|
| + // kUnambiguousCodecStringMap/kAmbiguousCodecStringMap should be the only
|
| + // mapping from strings to codecs. See crbug.com/461009.
|
| "avc1.42E00A,avc1.4D400A,avc1.64000A,"
|
| "mp4a.66,mp4a.67,mp4a.68,mp4a.69,mp4a.6B,mp4a.40.2,mp4a.40.02,mp4a.40.5,"
|
| "mp4a.40.05,mp4a.40.29";
|
|
|
| +// These containers are also included in
|
| +// common_media_types/proprietary_media_types. See crbug.com/461012.
|
| static const MediaFormatStrict format_codec_mappings[] = {
|
| {"video/webm", "opus,vorbis,vp8,vp8.0,vp9,vp9.0"},
|
| {"audio/webm", "opus,vorbis"},
|
| @@ -561,8 +569,9 @@ struct CodecIDMappings {
|
| // codec and profile being requested.
|
| //
|
| // The "mp4a" strings come from RFC 6381.
|
| -static const CodecIDMappings kUnambiguousCodecIDs[] = {
|
| +static const CodecIDMappings kUnambiguousCodecStringMap[] = {
|
| {"1", MimeUtil::PCM}, // We only allow this for WAV so it isn't ambiguous.
|
| + // avc1/avc3.XXXXXX may be unambiguous; handled by ParseH264CodecID().
|
| {"mp3", MimeUtil::MP3},
|
| {"mp4a.66", MimeUtil::MPEG2_AAC_MAIN},
|
| {"mp4a.67", MimeUtil::MPEG2_AAC_LC},
|
| @@ -586,10 +595,11 @@ static const CodecIDMappings kUnambiguousCodecIDs[] = {
|
| // enough information to determine the codec and profile.
|
| // The codec in these entries indicate the codec and profile
|
| // we assume the user is trying to indicate.
|
| -static const CodecIDMappings kAmbiguousCodecIDs[] = {
|
| - { "mp4a.40", MimeUtil::MPEG4_AAC_LC },
|
| - { "avc1", MimeUtil::H264_BASELINE },
|
| - { "avc3", MimeUtil::H264_BASELINE },
|
| +static const CodecIDMappings kAmbiguousCodecStringMap[] = {
|
| + {"mp4a.40", MimeUtil::MPEG4_AAC_LC},
|
| + {"avc1", MimeUtil::H264_BASELINE},
|
| + {"avc3", MimeUtil::H264_BASELINE},
|
| + // avc1/avc3.XXXXXX may be ambiguous; handled by ParseH264CodecID().
|
| };
|
|
|
| MimeUtil::MimeUtil() : allow_proprietary_codecs_(false) {
|
| @@ -664,14 +674,14 @@ void MimeUtil::InitializeMimeTypeMaps() {
|
| for (size_t i = 0; i < arraysize(supported_javascript_types); ++i)
|
| javascript_map_.insert(supported_javascript_types[i]);
|
|
|
| - for (size_t i = 0; i < arraysize(kUnambiguousCodecIDs); ++i) {
|
| - string_to_codec_map_[kUnambiguousCodecIDs[i].codec_id] =
|
| - CodecEntry(kUnambiguousCodecIDs[i].codec, false);
|
| + for (size_t i = 0; i < arraysize(kUnambiguousCodecStringMap); ++i) {
|
| + string_to_codec_map_[kUnambiguousCodecStringMap[i].codec_id] =
|
| + CodecEntry(kUnambiguousCodecStringMap[i].codec, false);
|
| }
|
|
|
| - for (size_t i = 0; i < arraysize(kAmbiguousCodecIDs); ++i) {
|
| - string_to_codec_map_[kAmbiguousCodecIDs[i].codec_id] =
|
| - CodecEntry(kAmbiguousCodecIDs[i].codec, true);
|
| + for (size_t i = 0; i < arraysize(kAmbiguousCodecStringMap); ++i) {
|
| + string_to_codec_map_[kAmbiguousCodecStringMap[i].codec_id] =
|
| + CodecEntry(kAmbiguousCodecStringMap[i].codec, true);
|
| }
|
|
|
| // Initialize the strict supported media types.
|
|
|