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

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: 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
« media/base/mime_util_internal.h ('K') | « 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 7a26254f54d24a6d034a40143222be3ed232835e..4ff7d31836a3db04ce805cc486d056e3e205b033 100644
--- a/media/base/mime_util_internal.cc
+++ b/media/base/mime_util_internal.cc
@@ -31,8 +31,8 @@ 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().
+ // avc1/avc3.XXXXXX is handled by ParseAVCCodecId().
+ // hev1/hvc1.XXXXXX is handled by ParseHEVCCodecID().
ddorwin 2016/04/18 23:43:37 Oops - fixed locally.
ddorwin 2016/04/21 00:50:30 Done.
{"mp3", MimeUtil::MP3},
// Following is the list of RFC 6381 compliant audio codec strings:
// mp4a.66 - MPEG-2 AAC MAIN
@@ -158,26 +158,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),
ddorwin 2016/04/18 23:43:37 This should have been removed in https://coderevie
ddorwin 2016/04/21 19:10:09 But, it was still affecting the output, which thes
- // 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;
}
@@ -215,9 +203,9 @@ 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(codecs[i], &codec, &is_ambiguous, is_encrypted))
+ if (!StringToCodec(codecs[i], &codec, &is_known_supported, is_encrypted))
return IsNotSupported;
if (!IsCodecSupported(codec, mime_type_lower_case, is_encrypted) ||
@@ -225,7 +213,7 @@ SupportsType MimeUtil::AreSupportedCodecs(
return IsNotSupported;
}
- if (is_ambiguous)
+ if (!is_known_supported)
result = MayBeSupported;
}
@@ -563,13 +551,13 @@ bool MimeUtil::IsCodecSupportedOnPlatform(
bool MimeUtil::StringToCodec(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;
}
@@ -578,7 +566,7 @@ bool MimeUtil::StringToCodec(const std::string& codec_id,
// 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
@@ -595,7 +583,7 @@ bool MimeUtil::StringToCodec(const std::string& codec_id,
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.
@@ -604,10 +592,10 @@ bool MimeUtil::StringToCodec(const std::string& codec_id,
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;
}
« media/base/mime_util_internal.h ('K') | « media/base/mime_util_internal.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698