Bug 1143278 - Make gmp-clearkey not require a Win8 only DLL to decode audio on Win7. r=edwin

This commit is contained in:
Chris Pearce 2015-03-15 11:30:24 +13:00
parent 445ec59b3c
commit 5f79cf4a0e
3 changed files with 34 additions and 4 deletions

View File

@ -51,10 +51,38 @@ CDMCaps::AutoLock::~AutoLock()
mData.Unlock();
}
#ifdef PR_LOGGING
static void
TestCap(uint64_t aFlag,
uint64_t aCaps,
const nsACString& aCapName,
nsACString& aCapStr)
{
if (!(aFlag & aCaps)) {
return;
}
if (!aCapStr.IsEmpty()) {
aCapStr.AppendLiteral(",");
}
aCapStr.Append(aCapName);
}
nsCString
CapsToString(uint64_t aCaps)
{
nsCString capsStr;
TestCap(GMP_EME_CAP_DECRYPT_AUDIO, aCaps, NS_LITERAL_CSTRING("DecryptAudio"), capsStr);
TestCap(GMP_EME_CAP_DECRYPT_VIDEO, aCaps, NS_LITERAL_CSTRING("DecryptVideo"), capsStr);
TestCap(GMP_EME_CAP_DECRYPT_AND_DECODE_AUDIO, aCaps, NS_LITERAL_CSTRING("DecryptAndDecodeAudio"), capsStr);
TestCap(GMP_EME_CAP_DECRYPT_AND_DECODE_VIDEO, aCaps, NS_LITERAL_CSTRING("DecryptAndDecodeVideo"), capsStr);
return capsStr;
}
#endif // PR_LOGGING
void
CDMCaps::AutoLock::SetCaps(uint64_t aCaps)
{
EME_LOG("SetCaps()");
EME_LOG("SetCaps() %s", CapsToString(aCaps).get());
mData.mMonitor.AssertCurrentThreadOwns();
mData.mCaps = aCaps;
for (size_t i = 0; i < mData.mWaitForCaps.Length(); i++) {

View File

@ -99,7 +99,7 @@ typedef int64_t GMPTimestamp;
//
// Note: Gecko does not currently support the caps changing at runtime.
// Set them once per plugin initialization, during the startup of
// the GMPdecryptor.
// the GMPDecryptor.
// Capability; CDM can decrypt encrypted buffers and return still
// compressed buffers back to Gecko for decompression there.

View File

@ -73,9 +73,11 @@ EnsureLibs()
static bool sInitDone = false;
static bool sInitOk = false;
if (!sInitDone) {
// Note: For AAC decoding, we need to use msauddecmft.dll on Win8,
// and msmpeg2adec.dll on earlier Windows. So if we have at least
// one of these, assume we can decode.
sInitOk = LinkMfplat() &&
!!GetModuleHandleA("msauddecmft.dll") &&
!!GetModuleHandleA("msmpeg2adec.dll") &&
(!!GetModuleHandleA("msauddecmft.dll") || !!GetModuleHandleA("msmpeg2adec.dll")) &&
!!GetModuleHandleA("msmpeg2vdec.dll");
sInitDone = true;
}