Bug 1601813 - Parse av01 codec when parsing Widevine manifests. r=dminor

This lets us load Widevine versions that support av1. This doesn't add encrypted
av1 support, but is one of the steps needed to do so.

This adds some comments to better clarify the string literals found in the code
being updated.

Differential Revision: https://phabricator.services.mozilla.com/D56100

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Bryce Seager van Dyk 2019-12-06 20:34:45 +00:00
Родитель cb13cb47be
Коммит f03d58abea
1 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -726,6 +726,15 @@ RefPtr<GenericPromise> GMPParent::ParseChromiumManifest(
nsTArray<nsCString> codecs; nsTArray<nsCString> codecs;
SplitAt(",", codecsString, codecs); SplitAt(",", codecsString, codecs);
// Parse the codec strings in the manifest and map them to strings used
// internally by Gecko for capability recognition.
//
// Google's code to parse manifests can be used as a reference for strings
// the manifest may contain
// https://cs.chromium.org/chromium/src/chrome/common/media/cdm_manifest.cc?l=73&rcl=393e60bfc2299449db7ef374c0ef1c324716e562
//
// Gecko's internal strings can be found at
// https://searchfox.org/mozilla-central/rev/ea63a0888d406fae720cf24f4727d87569a8cab5/dom/media/eme/MediaKeySystemAccess.cpp#149-155
for (const nsCString& chromiumCodec : codecs) { for (const nsCString& chromiumCodec : codecs) {
nsCString codec; nsCString codec;
if (chromiumCodec.EqualsASCII("vp8")) { if (chromiumCodec.EqualsASCII("vp8")) {
@ -734,6 +743,8 @@ RefPtr<GenericPromise> GMPParent::ParseChromiumManifest(
codec = NS_LITERAL_CSTRING("vp9"); codec = NS_LITERAL_CSTRING("vp9");
} else if (chromiumCodec.EqualsASCII("avc1")) { } else if (chromiumCodec.EqualsASCII("avc1")) {
codec = NS_LITERAL_CSTRING("h264"); codec = NS_LITERAL_CSTRING("h264");
} else if (chromiumCodec.EqualsASCII("av01")) {
codec = NS_LITERAL_CSTRING("av1");
} else { } else {
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__); return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
} }