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

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 out of date comment 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 fb3f627803b9ead9e5dfe53e0c090d24367550f3..a0433c724457f43f172b88d1f4b9f06f6fc1f641 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().
+ // vp9, vp9.0, and vp09.xx.xx.xx.xx.xx.xx.xx are handled by
// 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)
@@ -270,10 +269,10 @@ SupportsType MimeUtil::AreSupportedCodecs(
SupportsType result = IsSupported;
for (size_t i = 0; i < codecs.size(); ++i) {
- bool is_ambiguous = true;
+ bool is_probably_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_probably_supported, is_encrypted)) {
return IsNotSupported;
}
@@ -282,7 +281,7 @@ SupportsType MimeUtil::AreSupportedCodecs(
return IsNotSupported;
}
- if (is_ambiguous)
+ if (!is_probably_supported)
result = MayBeSupported;
}
@@ -633,19 +632,18 @@ 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_probably_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_probably_supported = !itr->second.is_ambiguous;
return true;
}
-// If |codec_id| is not in |string_to_codec_map_|, then we assume that it is
-// either H.264 or HEVC/H.265 codec ID because currently those are the only
-// ones that are not added to the |string_to_codec_map_| and require parsing.
+ // If |codec_id| is not in |string_to_codec_map_|, it may be handled by one
+ // of the Parse*CodecId() functions.
VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN;
uint8_t level_idc = 0;
@@ -659,7 +657,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_probably_supported = false;
break;
}
// Fall through.
@@ -668,10 +666,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_probably_supported = IsValidH264Level(level_idc);
break;
default:
- *is_ambiguous = true;
+ *is_probably_supported = false;
}
return true;
}
@@ -681,24 +679,24 @@ 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_probably_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_probably_supported = false;
}
return true;
}
#if BUILDFLAG(ENABLE_HEVC_DEMUXING)
if (ParseHEVCCodecId(codec_id, &profile, &level_idc)) {
- // TODO(servolk): Set |is_ambiguous| to true for now to make CanPlayType
+ // TODO(servolk): Set |is_probably_supported| to false for now to
// return 'maybe' for HEVC codec ids, instead of probably. This needs to be
- // changed to false after adding platform-level HEVC profile and level
+ // changed to true after adding platform-level HEVC profile and level
// checks, see crbug.com/601949.
- *is_ambiguous = true;
+ *is_probably_supported = false;
*codec = MimeUtil::HEVC;
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