зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1174566 - More helpful MediaKeySystemAccess error messages. r=edwin
This commit is contained in:
Родитель
33ff352b01
Коммит
b4099e810a
|
@ -141,7 +141,8 @@ AdobePluginVoucherExists(const nsACString& aVersionStr)
|
|||
static MediaKeySystemStatus
|
||||
EnsureMinCDMVersion(mozIGeckoMediaPluginService* aGMPService,
|
||||
const nsAString& aKeySystem,
|
||||
int32_t aMinCdmVersion)
|
||||
int32_t aMinCdmVersion,
|
||||
nsACString& aOutMessage)
|
||||
{
|
||||
nsTArray<nsCString> tags;
|
||||
tags.AppendElement(NS_ConvertUTF16toUTF8(aKeySystem));
|
||||
|
@ -151,10 +152,12 @@ EnsureMinCDMVersion(mozIGeckoMediaPluginService* aGMPService,
|
|||
&tags,
|
||||
&hasPlugin,
|
||||
versionStr))) {
|
||||
aOutMessage = NS_LITERAL_CSTRING("GetPluginVersionForAPI failed");
|
||||
return MediaKeySystemStatus::Error;
|
||||
}
|
||||
|
||||
if (!hasPlugin) {
|
||||
aOutMessage = NS_LITERAL_CSTRING("CDM is not installed");
|
||||
return MediaKeySystemStatus::Cdm_not_installed;
|
||||
}
|
||||
|
||||
|
@ -165,6 +168,7 @@ EnsureMinCDMVersion(mozIGeckoMediaPluginService* aGMPService,
|
|||
nsresult rv;
|
||||
int32_t version = versionStr.ToInteger(&rv);
|
||||
if (NS_FAILED(rv) || version < 0 || aMinCdmVersion > version) {
|
||||
aOutMessage = NS_LITERAL_CSTRING("Installed CDM version insufficient");
|
||||
return MediaKeySystemStatus::Cdm_insufficient_version;
|
||||
}
|
||||
|
||||
|
@ -173,8 +177,16 @@ EnsureMinCDMVersion(mozIGeckoMediaPluginService* aGMPService,
|
|||
aKeySystem.EqualsLiteral("com.adobe.primetime")) {
|
||||
// Verify that anti-virus hasn't "helpfully" deleted the Adobe GMP DLL,
|
||||
// as we suspect may happen (Bug 1160382).
|
||||
if (!AdobePluginDLLExists(versionStr) ||
|
||||
!AdobePluginVoucherExists(versionStr)) {
|
||||
bool somethingMissing = false;
|
||||
if (!AdobePluginDLLExists(versionStr)) {
|
||||
aOutMessage = NS_LITERAL_CSTRING("Adobe DLL was expected to be on disk but was not");
|
||||
somethingMissing = true;
|
||||
}
|
||||
if (!AdobePluginVoucherExists(versionStr)) {
|
||||
aOutMessage = NS_LITERAL_CSTRING("Adobe plugin voucher was expected to be on disk but was not");
|
||||
somethingMissing = true;
|
||||
}
|
||||
if (somethingMissing) {
|
||||
NS_WARNING("Adobe EME plugin or voucher disappeared from disk!");
|
||||
// Reset the prefs that Firefox's GMP downloader sets, so that
|
||||
// Firefox will try to download the plugin next time the updater runs.
|
||||
|
@ -191,20 +203,23 @@ EnsureMinCDMVersion(mozIGeckoMediaPluginService* aGMPService,
|
|||
/* static */
|
||||
MediaKeySystemStatus
|
||||
MediaKeySystemAccess::GetKeySystemStatus(const nsAString& aKeySystem,
|
||||
int32_t aMinCdmVersion)
|
||||
int32_t aMinCdmVersion,
|
||||
nsACString& aOutMessage)
|
||||
{
|
||||
MOZ_ASSERT(Preferences::GetBool("media.eme.enabled", false));
|
||||
nsCOMPtr<mozIGeckoMediaPluginService> mps =
|
||||
do_GetService("@mozilla.org/gecko-media-plugin-service;1");
|
||||
if (NS_WARN_IF(!mps)) {
|
||||
aOutMessage = NS_LITERAL_CSTRING("Failed to get GMP service");
|
||||
return MediaKeySystemStatus::Error;
|
||||
}
|
||||
|
||||
if (aKeySystem.EqualsLiteral("org.w3.clearkey")) {
|
||||
if (!Preferences::GetBool("media.eme.clearkey.enabled", true)) {
|
||||
aOutMessage = NS_LITERAL_CSTRING("ClearKey was disabled");
|
||||
return MediaKeySystemStatus::Cdm_disabled;
|
||||
}
|
||||
return EnsureMinCDMVersion(mps, aKeySystem, aMinCdmVersion);
|
||||
return EnsureMinCDMVersion(mps, aKeySystem, aMinCdmVersion, aOutMessage);
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
|
@ -212,20 +227,21 @@ MediaKeySystemAccess::GetKeySystemStatus(const nsAString& aKeySystem,
|
|||
aKeySystem.EqualsLiteral("com.adobe.primetime"))) {
|
||||
// Win Vista and later only.
|
||||
if (!IsVistaOrLater()) {
|
||||
aOutMessage = NS_LITERAL_CSTRING("Minimum Windows version not met for Adobe EME");
|
||||
return MediaKeySystemStatus::Cdm_not_supported;
|
||||
}
|
||||
if (!Preferences::GetBool("media.gmp-eme-adobe.enabled", false)) {
|
||||
aOutMessage = NS_LITERAL_CSTRING("Adobe EME disabled");
|
||||
return MediaKeySystemStatus::Cdm_disabled;
|
||||
}
|
||||
if (!MP4Decoder::CanCreateH264Decoder() ||
|
||||
!MP4Decoder::CanCreateAACDecoder() ||
|
||||
!EMEVoucherFileExists()) {
|
||||
if (!EMEVoucherFileExists()) {
|
||||
// The system doesn't have the codecs that Adobe EME relies
|
||||
// on installed, or doesn't have a voucher for the plugin-container.
|
||||
// Adobe EME isn't going to work, so don't advertise that it will.
|
||||
aOutMessage = NS_LITERAL_CSTRING("Plugin-container voucher not present");
|
||||
return MediaKeySystemStatus::Cdm_not_supported;
|
||||
}
|
||||
return EnsureMinCDMVersion(mps, aKeySystem, aMinCdmVersion);
|
||||
return EnsureMinCDMVersion(mps, aKeySystem, aMinCdmVersion, aOutMessage);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -44,8 +44,11 @@ public:
|
|||
|
||||
already_AddRefed<Promise> CreateMediaKeys(ErrorResult& aRv);
|
||||
|
||||
|
||||
|
||||
static MediaKeySystemStatus GetKeySystemStatus(const nsAString& aKeySystem,
|
||||
int32_t aMinCdmVersion);
|
||||
int32_t aMinCdmVersion,
|
||||
nsACString& aOutExceptionMessage);
|
||||
|
||||
static bool IsSupported(const nsAString& aKeySystem,
|
||||
const Sequence<MediaKeySystemOptions>& aOptions);
|
||||
|
|
|
@ -105,7 +105,8 @@ MediaKeySystemAccessManager::Request(DetailedPromise* aPromise,
|
|||
return;
|
||||
}
|
||||
|
||||
MediaKeySystemStatus status = MediaKeySystemAccess::GetKeySystemStatus(keySystem, minCdmVersion);
|
||||
nsAutoCString message;
|
||||
MediaKeySystemStatus status = MediaKeySystemAccess::GetKeySystemStatus(keySystem, minCdmVersion, message);
|
||||
if ((status == MediaKeySystemStatus::Cdm_not_installed ||
|
||||
status == MediaKeySystemStatus::Cdm_insufficient_version) &&
|
||||
keySystem.EqualsLiteral("com.adobe.primetime")) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче