Bug 1159300: Add a clone of gmp-fake that doesn't do decryption r=glandium,cpearce
authorRandell Jesup <rjesup@jesup.org>
Thu, 30 Apr 2015 00:52:26 -0400
changeset 273143 491bcd3dba9fd637ed821ed3620d3a2dcf027ad4
parent 273142 7792f4778da8d68d445252f78ce5bf719f6f5476
child 273144 a7da86419656e127226f53e302c82bf3ed23e563
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium, cpearce
bugs1159300
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1159300: Add a clone of gmp-fake that doesn't do decryption r=glandium,cpearce
dom/media/gmp-plugin-openh264/Makefile.in
dom/media/gmp-plugin-openh264/fakeopenh264.info
dom/media/gmp-plugin-openh264/fakeopenh264.voucher
dom/media/gmp-plugin-openh264/moz.build
dom/media/gmp-plugin/gmp-fake.cpp
dom/media/gmp-plugin/moz.build
dom/media/moz.build
python/mozbuild/mozbuild/mach_commands.py
testing/gtest/rungtests.py
testing/mochitest/Makefile.in
testing/mochitest/mach_commands.py
testing/mochitest/runtests.py
copy from dom/media/gmp-plugin/Makefile.in
copy to dom/media/gmp-plugin-openh264/Makefile.in
--- a/dom/media/gmp-plugin/Makefile.in
+++ b/dom/media/gmp-plugin-openh264/Makefile.in
@@ -1,13 +1,12 @@
 #
 # 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/.
 
-INSTALL_TARGETS += FAKE_GMP_PLUGIN
-FAKE_GMP_PLUGIN_DEST = $(DEPTH)/dist/bin/gmp-fake/1.0
-FAKE_GMP_PLUGIN_FILES = \
-  $(SHARED_LIBRARY) \
-  $(srcdir)/fake.info \
-  $(srcdir)/fake.voucher
+INSTALL_TARGETS += FAKE_GMP_OPENH264_PLUGIN
+FAKE_GMP_OPENH264_PLUGIN_DEST = $(DEPTH)/dist/bin/gmp-fakeopenh264/1.0
+FAKE_GMP_OPENH264_PLUGIN_FILES = \
+  $(srcdir)/fakeopenh264.info \
+  $(srcdir)/fakeopenh264.voucher \
+  $(NULL)
 
-include $(topsrcdir)/config/rules.mk
copy from dom/media/gmp-plugin/fake.info
copy to dom/media/gmp-plugin-openh264/fakeopenh264.info
--- a/dom/media/gmp-plugin/fake.info
+++ b/dom/media/gmp-plugin-openh264/fakeopenh264.info
@@ -1,5 +1,4 @@
-Name: fake
+Name: fakeopenh264
 Description: Fake GMP Plugin
 Version: 1.0
-APIs: encode-video[h264], decode-video[h264], eme-decrypt-v7[fake]
-Libraries: dxva2.dll
+APIs: encode-video[h264], decode-video[h264]
copy from dom/media/gmp-plugin/fake.voucher
copy to dom/media/gmp-plugin-openh264/fakeopenh264.voucher
--- a/dom/media/gmp-plugin/fake.voucher
+++ b/dom/media/gmp-plugin-openh264/fakeopenh264.voucher
@@ -1,1 +1,1 @@
-gmp-fake placeholder voucher
\ No newline at end of file
+gmp-fakeopenh264 placeholder voucher
copy from dom/media/gmp-plugin/moz.build
copy to dom/media/gmp-plugin-openh264/moz.build
--- a/dom/media/gmp-plugin/moz.build
+++ b/dom/media/gmp-plugin-openh264/moz.build
@@ -1,22 +1,22 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
-NO_DIST_INSTALL = True
+# largely a copy of dom/media/gmp-fake/moz.build
+
+FINAL_TARGET = 'dist/bin/gmp-fakeopenh264/1.0'
 SOURCES += [
-        'gmp-fake.cpp',
-        'gmp-test-decryptor.cpp',
-        'gmp-test-storage.cpp',
+    '../gmp-plugin/gmp-fake.cpp',
 ]
 
-SharedLibrary("fake")
+SharedLibrary("fakeopenh264")
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     OS_LIBS += [
         'ole32',
     ]
 
 USE_STATIC_LIBS = True
 NO_VISIBILITY_FLAGS = True
--- a/dom/media/gmp-plugin/gmp-fake.cpp
+++ b/dom/media/gmp-plugin/gmp-fake.cpp
@@ -44,20 +44,22 @@
 #include <limits.h>
 
 #include "gmp-platform.h"
 #include "gmp-video-host.h"
 #include "gmp-video-encode.h"
 #include "gmp-video-decode.h"
 #include "gmp-video-frame-i420.h"
 #include "gmp-video-frame-encoded.h"
+
+#if defined(GMP_FAKE_SUPPORT_DECRYPT)
 #include "gmp-decryption.h"
-
 #include "gmp-test-decryptor.h"
 #include "gmp-test-storage.h"
+#endif
 
 #if defined(_MSC_VER)
 #define PUBLIC_FUNC __declspec(dllexport)
 #else
 #define PUBLIC_FUNC
 #endif
 
 #define BIG_FRAME 10000
@@ -402,22 +404,24 @@ extern "C" {
   PUBLIC_FUNC GMPErr
   GMPGetAPI (const char* aApiName, void* aHostAPI, void** aPluginApi) {
     if (!strcmp (aApiName, GMP_API_VIDEO_DECODER)) {
       *aPluginApi = new FakeVideoDecoder (static_cast<GMPVideoHost*> (aHostAPI));
       return GMPNoErr;
     } else if (!strcmp (aApiName, GMP_API_VIDEO_ENCODER)) {
       *aPluginApi = new FakeVideoEncoder (static_cast<GMPVideoHost*> (aHostAPI));
       return GMPNoErr;
+#if defined(GMP_FAKE_SUPPORT_DECRYPT)
     } else if (!strcmp (aApiName, GMP_API_DECRYPTOR)) {
       *aPluginApi = new FakeDecryptor(static_cast<GMPDecryptorHost*> (aHostAPI));
       return GMPNoErr;
     } else if (!strcmp (aApiName, GMP_API_ASYNC_SHUTDOWN)) {
       *aPluginApi = new TestAsyncShutdown(static_cast<GMPAsyncShutdownHost*> (aHostAPI));
       return GMPNoErr;
+#endif
     }
     return GMPGenericErr;
   }
 
   PUBLIC_FUNC void
   GMPShutdown (void) {
     g_platform_api = NULL;
   }
--- a/dom/media/gmp-plugin/moz.build
+++ b/dom/media/gmp-plugin/moz.build
@@ -6,16 +6,18 @@
 
 NO_DIST_INSTALL = True
 SOURCES += [
         'gmp-fake.cpp',
         'gmp-test-decryptor.cpp',
         'gmp-test-storage.cpp',
 ]
 
+DEFINES['GMP_FAKE_SUPPORT_DECRYPT'] = True
+
 SharedLibrary("fake")
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     OS_LIBS += [
         'ole32',
     ]
 
 USE_STATIC_LIBS = True
--- a/dom/media/moz.build
+++ b/dom/media/moz.build
@@ -18,16 +18,17 @@ with Files('RTC*'):
 component_av = ('Core', 'WebRTC: Audio/Video')
 with Files('GetUserMedia*'):
     BUG_COMPONENT = component_av
 
 DIRS += [
     'encoder',
     'gmp',
     'gmp-plugin',
+    'gmp-plugin-openh264',
     'imagecapture',
     'mediasource',
     'ogg',
     'systemservices',
     'webaudio',
     'webrtc',
     'webspeech',
     'webvtt',
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -671,17 +671,20 @@ class GTestCommands(MachCommandBase):
 
         # Use GTest environment variable to control test execution
         # For details see:
         # https://code.google.com/p/googletest/wiki/AdvancedGuide#Running_Test_Programs:_Advanced_Options
         gtest_env = {b'GTEST_FILTER': gtest_filter}
 
         xre_path = os.path.join(self.topobjdir, "dist", "bin")
         gtest_env["MOZ_XRE_DIR"] = xre_path
-        gtest_env["MOZ_GMP_PATH"] = os.path.join(xre_path, "gmp-fake", "1.0")
+        gtest_env["MOZ_GMP_PATH"] = os.pathsep.join(
+            os.path.join(xre_path, p, "1.0")
+            for p in ('gmp-fake', 'gmp-fakeopenh264')
+        )
 
         gtest_env[b"MOZ_RUN_GTEST"] = b"True"
 
         if shuffle:
             gtest_env[b"GTEST_SHUFFLE"] = b"True"
 
         if tbpl_parser:
             gtest_env[b"MOZ_TBPL_PARSER"] = b"True"
--- a/testing/gtest/rungtests.py
+++ b/testing/gtest/rungtests.py
@@ -62,17 +62,20 @@ class GTests(object):
         return result
 
     def build_core_environment(self, env = {}):
         """
         Add environment variables likely to be used across all platforms, including remote systems.
         """
         env["MOZILLA_FIVE_HOME"] = self.xre_path
         env["MOZ_XRE_DIR"] = self.xre_path
-        env["MOZ_GMP_PATH"] = os.path.join(self.xre_path, "gmp-fake", "1.0")
+        env["MOZ_GMP_PATH"] = os.pathsep.join(
+            os.path.join(self.xre_path, p, "1.0")
+            for p in ('gmp-fake', 'gmp-fakeopenh264')
+        )
         env["XPCOM_DEBUG_BREAK"] = "stack-and-abort"
         env["MOZ_CRASHREPORTER_NO_REPORT"] = "1"
         env["MOZ_CRASHREPORTER"] = "1"
         env["MOZ_RUN_GTEST"] = "1"
         # Normally we run with GTest default output, override this to use the TBPL test format.
         env["MOZ_TBPL_PARSER"] = "1"
 
         if not mozinfo.has_sandbox:
--- a/testing/mochitest/Makefile.in
+++ b/testing/mochitest/Makefile.in
@@ -81,16 +81,17 @@ TEST_HARNESS_PLUGINS := \
 endif
 
 # Rules for staging the necessary harness bits for a test package
 PKG_STAGE = $(DIST)/test-stage
 DIST_BIN = $(DIST)/bin
 
 GMP_TEST_PLUGIN_DIRS := \
   $(DIST_BIN)/gmp-fake \
+  $(DIST_BIN)/gmp-fakeopenh264 \
   $(DIST_BIN)/gmp-clearkey \
   $(NULL)
 
 $(_DEST_DIR):
 	$(NSINSTALL) -D $@
 
 # On Android only, include a release signed Robocop APK in the test package.
 ifeq ($(MOZ_BUILD_APP),mobile/android)
--- a/testing/mochitest/mach_commands.py
+++ b/testing/mochitest/mach_commands.py
@@ -452,25 +452,24 @@ class MochitestRunner(MozbuildObject):
             if app_override == "dist":
                 options.app = self.get_binary_path(where='staged-package')
             elif app_override:
                 options.app = app_override
             if options.gmp_path is None:
                 # Need to fix the location of gmp_fake which might not be
                 # shipped in the binary
                 bin_path = self.get_binary_path()
-                options.gmp_path = os.path.join(
-                    os.path.dirname(bin_path),
-                    'gmp-fake',
-                    '1.0')
-                options.gmp_path += os.pathsep
-                options.gmp_path += os.path.join(
-                    os.path.dirname(bin_path),
-                    'gmp-clearkey',
-                    '0.1')
+                gmp_modules = (
+                    ('gmp-fake', '1.0'),
+                    ('gmp-clearkey', '0.1'),
+                    ('gmp-fakeopenh264', '1.0')
+                )
+                options.gmp_path = os.pathsep.join(
+                    os.path.join(os.path.dirname(bin_path), *p)
+                    for p in gmp_modules)
 
         logger_options = {
             key: value for key,
             value in vars(options).iteritems() if key.startswith('log')}
         runner = mochitest.Mochitest(logger_options)
         options = opts.verifyOptions(options, runner)
 
         if options is None:
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -1446,16 +1446,17 @@ class Mochitest(MochitestUtilsMixin):
             options.xrePath,
             # For packaged builds, GMP plugins will get copied under
             # $profile/plugins.
             os.path.join(self.profile.profile, 'plugins'),
         ]
 
         gmp_subdirs = [
             os.path.join('gmp-fake', '1.0'),
+            os.path.join('gmp-fakeopenh264', '1.0'),
             os.path.join('gmp-clearkey', '0.1'),
         ]
 
         gmp_paths = [os.path.join(parent, sub)
                      for parent in gmp_parentdirs
                      for sub in gmp_subdirs
                      if os.path.isdir(os.path.join(parent, sub))]