Bug 1159495 - Only report that Adobe EME is available if we have a plugin-container voucher. r=edwin

This commit is contained in:
Chris Pearce 2015-04-30 21:52:14 +12:00
Родитель 781fc853dd
Коммит 9f7e269f5d
5 изменённых файлов: 53 добавлений и 10 удалений

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

@ -22,6 +22,7 @@
#include "mozilla/Services.h"
#include "nsIObserverService.h"
#include "mozilla/EMEUtils.h"
#include "GMPUtils.h"
namespace mozilla {
namespace dom {
@ -160,9 +161,11 @@ MediaKeySystemAccess::GetKeySystemStatus(const nsAString& aKeySystem,
if (!Preferences::GetBool("media.gmp-eme-adobe.enabled", false)) {
return MediaKeySystemStatus::Cdm_disabled;
}
if (!WMFDecoderModule::HasH264() || !WMFDecoderModule::HasAAC()) {
if ((!WMFDecoderModule::HasH264() || !WMFDecoderModule::HasAAC()) ||
!EMEVoucherFileExists()) {
// The system doesn't have the codecs that Adobe EME relies
// on installed.
// 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.
return MediaKeySystemStatus::Cdm_not_supported;
}
return EnsureMinCDMVersion(mps, aKeySystem, aMinCdmVersion, true);

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

@ -5,8 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "GMPProcessParent.h"
#include "nsDirectoryServiceDefs.h"
#include "nsIFile.h"
#include "GMPUtils.h"
#include "base/string_util.h"
#include "base/process_util.h"
@ -45,15 +44,13 @@ GMPProcessParent::~GMPProcessParent()
bool
GMPProcessParent::Launch(int32_t aTimeoutMs)
{
nsCOMPtr<nsIFile> greDir;
NS_GetSpecialDirectory(NS_GRE_DIR, getter_AddRefs(greDir));
if (!greDir) {
NS_WARNING("GMPProcessParent can't get NS_GRE_DIR");
nsCOMPtr<nsIFile> path;
if (!GetEMEVoucherPath(getter_AddRefs(path))) {
NS_WARNING("GMPProcessParent can't get EME voucher path!");
return false;
}
greDir->AppendNative(NS_LITERAL_CSTRING("voucher.bin"));
nsAutoCString voucherPath;
greDir->GetNativePath(voucherPath);
path->GetNativePath(voucherPath);
vector<string> args;
args.push_back(mGMPPath);

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

@ -0,0 +1,38 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "GMPUtils.h"
#include "nsDirectoryServiceDefs.h"
#include "nsIFile.h"
#include "nsCOMPtr.h"
namespace mozilla {
bool
GetEMEVoucherPath(nsIFile** aPath)
{
nsCOMPtr<nsIFile> path;
NS_GetSpecialDirectory(NS_GRE_DIR, getter_AddRefs(path));
if (!path) {
NS_WARNING("GetEMEVoucherPath can't get NS_GRE_DIR!");
return false;
}
path->AppendNative(NS_LITERAL_CSTRING("voucher.bin"));
path.forget(aPath);
return true;
}
bool
EMEVoucherFileExists()
{
nsCOMPtr<nsIFile> path;
bool exists;
return GetEMEVoucherPath(getter_AddRefs(path)) &&
NS_SUCCEEDED(path->Exists(&exists)) &&
exists;
}
} // namespace mozilla

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

@ -21,6 +21,10 @@ struct DestroyPolicy
template<typename T>
using GMPUniquePtr = mozilla::UniquePtr<T, DestroyPolicy<T>>;
bool GetEMEVoucherPath(nsIFile** aPath);
bool EMEVoucherFileExists();
} // namespace mozilla
#endif

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

@ -98,6 +98,7 @@ UNIFIED_SOURCES += [
'GMPStorageParent.cpp',
'GMPTimerChild.cpp',
'GMPTimerParent.cpp',
'GMPUtils.cpp',
'GMPVideoDecoderChild.cpp',
'GMPVideoDecoderParent.cpp',
'GMPVideoEncodedFrameImpl.cpp',