From 293e18a4d34687e80623f0548327bf5ec324df58 Mon Sep 17 00:00:00 2001 From: Edwin Flores Date: Wed, 12 Nov 2014 11:33:28 +1300 Subject: [PATCH] Bug 1075182 - Package and load ClearKey Content Decryption Module at startup - r=Unfocused --- browser/installer/package-manifest.in | 7 +++++++ .../extensions/internal/OpenH264Provider.jsm | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index 234b6f81bf52..916cae59fa0d 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -922,3 +922,10 @@ bin/libfreebl_32int64_3.so @BINPATH@/clang_rt.asan_dynamic-i386.dll #endif #endif + + +; media +#ifdef MOZ_EME +@BINPATH@/gmp-clearkey/0.1/@DLL_PREFIX@clearkey@DLL_SUFFIX@ +@BINPATH@/gmp-clearkey/0.1/clearkey.info +#endif diff --git a/toolkit/mozapps/extensions/internal/OpenH264Provider.jsm b/toolkit/mozapps/extensions/internal/OpenH264Provider.jsm index f4cae9585585..b102ef1a1de7 100644 --- a/toolkit/mozapps/extensions/internal/OpenH264Provider.jsm +++ b/toolkit/mozapps/extensions/internal/OpenH264Provider.jsm @@ -26,6 +26,10 @@ const STRING_TYPE_NAME = "type.%ID%.name"; const SEC_IN_A_DAY = 24 * 60 * 60; +const EME_PREF_ENABLED = "media.eme.enabled"; +const CLEARKEY_PLUGIN_ID = "gmp-clearkey"; +const CLEARKEY_VERSION = "0.1"; + const OPENH264_PLUGIN_ID = "gmp-gmpopenh264"; const OPENH264_PREF_BRANCH = "media." + OPENH264_PLUGIN_ID + "."; const OPENH264_PREF_ENABLED = "enabled"; @@ -277,6 +281,16 @@ let OpenH264Provider = { } } + if (Preferences.get(EME_PREF_ENABLED, false)) { + try { + gmpService.addPluginDirectory(OS.Path.join(OS.Constants.Path.libDir, + CLEARKEY_PLUGIN_ID, + CLEARKEY_VERSION)); + } catch (e) { + this._log.warn("startup() - adding clearkey CDM failed", e); + } + } + let telemetry = {}; if (this.isEnabled) { telemetry[OPENH264_PLUGIN_ID] = {