Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(960)

Unified Diff: media/base/mime_util_internal.cc

Issue 1837963004: Make CanPlayType return "probably" for HI10P h264 videos. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/base/mime_util_internal.cc
diff --git a/media/base/mime_util_internal.cc b/media/base/mime_util_internal.cc
index b2904e8764d39bbc885ffed536481feb6cd3b7da..2f20de476bc31114d641ce55254f3749ee61d78f 100644
--- a/media/base/mime_util_internal.cc
+++ b/media/base/mime_util_internal.cc
@@ -281,7 +281,7 @@ SupportsType MimeUtil::AreSupportedCodecs(
for (size_t i = 0; i < codecs.size(); ++i) {
bool is_ambiguous = true;
Codec codec = INVALID_CODEC;
- if (!StringToCodec(codecs[i], &codec, &is_ambiguous))
+ if (!StringToCodec(codecs[i], &codec, &is_ambiguous, is_encrypted))
return IsNotSupported;
if (!IsCodecSupported(codec, mime_type_lower_case, is_encrypted) ||
@@ -322,7 +322,7 @@ void MimeUtil::InitializeMimeTypeMaps() {
for (size_t j = 0; j < mime_type_codecs.size(); ++j) {
Codec codec = INVALID_CODEC;
bool is_ambiguous = true;
- CHECK(StringToCodec(mime_type_codecs[j], &codec, &is_ambiguous));
+ CHECK(StringToCodec(mime_type_codecs[j], &codec, &is_ambiguous, false));
DCHECK(!is_ambiguous);
codecs.insert(codec);
}
@@ -531,7 +531,8 @@ bool MimeUtil::IsCodecSupportedOnPlatform(
bool MimeUtil::StringToCodec(const std::string& codec_id,
Codec* codec,
- bool* is_ambiguous) const {
+ bool* is_ambiguous,
+ bool is_encrypted) const {
StringToCodecMappings::const_iterator itr =
string_to_codec_map_.find(codec_id);
if (itr != string_to_codec_map_.end()) {
@@ -554,10 +555,28 @@ bool MimeUtil::StringToCodec(const std::string& codec_id,
uint8_t level_idc = 0;
if (ParseAVCCodecId(codec_id, &profile, &level_idc)) {
*codec = MimeUtil::H264;
- *is_ambiguous =
- (profile != H264PROFILE_BASELINE && profile != H264PROFILE_MAIN &&
- profile != H264PROFILE_HIGH) ||
- !IsValidH264Level(level_idc);
+ switch (profile) {
+// HIGH10PROFILE is supported through fallback to the ffmpeg decoder,
+// which is not available on Android, or if FFMPEG is not used.
ddorwin 2016/04/01 00:36:42 nit: remove this comma now
hubbe 2016/04/04 22:01:50 Done.
+#if !defined(MEDIA_DISABLE_FFMPEG) && !defined(OS_ANDROID)
+ case H264PROFILE_HIGH10PROFILE:
+ if (is_encrypted) {
+ // FFmpeg is not generally used for encrypted videos, so we do not
+ // know wheter 10-bit is supported.
ddorwin 2016/04/01 00:36:42 whether
hubbe 2016/04/04 22:01:50 Done.
+ *is_ambiguous = true;
+ break;
+ }
+// Fall through.
+#endif
+
+ case H264PROFILE_BASELINE:
+ case H264PROFILE_MAIN:
+ case H264PROFILE_HIGH:
+ *is_ambiguous = !IsValidH264Level(level_idc);
+ break;
+ default:
+ *is_ambiguous = true;
+ }
return true;
}

Powered by Google App Engine
This is Rietveld 408576698