Bug 1266336 - Check actual CDM creation - r=cpearce

Check the return result from Widevine's CDM creation function, and handle
failure.

MozReview-Commit-ID: HYvKgdK53aQ

--HG--
extra : rebase_source : b3e28ba5e0020e3a6dd77c8a83b58be233fdc770
This commit is contained in:
Gerald Squelart 2016-05-05 12:04:07 +10:00
parent 7a14964bfb
commit bb3afc2867

View File

@ -101,7 +101,7 @@ WidevineAdapter::GMPGetAPI(const char* aAPIName,
auto create = reinterpret_cast<decltype(::CreateCdmInstance)*>(
PR_FindFunctionSymbol(mLib, "CreateCdmInstance"));
if (!create) {
Log("WidevineAdapter::GMPGetAPI(%s, 0x%p, 0x%p) this=0x%p FAILED to create cdm",
Log("WidevineAdapter::GMPGetAPI(%s, 0x%p, 0x%p) this=0x%p FAILED to find CreateCdmInstance",
aAPIName, aHostAPI, aPluginAPI, this);
return GMPGenericErr;
}
@ -114,6 +114,11 @@ WidevineAdapter::GMPGetAPI(const char* aAPIName,
strlen(WidevineKeySystem),
&GetCdmHost,
decryptor));
if (!cdm) {
Log("WidevineAdapter::GMPGetAPI(%s, 0x%p, 0x%p) this=0x%p FAILED to create cdm",
aAPIName, aHostAPI, aPluginAPI, this);
return GMPGenericErr;
}
Log("cdm: 0x%x", cdm);
sCDMWrapper = new CDMWrapper(cdm);
decryptor->SetCDM(RefPtr<CDMWrapper>(sCDMWrapper));