Bug 1159300: Add a clone of gmp-fake that doesn't do decryption r=glandium,cpearce

This commit is contained in:
Randell Jesup 2015-04-30 00:52:26 -04:00
parent 8c5a6d6863
commit 6c571f94f3
12 changed files with 69 additions and 12 deletions

View File

@ -0,0 +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_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)

View File

@ -0,0 +1,4 @@
Name: fakeopenh264
Description: Fake GMP Plugin
Version: 1.0
APIs: encode-video[h264], decode-video[h264]

View File

@ -0,0 +1 @@
gmp-fakeopenh264 placeholder voucher

View File

@ -0,0 +1,26 @@
# -*- 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/.
# largely a copy of dom/media/gmp-fake/moz.build
FINAL_TARGET = 'dist/bin/gmp-fakeopenh264/1.0'
SOURCES += [
'../gmp-plugin/gmp-fake.cpp',
]
SharedLibrary("fakeopenh264")
if CONFIG['OS_ARCH'] == 'WINNT':
OS_LIBS += [
'ole32',
]
USE_STATIC_LIBS = True
NO_VISIBILITY_FLAGS = True
# Don't use STL wrappers; this isn't Gecko code
DISABLE_STL_WRAPPING = True
FAIL_ON_WARNINGS = True

View File

@ -49,10 +49,12 @@
#include "gmp-video-decode.h"
#include "gmp-video-frame-i420.h"
#include "gmp-video-frame-encoded.h"
#include "gmp-decryption.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)
@ -407,12 +409,14 @@ extern "C" {
} 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;
}

View File

@ -11,6 +11,8 @@ SOURCES += [
'gmp-test-storage.cpp',
]
DEFINES['GMP_FAKE_SUPPORT_DECRYPT'] = True
SharedLibrary("fake")
if CONFIG['OS_ARCH'] == 'WINNT':

View File

@ -23,6 +23,7 @@ DIRS += [
'encoder',
'gmp',
'gmp-plugin',
'gmp-plugin-openh264',
'imagecapture',
'mediasource',
'ogg',

View File

@ -676,7 +676,10 @@ class GTestCommands(MachCommandBase):
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"

View File

@ -67,7 +67,10 @@ class GTests(object):
"""
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"

View File

@ -86,6 +86,7 @@ DIST_BIN = $(DIST)/bin
GMP_TEST_PLUGIN_DIRS := \
$(DIST_BIN)/gmp-fake \
$(DIST_BIN)/gmp-fakeopenh264 \
$(DIST_BIN)/gmp-clearkey \
$(NULL)

View File

@ -457,15 +457,14 @@ class MochitestRunner(MozbuildObject):
# 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,

View File

@ -1451,6 +1451,7 @@ class Mochitest(MochitestUtilsMixin):
gmp_subdirs = [
os.path.join('gmp-fake', '1.0'),
os.path.join('gmp-fakeopenh264', '1.0'),
os.path.join('gmp-clearkey', '0.1'),
]