Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/base/mime_util_internal.h" | 5 #include "media/base/mime_util_internal.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 // mp4a.40.2 - MPEG-4 AAC LC | 38 // mp4a.40.2 - MPEG-4 AAC LC |
| 39 // mp4a.40.02 - MPEG-4 AAC LC (leading 0 in aud-oti for compatibility) | 39 // mp4a.40.02 - MPEG-4 AAC LC (leading 0 in aud-oti for compatibility) |
| 40 // mp4a.40.5 - MPEG-4 HE-AAC v1 (AAC LC + SBR) | 40 // mp4a.40.5 - MPEG-4 HE-AAC v1 (AAC LC + SBR) |
| 41 // mp4a.40.05 - MPEG-4 HE-AAC v1 (AAC LC + SBR) (leading 0 in aud-oti for | 41 // mp4a.40.05 - MPEG-4 HE-AAC v1 (AAC LC + SBR) (leading 0 in aud-oti for |
| 42 // compatibility) | 42 // compatibility) |
| 43 // mp4a.40.29 - MPEG-4 HE-AAC v2 (AAC LC + SBR + PS) | 43 // mp4a.40.29 - MPEG-4 HE-AAC v2 (AAC LC + SBR + PS) |
| 44 // | 44 // |
| 45 // avc1.42E0xx - H.264 Baseline | 45 // avc1.42E0xx - H.264 Baseline |
| 46 // avc1.4D40xx - H.264 Main | 46 // avc1.4D40xx - H.264 Main |
| 47 // avc1.6400xx - H.264 High | 47 // avc1.6400xx - H.264 High |
| 48 // vp09.... - VP9 | |
| 48 static const char kMP4AudioCodecsExpression[] = | 49 static const char kMP4AudioCodecsExpression[] = |
| 49 "mp4a.66,mp4a.67,mp4a.68,mp4a.69,mp4a.6B,mp4a.40.2,mp4a.40.02,mp4a.40.5," | 50 "mp4a.66,mp4a.67,mp4a.68,mp4a.69,mp4a.6B,mp4a.40.2,mp4a.40.02,mp4a.40.5," |
| 50 #if BUILDFLAG(ENABLE_AC3_EAC3_AUDIO_DEMUXING) | 51 #if BUILDFLAG(ENABLE_AC3_EAC3_AUDIO_DEMUXING) |
| 51 // Only one variant each of ac3 and eac3 codec string is sufficient here, | 52 // Only one variant each of ac3 and eac3 codec string is sufficient here, |
| 52 // since these strings are parsed and mapped to MimeUtil::Codec enum values. | 53 // since these strings are parsed and mapped to MimeUtil::Codec enum values. |
| 53 "ac-3,ec-3," | 54 "ac-3,ec-3," |
| 54 #endif | 55 #endif |
| 55 "mp4a.40.05,mp4a.40.29"; | 56 "mp4a.40.05,mp4a.40.29"; |
| 56 static const char kMP4VideoCodecsExpression[] = | 57 static const char kMP4VideoCodecsExpression[] = |
| 57 // This is not a complete list of supported avc1 codecs. It is simply used | 58 // This is not a complete list of supported avc1 codecs. It is simply used |
| 58 // to register support for the corresponding Codec enum. Instead of using | 59 // to register support for the corresponding Codec enum. Instead of using |
| 59 // strings in these three arrays, we should use the Codec enum values. | 60 // strings in these three arrays, we should use the Codec enum values. |
| 60 // This will avoid confusion and unnecessary parsing at runtime. | 61 // This will avoid confusion and unnecessary parsing at runtime. |
| 61 // kUnambiguousCodecStringMap/kAmbiguousCodecStringMap should be the only | 62 // kUnambiguousCodecStringMap/kAmbiguousCodecStringMap should be the only |
| 62 // mapping from strings to codecs. See crbug.com/461009. | 63 // mapping from strings to codecs. See crbug.com/461009. |
| 63 "avc1.42E00A,avc1.4D400A,avc1.64000A," | 64 "avc1.42E00A,avc1.4D400A,avc1.64000A," |
| 64 #if BUILDFLAG(ENABLE_HEVC_DEMUXING) | 65 #if BUILDFLAG(ENABLE_HEVC_DEMUXING) |
| 65 // Any valid unambiguous HEVC codec id will work here, since these strings | 66 // Any valid unambiguous HEVC codec id will work here, since these strings |
| 66 // are parsed and mapped to MimeUtil::Codec enum values. | 67 // are parsed and mapped to MimeUtil::Codec enum values. |
| 67 "hev1.1.6.L93.B0," | 68 "hev1.1.6.L93.B0," |
| 68 #endif | 69 #endif |
| 70 #if BUILDFLAG(ENABLE_MP4_VP9_DEMUXING) | |
| 71 // This is not a complete list of supported vp9 codecs. Similar to avc1 | |
| 72 // comments above. | |
| 73 "vp09.00.00.08.00.01.00.00," | |
| 74 #endif | |
| 69 "mp4a.66,mp4a.67,mp4a.68,mp4a.69,mp4a.6B,mp4a.40.2,mp4a.40.02,mp4a.40.5," | 75 "mp4a.66,mp4a.67,mp4a.68,mp4a.69,mp4a.6B,mp4a.40.2,mp4a.40.02,mp4a.40.5," |
| 70 #if BUILDFLAG(ENABLE_AC3_EAC3_AUDIO_DEMUXING) | 76 #if BUILDFLAG(ENABLE_AC3_EAC3_AUDIO_DEMUXING) |
| 71 // Only one variant each of ac3 and eac3 codec string is sufficient here, | 77 // Only one variant each of ac3 and eac3 codec string is sufficient here, |
| 72 // since these strings are parsed and mapped to MimeUtil::Codec enum values. | 78 // since these strings are parsed and mapped to MimeUtil::Codec enum values. |
| 73 "ac-3,ec-3," | 79 "ac-3,ec-3," |
| 74 #endif | 80 #endif |
| 75 "mp4a.40.05,mp4a.40.29"; | 81 "mp4a.40.05,mp4a.40.29"; |
| 76 #endif // USE_PROPRIETARY_CODECS | 82 #endif // USE_PROPRIETARY_CODECS |
| 77 | 83 |
| 78 // A list of media types (https://en.wikipedia.org/wiki/Media_type) and | 84 // A list of media types (https://en.wikipedia.org/wiki/Media_type) and |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 }; | 126 }; |
| 121 | 127 |
| 122 // List of codec IDs that provide enough information to determine the | 128 // List of codec IDs that provide enough information to determine the |
| 123 // codec and profile being requested. | 129 // codec and profile being requested. |
| 124 // | 130 // |
| 125 // The "mp4a" strings come from RFC 6381. | 131 // The "mp4a" strings come from RFC 6381. |
| 126 static const CodecIDMappings kUnambiguousCodecStringMap[] = { | 132 static const CodecIDMappings kUnambiguousCodecStringMap[] = { |
| 127 {"1", MimeUtil::PCM}, // We only allow this for WAV so it isn't ambiguous. | 133 {"1", MimeUtil::PCM}, // We only allow this for WAV so it isn't ambiguous. |
| 128 // avc1/avc3.XXXXXX may be unambiguous; handled by ParseAVCCodecId(). | 134 // avc1/avc3.XXXXXX may be unambiguous; handled by ParseAVCCodecId(). |
| 129 // hev1/hvc1.XXXXXX may be unambiguous; handled by ParseHEVCCodecID(). | 135 // hev1/hvc1.XXXXXX may be unambiguous; handled by ParseHEVCCodecID(). |
| 136 // vp09.xx.xx.xx.xx.xx.xx.xx may be unambiguous; handled by | |
| 137 // ParseVpxCodecID(). | |
|
ddorwin
2016/02/29 23:57:34
s/x/9/
kqyang
2016/03/01 01:18:52
Done.
| |
| 130 {"mp3", MimeUtil::MP3}, | 138 {"mp3", MimeUtil::MP3}, |
| 131 {"mp4a.66", MimeUtil::MPEG2_AAC_MAIN}, | 139 {"mp4a.66", MimeUtil::MPEG2_AAC_MAIN}, |
| 132 {"mp4a.67", MimeUtil::MPEG2_AAC_LC}, | 140 {"mp4a.67", MimeUtil::MPEG2_AAC_LC}, |
| 133 {"mp4a.68", MimeUtil::MPEG2_AAC_SSR}, | 141 {"mp4a.68", MimeUtil::MPEG2_AAC_SSR}, |
| 134 {"mp4a.69", MimeUtil::MP3}, | 142 {"mp4a.69", MimeUtil::MP3}, |
| 135 {"mp4a.6B", MimeUtil::MP3}, | 143 {"mp4a.6B", MimeUtil::MP3}, |
| 136 {"mp4a.40.2", MimeUtil::MPEG4_AAC_LC}, | 144 {"mp4a.40.2", MimeUtil::MPEG4_AAC_LC}, |
| 137 {"mp4a.40.02", MimeUtil::MPEG4_AAC_LC}, | 145 {"mp4a.40.02", MimeUtil::MPEG4_AAC_LC}, |
| 138 {"mp4a.40.5", MimeUtil::MPEG4_AAC_SBR_v1}, | 146 {"mp4a.40.5", MimeUtil::MPEG4_AAC_SBR_v1}, |
| 139 {"mp4a.40.05", MimeUtil::MPEG4_AAC_SBR_v1}, | 147 {"mp4a.40.05", MimeUtil::MPEG4_AAC_SBR_v1}, |
| 140 {"mp4a.40.29", MimeUtil::MPEG4_AAC_SBR_PS_v2}, | 148 {"mp4a.40.29", MimeUtil::MPEG4_AAC_SBR_PS_v2}, |
| 141 #if BUILDFLAG(ENABLE_AC3_EAC3_AUDIO_DEMUXING) | 149 #if BUILDFLAG(ENABLE_AC3_EAC3_AUDIO_DEMUXING) |
| 142 // TODO(servolk): Strictly speaking only mp4a.A5 and mp4a.A6 codec ids are | 150 // TODO(servolk): Strictly speaking only mp4a.A5 and mp4a.A6 codec ids are |
| 143 // valid according to RFC 6381 section 3.3, 3.4. Lower-case oti (mp4a.a5 and | 151 // valid according to RFC 6381 section 3.3, 3.4. Lower-case oti (mp4a.a5 and |
| 144 // mp4a.a6) should be rejected. But we used to allow those in older versions | 152 // mp4a.a6) should be rejected. But we used to allow those in older versions |
| 145 // of Chromecast firmware and some apps (notably MPL) depend on those codec | 153 // of Chromecast firmware and some apps (notably MPL) depend on those codec |
| 146 // types being supported, so they should be allowed for now | 154 // types being supported, so they should be allowed for now |
| 147 // (crbug.com/564960). | 155 // (crbug.com/564960). |
| 148 {"ac-3", MimeUtil::AC3}, | 156 {"ac-3", MimeUtil::AC3}, |
| 149 {"mp4a.a5", MimeUtil::AC3}, | 157 {"mp4a.a5", MimeUtil::AC3}, |
| 150 {"mp4a.A5", MimeUtil::AC3}, | 158 {"mp4a.A5", MimeUtil::AC3}, |
| 151 {"ec-3", MimeUtil::EAC3}, | 159 {"ec-3", MimeUtil::EAC3}, |
| 152 {"mp4a.a6", MimeUtil::EAC3}, | 160 {"mp4a.a6", MimeUtil::EAC3}, |
| 153 {"mp4a.A6", MimeUtil::EAC3}, | 161 {"mp4a.A6", MimeUtil::EAC3}, |
| 154 #endif | 162 #endif |
| 155 {"vorbis", MimeUtil::VORBIS}, | 163 {"vorbis", MimeUtil::VORBIS}, |
| 156 {"opus", MimeUtil::OPUS}, | 164 {"opus", MimeUtil::OPUS}, |
| 157 {"vp8", MimeUtil::VP8}, | 165 {"vp8", MimeUtil::VP8}, |
| 158 {"vp8.0", MimeUtil::VP8}, | 166 {"vp8.0", MimeUtil::VP8}, |
| 159 {"vp9", MimeUtil::VP9}, | 167 {"vp9", MimeUtil::VP9}, |
|
ddorwin
2016/02/29 23:57:34
As discussed, you may want to remove these and rel
kqyang
2016/03/01 01:18:52
Done.
| |
| 160 {"vp9.0", MimeUtil::VP9}, | 168 {"vp9.0", MimeUtil::VP9}, |
| 161 {"theora", MimeUtil::THEORA}}; | 169 {"theora", MimeUtil::THEORA}}; |
| 162 | 170 |
| 163 // List of codec IDs that are ambiguous and don't provide | 171 // List of codec IDs that are ambiguous and don't provide |
| 164 // enough information to determine the codec and profile. | 172 // enough information to determine the codec and profile. |
| 165 // The codec in these entries indicate the codec and profile | 173 // The codec in these entries indicate the codec and profile |
| 166 // we assume the user is trying to indicate. | 174 // we assume the user is trying to indicate. |
| 167 static const CodecIDMappings kAmbiguousCodecStringMap[] = { | 175 static const CodecIDMappings kAmbiguousCodecStringMap[] = { |
| 168 {"mp4a.40", MimeUtil::MPEG4_AAC_LC}, | 176 {"mp4a.40", MimeUtil::MPEG4_AAC_LC}, |
| 169 {"avc1", MimeUtil::H264}, | 177 {"avc1", MimeUtil::H264}, |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 260 *is_ambiguous = false; | 268 *is_ambiguous = false; |
| 261 } | 269 } |
| 262 | 270 |
| 263 return true; | 271 return true; |
| 264 } | 272 } |
| 265 | 273 |
| 266 return false; | 274 return false; |
| 267 } | 275 } |
| 268 #endif | 276 #endif |
| 269 | 277 |
| 278 #if BUILDFLAG(ENABLE_MP4_VP9_DEMUXING) | |
| 279 // Handle parsing of vp9 codec IDs. | |
| 280 static bool ParseVp9CodecID(const std::string& codec_id, | |
| 281 MimeUtil::Codec* codec, | |
| 282 bool* is_ambiguous) { | |
|
ddorwin
2016/03/01 00:21:40
Since there are no ambiguous VPx strings (ignoring
kqyang
2016/03/01 01:18:52
Done.
| |
| 283 std::vector<std::string> fields = base::SplitString( | |
| 284 codec_id, ".", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL); | |
| 285 if (fields.size() < 1) | |
| 286 return false; | |
| 287 | |
| 288 if (fields[0] == "vp09") { | |
| 289 *codec = MimeUtil::VP9; | |
| 290 } else { | |
| 291 return false; | |
| 292 } | |
| 293 | |
| 294 if (fields.size() > 8) | |
| 295 return false; | |
| 296 | |
| 297 std::vector<int> values; | |
| 298 for (size_t i = 1; i < fields.size(); ++i) { | |
| 299 // Missing value is not allowed. | |
| 300 if (fields[i] == "") | |
| 301 return false; | |
| 302 int value; | |
| 303 if (!base::StringToInt(fields[i], &value)) | |
| 304 return false; | |
| 305 if (value < 0) | |
| 306 return false; | |
| 307 values.push_back(value); | |
| 308 } | |
| 309 | |
| 310 // The spec specifies 8 fields (7 values excluding the first codec field). | |
| 311 // We do not allow missing fields. | |
| 312 if (values.size() < 7) | |
| 313 return false; | |
| 314 | |
| 315 const int profile = values[0]; | |
| 316 if (profile > 3) | |
|
ddorwin
2016/02/29 23:57:34
We'll need to actually check whether platform supp
| |
| 317 return false; | |
| 318 | |
| 319 const int bit_depth = values[2]; | |
| 320 if (bit_depth != 8 && bit_depth != 10 && bit_depth != 12) | |
| 321 return false; | |
| 322 | |
| 323 const int color_space = values[3]; | |
| 324 if (color_space > 7) | |
| 325 return false; | |
| 326 | |
| 327 const int chroma_subsampling = values[4]; | |
| 328 if (chroma_subsampling > 3) | |
| 329 return false; | |
| 330 | |
| 331 const int transfer_function = values[5]; | |
| 332 if (transfer_function > 1) | |
| 333 return false; | |
| 334 | |
| 335 const int video_full_range_flag = values[6]; | |
| 336 if (video_full_range_flag > 1) | |
| 337 return false; | |
| 338 | |
| 339 *is_ambiguous = false; | |
| 340 return true; | |
| 341 } | |
| 342 #endif // #if BUILDFLAG(ENABLE_MP4_VP9_DEMUXING) | |
| 343 | |
| 270 MimeUtil::MimeUtil() : allow_proprietary_codecs_(false) { | 344 MimeUtil::MimeUtil() : allow_proprietary_codecs_(false) { |
| 271 #if defined(OS_ANDROID) | 345 #if defined(OS_ANDROID) |
| 272 platform_info_.is_unified_media_pipeline_enabled = | 346 platform_info_.is_unified_media_pipeline_enabled = |
| 273 IsUnifiedMediaPipelineEnabled(); | 347 IsUnifiedMediaPipelineEnabled(); |
| 274 // When the unified media pipeline is enabled, we need support for both GPU | 348 // When the unified media pipeline is enabled, we need support for both GPU |
| 275 // video decoders and MediaCodec; indicated by HasPlatformDecoderSupport(). | 349 // video decoders and MediaCodec; indicated by HasPlatformDecoderSupport(). |
| 276 // When the Android pipeline is used, we only need access to MediaCodec. | 350 // When the Android pipeline is used, we only need access to MediaCodec. |
| 277 platform_info_.has_platform_decoders = | 351 platform_info_.has_platform_decoders = |
| 278 platform_info_.is_unified_media_pipeline_enabled | 352 platform_info_.is_unified_media_pipeline_enabled |
| 279 ? HasPlatformDecoderSupport() | 353 ? HasPlatformDecoderSupport() |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 302 bool is_ambiguous = true; | 376 bool is_ambiguous = true; |
| 303 Codec codec = INVALID_CODEC; | 377 Codec codec = INVALID_CODEC; |
| 304 if (!StringToCodec(codecs[i], &codec, &is_ambiguous)) | 378 if (!StringToCodec(codecs[i], &codec, &is_ambiguous)) |
| 305 return IsNotSupported; | 379 return IsNotSupported; |
| 306 | 380 |
| 307 if (!IsCodecSupported(codec, mime_type_lower_case, is_encrypted) || | 381 if (!IsCodecSupported(codec, mime_type_lower_case, is_encrypted) || |
| 308 supported_codecs.find(codec) == supported_codecs.end()) { | 382 supported_codecs.find(codec) == supported_codecs.end()) { |
| 309 return IsNotSupported; | 383 return IsNotSupported; |
| 310 } | 384 } |
| 311 | 385 |
| 386 #if BUILDFLAG(ENABLE_MP4_VP9_DEMUXING) | |
| 387 // VP9 is supported in mp4, but the old style codec string is not supported. | |
| 388 if ((mime_type_lower_case == "video/x-m4v" || | |
| 389 mime_type_lower_case == "video/mp4") && | |
| 390 codec == MimeUtil::VP9) { | |
|
ddorwin
2016/03/01 00:21:40
Check the enum first.
As we discussed, should be m
kqyang
2016/03/01 01:18:52
No longer needed. Removed.
| |
| 391 if (!ParseVp9CodecID(codecs[i], &codec, &is_ambiguous)) | |
| 392 return IsNotSupported; | |
| 393 } | |
| 394 #endif | |
| 395 | |
| 312 if (is_ambiguous) | 396 if (is_ambiguous) |
| 313 result = MayBeSupported; | 397 result = MayBeSupported; |
| 314 } | 398 } |
| 315 | 399 |
| 316 return result; | 400 return result; |
| 317 } | 401 } |
| 318 | 402 |
| 319 void MimeUtil::InitializeMimeTypeMaps() { | 403 void MimeUtil::InitializeMimeTypeMaps() { |
| 320 // Initialize the supported media types. | 404 // Initialize the supported media types. |
| 321 #if defined(USE_PROPRIETARY_CODECS) | 405 #if defined(USE_PROPRIETARY_CODECS) |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 545 return true; | 629 return true; |
| 546 | 630 |
| 547 // Otherwise, platform support is required. | 631 // Otherwise, platform support is required. |
| 548 return platform_info.supports_vp9; | 632 return platform_info.supports_vp9; |
| 549 } | 633 } |
| 550 } | 634 } |
| 551 | 635 |
| 552 return false; | 636 return false; |
| 553 } | 637 } |
| 554 | 638 |
| 555 bool MimeUtil::StringToCodec(const std::string& codec_id, | 639 bool MimeUtil::StringToCodec(const std::string& codec_id, |
|
ddorwin
2016/03/01 00:21:40
This is no longer a simple conversion. I think we
kqyang
2016/03/01 01:18:52
Unfortunately ParseCodecString is already taken.
ddorwin
2016/03/02 00:58:21
Okay, I'll work on this.
| |
| 556 Codec* codec, | 640 Codec* codec, |
|
ddorwin
2016/03/01 00:21:40
When we add platform checks, we'll either need to
kqyang
2016/03/01 01:18:52
Another option is to define different Codec enums
ddorwin
2016/03/02 00:58:21
Yes, but I think we want to avoid that in general
| |
| 557 bool* is_ambiguous) const { | 641 bool* is_ambiguous) const { |
| 558 StringToCodecMappings::const_iterator itr = | 642 StringToCodecMappings::const_iterator itr = |
| 559 string_to_codec_map_.find(codec_id); | 643 string_to_codec_map_.find(codec_id); |
| 560 if (itr != string_to_codec_map_.end()) { | 644 if (itr != string_to_codec_map_.end()) { |
| 561 *codec = itr->second.codec; | 645 *codec = itr->second.codec; |
|
ddorwin
2016/02/29 23:57:34
// Exact match. No further parsing necessary.
| |
| 562 *is_ambiguous = itr->second.is_ambiguous; | 646 *is_ambiguous = itr->second.is_ambiguous; |
| 563 return true; | 647 return true; |
| 564 } | 648 } |
| 565 | 649 |
| 566 // If |codec_id| is not in |string_to_codec_map_|, then we assume that it is | 650 // If |codec_id| is not in |string_to_codec_map_|, then we assume that it is |
| 567 // either H.264 or HEVC/H.265 codec ID because currently those are the only | 651 // either H.264 or HEVC/H.265 codec ID because currently those are the only |
| 568 // ones that are not added to the |string_to_codec_map_| and require parsing. | 652 // ones that are not added to the |string_to_codec_map_| and require parsing. |
| 569 | 653 |
| 570 #if BUILDFLAG(ENABLE_HEVC_DEMUXING) | 654 #if BUILDFLAG(ENABLE_HEVC_DEMUXING) |
| 571 if (ParseHEVCCodecID(codec_id, codec, is_ambiguous)) { | 655 if (ParseHEVCCodecID(codec_id, codec, is_ambiguous)) { |
| 572 return true; | 656 return true; |
| 573 } | 657 } |
| 574 #endif | 658 #endif |
| 575 | 659 |
| 576 VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN; | 660 VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN; |
| 577 uint8_t level_idc = 0; | 661 uint8_t level_idc = 0; |
| 578 if (ParseAVCCodecId(codec_id, &profile, &level_idc)) { | 662 if (ParseAVCCodecId(codec_id, &profile, &level_idc)) { |
| 579 *codec = MimeUtil::H264; | 663 *codec = MimeUtil::H264; |
| 580 *is_ambiguous = | 664 *is_ambiguous = |
| 581 (profile != H264PROFILE_BASELINE && profile != H264PROFILE_MAIN && | 665 (profile != H264PROFILE_BASELINE && profile != H264PROFILE_MAIN && |
| 582 profile != H264PROFILE_HIGH) || | 666 profile != H264PROFILE_HIGH) || |
| 583 !IsValidH264Level(level_idc); | 667 !IsValidH264Level(level_idc); |
| 584 return true; | 668 return true; |
| 585 } | 669 } |
| 586 | 670 |
| 671 #if BUILDFLAG(ENABLE_MP4_VP9_DEMUXING) | |
| 672 if (ParseVp9CodecID(codec_id, codec, is_ambiguous)) { | |
| 673 return true; | |
| 674 } | |
| 675 #endif | |
| 676 | |
| 587 DVLOG(4) << __FUNCTION__ << ": Unrecognized codec id " << codec_id; | 677 DVLOG(4) << __FUNCTION__ << ": Unrecognized codec id " << codec_id; |
| 588 return false; | 678 return false; |
| 589 } | 679 } |
| 590 | 680 |
| 591 bool MimeUtil::IsCodecSupported(Codec codec, | 681 bool MimeUtil::IsCodecSupported(Codec codec, |
| 592 const std::string& mime_type_lower_case, | 682 const std::string& mime_type_lower_case, |
| 593 bool is_encrypted) const { | 683 bool is_encrypted) const { |
| 594 DCHECK_NE(codec, INVALID_CODEC); | 684 DCHECK_NE(codec, INVALID_CODEC); |
| 595 | 685 |
| 596 #if defined(OS_ANDROID) | 686 #if defined(OS_ANDROID) |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 652 const std::string& mime_type_lower_case, | 742 const std::string& mime_type_lower_case, |
| 653 bool is_encrypted) const { | 743 bool is_encrypted) const { |
| 654 Codec default_codec = Codec::INVALID_CODEC; | 744 Codec default_codec = Codec::INVALID_CODEC; |
| 655 if (!GetDefaultCodecLowerCase(mime_type_lower_case, &default_codec)) | 745 if (!GetDefaultCodecLowerCase(mime_type_lower_case, &default_codec)) |
| 656 return false; | 746 return false; |
| 657 return IsCodecSupported(default_codec, mime_type_lower_case, is_encrypted); | 747 return IsCodecSupported(default_codec, mime_type_lower_case, is_encrypted); |
| 658 } | 748 } |
| 659 | 749 |
| 660 } // namespace internal | 750 } // namespace internal |
| 661 } // namespace media | 751 } // namespace media |
| OLD | NEW |