Bug 1245789 - Reject MediaKeys requests for Widevine if we don't have a platform AAC decoder. r=gerald

The Widevine CDM does not have an AAC decoder. It can however decrypt audio
streams. It's our policy to not decode AAC streams decrypted by the Widevine
CDM with the Adobe GMP's unencrypted decoding functionality. So reject
MediaKeySystemAccess requests for Widevine if we don't have a system AAC
decoder that we can use.

MozReview-Commit-ID: Ltq52wT1qno
This commit is contained in:
Chris Pearce 2016-04-12 16:12:22 +12:00
Родитель 2c831f28f4
Коммит a7ef15b6b8
2 изменённых файлов: 26 добавлений и 7 удалений

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

@ -14,6 +14,7 @@
#endif
#ifdef XP_WIN
#include "mozilla/WindowsVersion.h"
#include "WMFDecoderModule.h"
#endif
#ifdef XP_MACOSX
#include "nsCocoaFeatures.h"
@ -381,6 +382,14 @@ GMPDecryptsAndGeckoDecodesAAC(mozIGeckoMediaPluginService* aGMPService,
NS_ConvertUTF16toUTF8(aKeySystem),
NS_LITERAL_CSTRING(GMP_API_AUDIO_DECODER),
NS_LITERAL_CSTRING("aac")) &&
#if defined(MOZ_WIDEVINE_EME) && defined(XP_WIN)
// Widevine CDM doesn't include an AAC decoder. So if WMF can't
// decode AAC, and a codec wasn't specified, be conservative
// and reject the MediaKeys request, since our policy is to prevent
// the Adobe GMP's unencrypted AAC decoding path being used to
// decode content decrypted by the Widevine CDM.
(!aKeySystem.EqualsLiteral("com.widevine.alpha") || WMFDecoderModule::HasAAC()) &&
#endif
MP4Decoder::CanHandleMediaType(aContentType);
}
@ -439,7 +448,11 @@ IsSupportedInitDataType(const nsString& aCandidate, const nsAString& aKeySystem)
// All supported keySystems can handle "cenc" initDataType.
// ClearKey also supports "keyids" and "webm" initDataTypes.
return aCandidate.EqualsLiteral("cenc") ||
(aKeySystem.EqualsLiteral("org.w3.clearkey") &&
((aKeySystem.EqualsLiteral("org.w3.clearkey")
#ifdef MOZ_WIDEVINE_EME
|| aKeySystem.EqualsLiteral("com.widevine.alpha")
#endif
) &&
(aCandidate.EqualsLiteral("keyids") || aCandidate.EqualsLiteral("webm)")));
}
@ -491,6 +504,17 @@ GetSupportedConfig(mozIGeckoMediaPluginService* aGMPService,
config.mVideoCapabilities.Value().Assign(caps);
}
#if defined(MOZ_WIDEVINE_EME) && defined(XP_WIN)
// Widevine CDM doesn't include an AAC decoder. So if WMF can't decode AAC,
// and a codec wasn't specified, be conservative and reject the MediaKeys request.
if (aKeySystem.EqualsLiteral("com.widevine.alpha") &&
(!aCandidate.mAudioCapabilities.WasPassed() ||
!aCandidate.mVideoCapabilities.WasPassed()) &&
!WMFDecoderModule::HasAAC()) {
return false;
}
#endif
aOutConfig = config;
return true;

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

@ -953,11 +953,6 @@ GMPParent::ParseChromiumManifest(nsString aJSON)
mDescription = NS_ConvertUTF16toUTF8(m.mDescription);
mVersion = NS_ConvertUTF16toUTF8(m.mVersion);
GMPCapability audio(NS_LITERAL_CSTRING(GMP_API_AUDIO_DECODER));
audio.mAPITags.AppendElement(NS_LITERAL_CSTRING("aac"));
audio.mAPITags.AppendElement(NS_LITERAL_CSTRING("com.widevine.alpha"));
mCapabilities.AppendElement(Move(audio));
GMPCapability video(NS_LITERAL_CSTRING(GMP_API_VIDEO_DECODER));
video.mAPITags.AppendElement(NS_LITERAL_CSTRING("h264"));
video.mAPITags.AppendElement(NS_LITERAL_CSTRING("com.widevine.alpha"));