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

Unified Diff: media/base/mime_util_internal.cc

Issue 1896983004: Rename misleading |is_ambiguous| parameter Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update VP9 comment to match Created 4 years, 8 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
« no previous file with comments | « media/base/mime_util_internal.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/mime_util_internal.cc
diff --git a/media/base/mime_util_internal.cc b/media/base/mime_util_internal.cc
index 02e2ab3ee0f05ce2b14f164cb6f1b72675f9b03c..ab828263ca85ae7ebcc40728b610b5f70b840b86 100644
--- a/media/base/mime_util_internal.cc
+++ b/media/base/mime_util_internal.cc
@@ -31,9 +31,9 @@ struct CodecIDMappings {
// The "mp4a" strings come from RFC 6381.
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 ParseAVCCodecId().
- // hev1/hvc1.XXXXXX may be unambiguous; handled by ParseHEVCCodecID().
- // vp9, vp9.0, vp09.xx.xx.xx.xx.xx.xx.xx may be unambiguous; handled by
+ // avc1/avc3.XXXXXX is handled by ParseAVCCodecId().
+ // hev1/hvc1.XXXXXX is handled by ParseHEVCCodecID().
+ // vp8, vp8.0, vp9, vp9.0, and vp09.xx.xx.xx.xx.xx.xx.xx are handled by
kqyang 2016/04/21 00:59:48 vp8, vp8.0 are still handled in this map; only vp9
ddorwin 2016/04/21 02:09:50 Done. Thanks.
// ParseVp9CodecID().
{"mp3", MimeUtil::MP3},
// Following is the list of RFC 6381 compliant audio codec strings:
@@ -86,7 +86,6 @@ static const CodecIDMappings kAmbiguousCodecStringMap[] = {
{"mp4a.40", MimeUtil::MPEG4_AAC},
{"avc1", MimeUtil::H264},
{"avc3", MimeUtil::H264},
- // avc1/avc3.XXXXXX may be ambiguous; handled by ParseAVCCodecId().
};
#if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER)
@@ -158,26 +157,14 @@ static bool IsValidH264Level(uint8_t level_idc) {
// crbug.com/482761
static bool ParseHEVCCodecID(const std::string& codec_id,
MimeUtil::Codec* codec,
- bool* is_ambiguous) {
+ bool* is_known_supported) {
if (base::StartsWith(codec_id, "hev1.", base::CompareCase::SENSITIVE) ||
base::StartsWith(codec_id, "hvc1.", base::CompareCase::SENSITIVE)) {
*codec = MimeUtil::HEVC_MAIN;
// TODO(servolk): Full HEVC codec id parsing is not implemented yet (see
- // crbug.com/482761). So treat HEVC codec ids as ambiguous for now.
- *is_ambiguous = true;
-
- // TODO(servolk): Most HEVC codec ids are treated as ambiguous (see above),
- // but we need to recognize at least one valid unambiguous HEVC codec id,
- // which is added into kMP4VideoCodecsExpression. We need it to be
- // unambiguous to avoid DCHECK(!is_ambiguous) in InitializeMimeTypeMaps. We
- // also use these in unit tests (see
- // content/browser/media/media_canplaytype_browsertest.cc).
- // Remove this workaround after crbug.com/482761 is fixed.
- if (codec_id == "hev1.1.6.L93.B0" || codec_id == "hvc1.1.6.L93.B0") {
- *is_ambiguous = false;
- }
-
+ // crbug.com/482761). So treat HEVC as not known supported for now.
+ *is_known_supported = false;
return true;
}
@@ -306,10 +293,10 @@ SupportsType MimeUtil::AreSupportedCodecs(
SupportsType result = IsSupported;
for (size_t i = 0; i < codecs.size(); ++i) {
- bool is_ambiguous = true;
+ bool is_known_supported = false;
Codec codec = INVALID_CODEC;
- if (!StringToCodec(mime_type_lower_case, codecs[i], &codec, &is_ambiguous,
- is_encrypted)) {
+ if (!StringToCodec(mime_type_lower_case, codecs[i], &codec,
+ &is_known_supported, is_encrypted)) {
return IsNotSupported;
}
@@ -318,7 +305,7 @@ SupportsType MimeUtil::AreSupportedCodecs(
return IsNotSupported;
}
- if (is_ambiguous)
+ if (!is_known_supported)
result = MayBeSupported;
}
@@ -669,13 +656,13 @@ bool MimeUtil::IsCodecSupportedOnPlatform(
bool MimeUtil::StringToCodec(const std::string& mime_type_lower_case,
const std::string& codec_id,
Codec* codec,
- bool* is_ambiguous,
+ bool* is_known_supported,
bool is_encrypted) const {
StringToCodecMappings::const_iterator itr =
string_to_codec_map_.find(codec_id);
if (itr != string_to_codec_map_.end()) {
*codec = itr->second.codec;
- *is_ambiguous = itr->second.is_ambiguous;
+ *is_known_supported = !itr->second.is_ambiguous;
return true;
}
@@ -684,7 +671,7 @@ bool MimeUtil::StringToCodec(const std::string& mime_type_lower_case,
// ones that are not added to the |string_to_codec_map_| and require parsing.
#if BUILDFLAG(ENABLE_HEVC_DEMUXING)
- if (ParseHEVCCodecID(codec_id, codec, is_ambiguous)) {
+ if (ParseHEVCCodecID(codec_id, codec, is_known_supported)) {
return true;
}
#endif
@@ -701,7 +688,7 @@ bool MimeUtil::StringToCodec(const std::string& mime_type_lower_case,
if (is_encrypted) {
// FFmpeg is not generally used for encrypted videos, so we do not
// know whether 10-bit is supported.
- *is_ambiguous = true;
+ *is_known_supported = false;
break;
}
// Fall through.
@@ -710,10 +697,10 @@ bool MimeUtil::StringToCodec(const std::string& mime_type_lower_case,
case H264PROFILE_BASELINE:
case H264PROFILE_MAIN:
case H264PROFILE_HIGH:
- *is_ambiguous = !IsValidH264Level(level_idc);
+ *is_known_supported = IsValidH264Level(level_idc);
break;
default:
- *is_ambiguous = true;
+ *is_known_supported = false;
}
return true;
}
@@ -723,13 +710,13 @@ bool MimeUtil::StringToCodec(const std::string& mime_type_lower_case,
switch (profile) {
case VP9PROFILE_PROFILE0:
// Profile 0 should always be supported if VP9 is supported.
- *is_ambiguous = false;
+ *is_known_supported = true;
break;
default:
// We don't know if the underlying platform supports these profiles.
// Need to add platform level querying to get supported profiles
// (crbug/604566).
- *is_ambiguous = true;
+ *is_known_supported = false;
}
return true;
}
« no previous file with comments | « media/base/mime_util_internal.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698