summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchcunningham <chcunningham@chromium.org>2015-06-04 19:26:33 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-05 02:27:15 +0000
commita31b9ad7e78a1e6174fd218a78b0909079e0afd5 (patch)
tree50726b0fd043b4a3e8e0252e231a16341c1eb682
parent4f2ff6852e6838ea671e0d2322a57b1c51b22948 (diff)
downloadchromium_src-a31b9ad7e78a1e6174fd218a78b0909079e0afd5.zip
chromium_src-a31b9ad7e78a1e6174fd218a78b0909079e0afd5.tar.gz
chromium_src-a31b9ad7e78a1e6174fd218a78b0909079e0afd5.tar.bz2
Revert "Chromium changes to statically link ffmpeg."
Reverting because of component test failures around isolate expectations. This change may not actually be directly responsible, but I'm out of time to investigate for the day. Will re-land it soon. BUG=496975 TBR=enne@chromium.org, gunsch@chromium.org, jochen@chromium.org, isherman@chromium.org, thomasvl@chromium.org, phajdan@chromium.org, grt@chromium.org, mmoss@chromium.org, sergeyu@chromium.org, sky@chromium.org, dalecurtis@chromium.org This reverts commit bfef6d6ba82b172ac0e48c80d9ccf1a1ca0ea5c5. NOPRESUBMIT=true NOTRY=true Review URL: https://codereview.chromium.org/1161183003 Cr-Commit-Position: refs/heads/master@{#332994}
-rw-r--r--DEPS2
-rw-r--r--ash/ash_unittests.isolate2
-rw-r--r--cc/cc_unittests.isolate3
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc2
-rw-r--r--cc/trees/layer_tree_host_unittest_context.cc2
-rw-r--r--chrome/chrome.isolate4
-rw-r--r--chrome/chrome_dll_bundle.gypi1
-rw-r--r--chrome/chrome_installer.gypi1
-rw-r--r--chrome/installer/linux/common/installer.include3
-rw-r--r--chrome/installer/mini_installer/chrome.release1
-rw-r--r--chrome/interactive_ui_tests.isolate4
-rw-r--r--chrome/plugin/chrome_content_plugin_client.cc7
-rw-r--r--chrome/sync_integration_tests.isolate4
-rw-r--r--chrome/test/base/chrome_test_suite.cc2
-rwxr-xr-xchrome/test/chromeos/autotest/files/client/deps/chrome_test/setup_test_links.sh1
-rwxr-xr-xchrome/test/chromeos/autotest/files/client/deps/pyauto_dep/setup_test_links.sh1
-rw-r--r--chrome/tools/build/chromeos/FILES.cfg4
-rw-r--r--chrome/tools/build/linux/FILES.cfg4
-rw-r--r--chrome/tools/build/mac/TESTS1
-rwxr-xr-xchrome/tools/build/mac/dump_product_syms1
-rw-r--r--chrome/tools/build/win/FILES.cfg5
-rw-r--r--chrome/unit_tests.isolate4
-rw-r--r--chrome/utility/extensions/extensions_handler.cc7
-rw-r--r--chromecast/media/cma/test/run_all_unittests.cc2
-rw-r--r--components/components_unittests.isolate4
-rw-r--r--components/html_viewer/media_factory.cc6
-rw-r--r--content/app/content_main_runner.cc7
-rw-r--r--content/browser/browser_main_loop.cc2
-rw-r--r--content/content_browsertests.isolate4
-rw-r--r--content/content_gl_tests.isolate15
-rw-r--r--content/content_shell.gypi7
-rw-r--r--content/content_unittests.isolate4
-rw-r--r--content/renderer/render_thread_impl.cc9
-rw-r--r--content/test/content_test_suite.cc2
-rw-r--r--content/test/test_blink_web_unit_test_support.cc16
-rw-r--r--media/audio_unittests.isolate22
-rw-r--r--media/base/BUILD.gn6
-rw-r--r--media/base/media.cc60
-rw-r--r--media/base/media.h29
-rw-r--r--media/base/media_posix.cc66
-rw-r--r--media/base/media_stub.cc19
-rw-r--r--media/base/media_win.cc56
-rw-r--r--media/base/run_all_perftests.cc2
-rw-r--r--media/base/run_all_unittests.cc2
-rw-r--r--media/blink/run_all_unittests.cc2
-rw-r--r--media/cast/cast_unittests.isolate21
-rw-r--r--media/cast/sender/audio_encoder_unittest.cc2
-rw-r--r--media/cast/sender/audio_sender_unittest.cc2
-rw-r--r--media/cast/sender/h264_vt_encoder_unittest.cc2
-rw-r--r--media/cast/test/sender.cc9
-rw-r--r--media/cast/test/simulator.cc5
-rw-r--r--media/cdm/ppapi/external_clear_key/clear_key_cdm.cc15
-rw-r--r--media/ffmpeg/ffmpeg_common_unittest.cc16
-rw-r--r--media/filters/ffmpeg_glue.cc3
-rw-r--r--media/media.gyp6
-rw-r--r--media/media_nacl.gyp4
-rw-r--r--media/media_unittests.isolate22
-rw-r--r--media/mojo/services/renderer_config_default.cc7
-rw-r--r--media/test/pipeline_integration_test.cc3
-rw-r--r--remoting/base/run_all_unittests.cc4
-rw-r--r--remoting/host/it2me/it2me_native_messaging_host.cc4
-rw-r--r--remoting/host/remoting_me2me_host.cc4
-rw-r--r--testing/chromoting/chromoting_integration_tests.isolate3
-rw-r--r--tools/metrics/histograms/histograms.xml3
64 files changed, 475 insertions, 68 deletions
diff --git a/DEPS b/DEPS
index 0ea6bfa..8bc2a50 100644
--- a/DEPS
+++ b/DEPS
@@ -198,7 +198,7 @@ deps = {
Var('chromium_git') + '/chromium/deps/libvpx.git' + '@' + Var('libvpx_revision'),
'src/third_party/ffmpeg':
- Var('chromium_git') + '/chromium/third_party/ffmpeg.git' + '@' + 'c3542a7e245b18715e2003e2a66fa801840b31dd',
+ Var('chromium_git') + '/chromium/third_party/ffmpeg.git' + '@' + 'c0f05636c4472e5d3c0045ec34464aec46c5fb70',
'src/third_party/libjingle/source/talk':
Var('chromium_git') + '/external/webrtc/trunk/talk.git' + '@' + '9329d80ec7306d3c2ee3bc3c17508956627ddeff', # commit position 9354
diff --git a/ash/ash_unittests.isolate b/ash/ash_unittests.isolate
index 4866e71..40e3e79 100644
--- a/ash/ash_unittests.isolate
+++ b/ash/ash_unittests.isolate
@@ -41,6 +41,7 @@
['OS=="linux"', {
'variables': {
'files': [
+ '<(PRODUCT_DIR)/libffmpegsumo.so',
'<(PRODUCT_DIR)/libosmesa.so',
],
},
@@ -48,6 +49,7 @@
['OS=="win"', {
'variables': {
'files': [
+ '<(PRODUCT_DIR)/ffmpegsumo.dll',
'<(PRODUCT_DIR)/osmesa.dll',
],
},
diff --git a/cc/cc_unittests.isolate b/cc/cc_unittests.isolate
index 6a16fcd..7c359d0 100644
--- a/cc/cc_unittests.isolate
+++ b/cc/cc_unittests.isolate
@@ -46,6 +46,7 @@
['OS=="linux"', {
'variables': {
'files': [
+ '<(PRODUCT_DIR)/libffmpegsumo.so',
'<(PRODUCT_DIR)/libosmesa.so',
],
},
@@ -53,6 +54,7 @@
['OS=="mac"', {
'variables': {
'files': [
+ '<(PRODUCT_DIR)/ffmpegsumo.so',
'<(PRODUCT_DIR)/osmesa.so',
],
},
@@ -60,6 +62,7 @@
['OS=="win"', {
'variables': {
'files': [
+ '<(PRODUCT_DIR)/ffmpegsumo.dll',
'<(PRODUCT_DIR)/osmesa.dll',
],
},
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 912d1c0..45acfd3 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -100,7 +100,7 @@ class LayerTreeHostImplTest : public testing::Test,
reduce_memory_result_(true),
current_limit_bytes_(0),
current_priority_cutoff_value_(0) {
- media::InitializeMediaLibrary();
+ media::InitializeMediaLibraryForTesting();
}
LayerTreeSettings DefaultSettings() {
diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc
index c7dd28c..e440260 100644
--- a/cc/trees/layer_tree_host_unittest_context.cc
+++ b/cc/trees/layer_tree_host_unittest_context.cc
@@ -67,7 +67,7 @@ class LayerTreeHostContextTest : public LayerTreeTest {
context_should_support_io_surface_(false),
fallback_context_works_(false),
async_output_surface_creation_(false) {
- media::InitializeMediaLibrary();
+ media::InitializeMediaLibraryForTesting();
}
void LoseContext() {
diff --git a/chrome/chrome.isolate b/chrome/chrome.isolate
index 43bc605..6ba6903 100644
--- a/chrome/chrome.isolate
+++ b/chrome/chrome.isolate
@@ -6,6 +6,7 @@
['OS=="linux"', {
'variables': {
'files': [
+ '<(PRODUCT_DIR)/libffmpegsumo.so',
'<(PRODUCT_DIR)/libosmesa.so',
],
},
@@ -70,6 +71,7 @@
'<(PRODUCT_DIR)/<(mac_product_name) Helper.app/',
'<(PRODUCT_DIR)/<(mac_product_name).app/',
'<(PRODUCT_DIR)/exif.so',
+ '<(PRODUCT_DIR)/ffmpegsumo.so',
],
},
}],
@@ -80,6 +82,7 @@
'<(PRODUCT_DIR)/<(mac_product_name) Helper.app.dSYM/',
'<(PRODUCT_DIR)/<(mac_product_name).app.dSYM/',
'<(PRODUCT_DIR)/exif.so.dSYM/',
+ '<(PRODUCT_DIR)/ffmpegsumo.so.dSYM/',
],
},
}],
@@ -90,6 +93,7 @@
'<(PRODUCT_DIR)/chrome_200_percent.pak',
'<(PRODUCT_DIR)/chrome.dll',
'<(PRODUCT_DIR)/chrome_elf.dll',
+ '<(PRODUCT_DIR)/ffmpegsumo.dll',
'<(PRODUCT_DIR)/libexif.dll',
'<(PRODUCT_DIR)/osmesa.dll',
],
diff --git a/chrome/chrome_dll_bundle.gypi b/chrome/chrome_dll_bundle.gypi
index e9fc103..a938500 100644
--- a/chrome/chrome_dll_bundle.gypi
+++ b/chrome/chrome_dll_bundle.gypi
@@ -136,6 +136,7 @@
'destination': '<(PRODUCT_DIR)/$(CONTENTS_FOLDER_PATH)/Libraries',
'files': [
'<(PRODUCT_DIR)/exif.so',
+ '<(PRODUCT_DIR)/ffmpegsumo.so',
],
},
{
diff --git a/chrome/chrome_installer.gypi b/chrome/chrome_installer.gypi
index 99ccd5c..cc1a332 100644
--- a/chrome/chrome_installer.gypi
+++ b/chrome/chrome_installer.gypi
@@ -438,6 +438,7 @@
# files? (e.g. all locales, resources, etc.)
'<(PRODUCT_DIR)/chrome',
'<(PRODUCT_DIR)/chrome_sandbox',
+ '<(PRODUCT_DIR)/libffmpegsumo.so',
'<(PRODUCT_DIR)/xdg-mime',
'<(PRODUCT_DIR)/xdg-settings',
'<(PRODUCT_DIR)/locales/en-US.pak',
diff --git a/chrome/installer/linux/common/installer.include b/chrome/installer/linux/common/installer.include
index 7f4ef77..14171f7 100644
--- a/chrome/installer/linux/common/installer.include
+++ b/chrome/installer/linux/common/installer.include
@@ -156,6 +156,9 @@ stage_install_common() {
find "${STAGEDIR}/${INSTALLDIR}/locales" -type f -exec chmod 644 '{}' \;
find "${STAGEDIR}/${INSTALLDIR}/locales" -type d -exec chmod 755 '{}' \;
+ # ffmpeg libs
+ install -m 644 -s "${BUILDDIR}/libffmpegsumo.so" "${STAGEDIR}/${INSTALLDIR}/"
+
# Widevine CDM.
if [ -f "${BUILDDIR}/libwidevinecdmadapter.so" ]; then
install -m 644 -s "${BUILDDIR}/libwidevinecdmadapter.so" "${STAGEDIR}/${INSTALLDIR}/"
diff --git a/chrome/installer/mini_installer/chrome.release b/chrome/installer/mini_installer/chrome.release
index 07bc305..b6d3d48 100644
--- a/chrome/installer/mini_installer/chrome.release
+++ b/chrome/installer/mini_installer/chrome.release
@@ -24,6 +24,7 @@ chrome_child.dll: %(VersionDir)s\
chrome_elf.dll: %(VersionDir)s\
chrome_watcher.dll: %(VersionDir)s\
d3dcompiler_47.dll: %(VersionDir)s\
+ffmpegsumo.dll: %(VersionDir)s\
kasko.dll: %(VersionDir)s\
icudt.dll: %(VersionDir)s\
icudtl.dat: %(VersionDir)s\
diff --git a/chrome/interactive_ui_tests.isolate b/chrome/interactive_ui_tests.isolate
index f013ef6..084c69ab 100644
--- a/chrome/interactive_ui_tests.isolate
+++ b/chrome/interactive_ui_tests.isolate
@@ -35,6 +35,7 @@
['OS=="linux"', {
'variables': {
'files': [
+ '<(PRODUCT_DIR)/libffmpegsumo.so',
'<(PRODUCT_DIR)/libosmesa.so',
'<(PRODUCT_DIR)/libppapi_tests.so',
'<(PRODUCT_DIR)/pyproto/google/',
@@ -76,6 +77,7 @@
'files': [
'<(PRODUCT_DIR)/<(mac_product_name) Framework.framework/',
'<(PRODUCT_DIR)/<(mac_product_name).app/',
+ '<(PRODUCT_DIR)/ffmpegsumo.so',
'<(PRODUCT_DIR)/osmesa.so',
'<(PRODUCT_DIR)/ppapi_tests.plugin/Contents/MacOS/ppapi_tests',
],
@@ -86,6 +88,7 @@
'files': [
'<(PRODUCT_DIR)/<(mac_product_name) Framework.framework/',
'<(PRODUCT_DIR)/<(mac_product_name).app.dSYM/',
+ '<(PRODUCT_DIR)/ffmpegsumo.so.dSYM/',
'<(PRODUCT_DIR)/interactive_ui_tests.dSYM/',
'<(PRODUCT_DIR)/osmesa.so.dSYM/',
'<(PRODUCT_DIR)/ppapi_tests.plugin.dSYM/',
@@ -97,6 +100,7 @@
'files': [
'<(PRODUCT_DIR)/chrome_elf.dll',
'<(PRODUCT_DIR)/d3dcompiler_47.dll',
+ '<(PRODUCT_DIR)/ffmpegsumo.dll',
'<(PRODUCT_DIR)/libEGL.dll',
'<(PRODUCT_DIR)/libGLESv2.dll',
'<(PRODUCT_DIR)/osmesa.dll',
diff --git a/chrome/plugin/chrome_content_plugin_client.cc b/chrome/plugin/chrome_content_plugin_client.cc
index c998b78..3cfce28 100644
--- a/chrome/plugin/chrome_content_plugin_client.cc
+++ b/chrome/plugin/chrome_content_plugin_client.cc
@@ -43,8 +43,11 @@ void ChromeContentPluginClient::PreSandboxInitialization() {
LOG(ERROR) << "Failed to load crypto32.dll: " << error.ToString();
#endif // defined(OS_WIN)
- // Initialize media libraries for the Chromoting client plugin.
- media::InitializeMediaLibrary();
+ // Load media libraries for the Chromoting client plugin.
+ base::FilePath media_path;
+ PathService::Get(content::DIR_MEDIA_LIBS, &media_path);
+ if (!media_path.empty())
+ media::InitializeMediaLibrary(media_path);
#endif // defined(ENABLE_REMOTING)
}
diff --git a/chrome/sync_integration_tests.isolate b/chrome/sync_integration_tests.isolate
index 0b22cf6..3ff1056 100644
--- a/chrome/sync_integration_tests.isolate
+++ b/chrome/sync_integration_tests.isolate
@@ -29,6 +29,7 @@
['OS=="linux"', {
'variables': {
'files': [
+ '<(PRODUCT_DIR)/libffmpegsumo.so',
'<(PRODUCT_DIR)/libosmesa.so',
],
},
@@ -61,6 +62,7 @@
'files': [
'<(PRODUCT_DIR)/<(mac_product_name) Framework.framework/',
'<(PRODUCT_DIR)/<(mac_product_name).app/',
+ '<(PRODUCT_DIR)/ffmpegsumo.so',
],
},
}],
@@ -69,6 +71,7 @@
'files': [
'<(PRODUCT_DIR)/<(mac_product_name) Framework.framework.dSYM/',
'<(PRODUCT_DIR)/<(mac_product_name).app.dSYM/',
+ '<(PRODUCT_DIR)/ffmpegsumo.so.dSYM/',
],
},
}],
@@ -76,6 +79,7 @@
'variables': {
'files': [
'<(PRODUCT_DIR)/chrome_elf.dll',
+ '<(PRODUCT_DIR)/ffmpegsumo.dll',
],
},
}],
diff --git a/chrome/test/base/chrome_test_suite.cc b/chrome/test/base/chrome_test_suite.cc
index 933d6a0..a2258b5 100644
--- a/chrome/test/base/chrome_test_suite.cc
+++ b/chrome/test/base/chrome_test_suite.cc
@@ -82,7 +82,7 @@ void ChromeTestSuite::Initialize() {
// ChromeOS. That means we are autotest and, if ASAN is used,
// external libraries load crashes.
if (!IsCrosPythonProcess())
- media::InitializeMediaLibrary();
+ media::InitializeMediaLibraryForTesting();
#endif
// Initialize after overriding paths as some content paths depend on correct
diff --git a/chrome/test/chromeos/autotest/files/client/deps/chrome_test/setup_test_links.sh b/chrome/test/chromeos/autotest/files/client/deps/chrome_test/setup_test_links.sh
index 7e212e1..a47b005 100755
--- a/chrome/test/chromeos/autotest/files/client/deps/chrome_test/setup_test_links.sh
+++ b/chrome/test/chromeos/autotest/files/client/deps/chrome_test/setup_test_links.sh
@@ -53,6 +53,7 @@ link_from_pyauto_dep \
"$pyauto_dep_dir/test_src/out/Release/pyproto" \
"$pyauto_dep_dir/test_src/out/Release/suid-python" \
"$pyauto_dep_dir/test_src/out/Release/_pyautolib.so" \
+ "$pyauto_dep_dir/test_src/out/Release/libffmpegsumo.so" \
"$pyauto_dep_dir/test_src/third_party"/*
# Make sure the test files are owned by chronos as some browser_tests emit
diff --git a/chrome/test/chromeos/autotest/files/client/deps/pyauto_dep/setup_test_links.sh b/chrome/test/chromeos/autotest/files/client/deps/pyauto_dep/setup_test_links.sh
index 4a08de6..2be6bd2 100755
--- a/chrome/test/chromeos/autotest/files/client/deps/pyauto_dep/setup_test_links.sh
+++ b/chrome/test/chromeos/autotest/files/client/deps/pyauto_dep/setup_test_links.sh
@@ -12,3 +12,4 @@ ln -f -s /opt/google/chrome/chrome $(dirname $0)/chrome
[ -L $(dirname $0)/resources ] || ln -f -s /opt/google/chrome/resources \
$(dirname $0)/resources
ln -f -s /opt/google/chrome/*.pak $(dirname $0)/
+ln -f -s /opt/google/chrome/libffmpegsumo.so $(dirname $0)/libffmpegsumo.so
diff --git a/chrome/tools/build/chromeos/FILES.cfg b/chrome/tools/build/chromeos/FILES.cfg
index 1089fd2..9bed5dd 100644
--- a/chrome/tools/build/chromeos/FILES.cfg
+++ b/chrome/tools/build/chromeos/FILES.cfg
@@ -61,6 +61,10 @@ FILES = [
'buildtype': ['dev', 'official'],
},
{
+ 'filename': 'libffmpegsumo.so',
+ 'buildtype': ['dev', 'official'],
+ },
+ {
'filename': 'lib/libexif.so',
'buildtype': ['dev', 'official'],
},
diff --git a/chrome/tools/build/linux/FILES.cfg b/chrome/tools/build/linux/FILES.cfg
index 52a09f2..8ec10a5 100644
--- a/chrome/tools/build/linux/FILES.cfg
+++ b/chrome/tools/build/linux/FILES.cfg
@@ -72,6 +72,10 @@ FILES = [
'buildtype': ['official'],
},
{
+ 'filename': 'libffmpegsumo.so',
+ 'buildtype': ['dev', 'official'],
+ },
+ {
'filename': 'lib/libpeerconnection.so',
'buildtype': ['dev', 'official'],
'optional': ['dev', 'official'],
diff --git a/chrome/tools/build/mac/TESTS b/chrome/tools/build/mac/TESTS
index d77adcf..4a81ea9 100644
--- a/chrome/tools/build/mac/TESTS
+++ b/chrome/tools/build/mac/TESTS
@@ -1,2 +1,3 @@
sync_integration_tests
exif.so
+ffmpegsumo.so
diff --git a/chrome/tools/build/mac/dump_product_syms b/chrome/tools/build/mac/dump_product_syms
index 0673a1e..c9ef590 100755
--- a/chrome/tools/build/mac/dump_product_syms
+++ b/chrome/tools/build/mac/dump_product_syms
@@ -81,6 +81,7 @@ SRC_NAMES=(
"${SRC_APP_NAME} Helper.app"
"crashpad_handler"
"exif.so"
+ "ffmpegsumo.so"
)
# PDF.plugin is optional. Only include it if present.
diff --git a/chrome/tools/build/win/FILES.cfg b/chrome/tools/build/win/FILES.cfg
index 2dcef76..6c779d5 100644
--- a/chrome/tools/build/win/FILES.cfg
+++ b/chrome/tools/build/win/FILES.cfg
@@ -41,6 +41,11 @@ FILES = [
'archive': 'sync_integration_tests.exe',
},
{
+ 'filename': 'ffmpegsumo.dll',
+ 'buildtype': ['dev', 'official'],
+ 'filegroup': ['default', 'symsrc'],
+ },
+ {
'filename': 'chrome.exe',
'buildtype': ['dev', 'official'],
'filegroup': ['default', 'symsrc'],
diff --git a/chrome/unit_tests.isolate b/chrome/unit_tests.isolate
index 8c17738..146ca41 100644
--- a/chrome/unit_tests.isolate
+++ b/chrome/unit_tests.isolate
@@ -73,6 +73,7 @@
['OS=="linux"', {
'variables': {
'files': [
+ '<(PRODUCT_DIR)/libffmpegsumo.so',
'<(PRODUCT_DIR)/libosmesa.so',
'<(PRODUCT_DIR)/locales/fr.pak',
],
@@ -101,6 +102,7 @@
'files': [
'<(PRODUCT_DIR)/<(mac_product_name) Framework.framework/',
'<(PRODUCT_DIR)/exif.so',
+ '<(PRODUCT_DIR)/ffmpegsumo.so',
'<(PRODUCT_DIR)/osmesa.so',
],
},
@@ -110,6 +112,7 @@
'files': [
'<(PRODUCT_DIR)/<(mac_product_name) Framework.framework.dSYM/',
'<(PRODUCT_DIR)/exif.so.dSYM/',
+ '<(PRODUCT_DIR)/ffmpegsumo.so.dSYM/',
'<(PRODUCT_DIR)/osmesa.so.dSYM/',
'<(PRODUCT_DIR)/unit_tests.dSYM/',
],
@@ -123,6 +126,7 @@
'../ui/base/glib/',
'<(PRODUCT_DIR)/blacklist_test_dll_1.dll',
'<(PRODUCT_DIR)/chrome_elf.dll',
+ '<(PRODUCT_DIR)/ffmpegsumo.dll',
'<(PRODUCT_DIR)/libexif.dll',
'<(PRODUCT_DIR)/osmesa.dll',
'<(PRODUCT_DIR)/verifier_test_dll_1.dll',
diff --git a/chrome/utility/extensions/extensions_handler.cc b/chrome/utility/extensions/extensions_handler.cc
index 942545e..982045f 100644
--- a/chrome/utility/extensions/extensions_handler.cc
+++ b/chrome/utility/extensions/extensions_handler.cc
@@ -65,8 +65,11 @@ void ExtensionsHandler::PreSandboxStartup() {
// Initialize libexif for image metadata parsing.
metadata::ImageMetadataExtractor::InitializeLibrary();
- // Initialize media libraries for media file validation.
- media::InitializeMediaLibrary();
+ // Load media libraries for media file validation.
+ base::FilePath media_path;
+ PathService::Get(content::DIR_MEDIA_LIBS, &media_path);
+ if (!media_path.empty())
+ media::InitializeMediaLibrary(media_path);
}
bool ExtensionsHandler::OnMessageReceived(const IPC::Message& message) {
diff --git a/chromecast/media/cma/test/run_all_unittests.cc b/chromecast/media/cma/test/run_all_unittests.cc
index 133f8bed..4820fb0 100644
--- a/chromecast/media/cma/test/run_all_unittests.cc
+++ b/chromecast/media/cma/test/run_all_unittests.cc
@@ -33,7 +33,7 @@ void CmaTestSuite::Initialize() {
// Initialize the FFMpeg library.
// Note: at this time, AtExitManager is already present.
- media::InitializeMediaLibrary();
+ media::InitializeMediaLibraryForTesting();
}
int main(int argc, char** argv) {
diff --git a/components/components_unittests.isolate b/components/components_unittests.isolate
index ccdaf16..3c1f393 100644
--- a/components/components_unittests.isolate
+++ b/components/components_unittests.isolate
@@ -54,6 +54,7 @@
['OS=="linux"', {
'variables': {
'files': [
+ '<(PRODUCT_DIR)/libffmpegsumo.so',
'<(PRODUCT_DIR)/libosmesa.so',
],
},
@@ -61,6 +62,7 @@
['OS=="mac"', {
'variables': {
'files': [
+ '<(PRODUCT_DIR)/ffmpegsumo.so',
'<(PRODUCT_DIR)/osmesa.so',
],
},
@@ -69,6 +71,7 @@
'variables': {
'files': [
'../chrome/test/data/policy/',
+ '<(PRODUCT_DIR)/ffmpegsumo.dll',
'<(PRODUCT_DIR)/osmesa.dll',
],
},
@@ -84,6 +87,7 @@
'variables': {
'files': [
'<(PRODUCT_DIR)/components_unittests.dSYM/',
+ '<(PRODUCT_DIR)/ffmpegsumo.so.dSYM/',
'<(PRODUCT_DIR)/osmesa.so.dSYM/',
],
},
diff --git a/components/html_viewer/media_factory.cc b/components/html_viewer/media_factory.cc
index 29a153b..101015a 100644
--- a/components/html_viewer/media_factory.cc
+++ b/components/html_viewer/media_factory.cc
@@ -88,7 +88,11 @@ MediaFactory::MediaFactory(
->HasSwitch(kEnableMojoMediaRenderer)),
compositor_task_runner_(compositor_task_runner),
shell_(shell) {
- media::InitializeMediaLibrary();
+ if (!media::IsMediaLibraryInitialized()) {
+ base::FilePath module_dir;
+ CHECK(PathService::Get(base::DIR_EXE, &module_dir));
+ CHECK(media::InitializeMediaLibrary(module_dir));
+ }
}
MediaFactory::~MediaFactory() {
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc
index 315f596..e4f8812 100644
--- a/content/app/content_main_runner.cc
+++ b/content/app/content_main_runner.cc
@@ -282,7 +282,12 @@ int RunZygote(const MainFunctionParams& main_function_params,
ScopedVector<ZygoteForkDelegate> zygote_fork_delegates;
if (delegate) {
delegate->ZygoteStarting(&zygote_fork_delegates);
- media::InitializeMediaLibrary();
+ // Each Renderer we spawn will re-attempt initialization of the media
+ // libraries, at which point failure will be detected and handled, so
+ // we do not need to cope with initialization failures here.
+ base::FilePath media_path;
+ if (PathService::Get(DIR_MEDIA_LIBS, &media_path))
+ media::InitializeMediaLibrary(media_path);
}
// This function call can return multiple times, once per fork().
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index 2a92285..eeeb4d1 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -547,7 +547,7 @@ void BrowserMainLoop::PostMainMessageLoopStart() {
#if !defined(OS_IOS)
{
TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:MediaFeatures");
- media::InitializeMediaLibrary();
+ media::InitializeCPUSpecificMediaFeatures();
}
{
TRACE_EVENT0("startup",
diff --git a/content/content_browsertests.isolate b/content/content_browsertests.isolate
index a6f069f..2fcab67 100644
--- a/content/content_browsertests.isolate
+++ b/content/content_browsertests.isolate
@@ -66,6 +66,7 @@
'variables': {
'files': [
'<(PRODUCT_DIR)/content_shell.pak',
+ '<(PRODUCT_DIR)/libffmpegsumo.so',
'<(PRODUCT_DIR)/libosmesa.so',
],
},
@@ -95,6 +96,7 @@
'variables': {
'files': [
'<(PRODUCT_DIR)/Content Shell.app/',
+ '<(PRODUCT_DIR)/ffmpegsumo.so',
'<(PRODUCT_DIR)/plugins/npapi_test_plugin.plugin/',
'<(PRODUCT_DIR)/plugins/test_netscape_plugin.plugin/',
'<(PRODUCT_DIR)/ppapi_tests.plugin/Contents/MacOS/ppapi_tests',
@@ -108,6 +110,7 @@
'<(PRODUCT_DIR)/Content Shell Helper.app.dSYM/',
'<(PRODUCT_DIR)/Content Shell.app.dSYM/',
'<(PRODUCT_DIR)/content_browsertests.dSYM/',
+ '<(PRODUCT_DIR)/ffmpegsumo.so.dSYM/',
'<(PRODUCT_DIR)/npapi_test_plugin.plugin.dSYM/',
'<(PRODUCT_DIR)/ppapi_tests.plugin.dSYM/',
'<(PRODUCT_DIR)/test_netscape_plugin.plugin.dSYM/',
@@ -118,6 +121,7 @@
'variables': {
'files': [
'<(PRODUCT_DIR)/content_shell.pak',
+ '<(PRODUCT_DIR)/ffmpegsumo.dll',
'<(PRODUCT_DIR)/osmesa.dll',
'<(PRODUCT_DIR)/plugins/np_test_netscape_plugin.dll',
'<(PRODUCT_DIR)/plugins/npapi_test_plugin.dll',
diff --git a/content/content_gl_tests.isolate b/content/content_gl_tests.isolate
index b685ea7..ea9938d 100644
--- a/content/content_gl_tests.isolate
+++ b/content/content_gl_tests.isolate
@@ -24,12 +24,27 @@
],
},
}],
+ ['OS=="linux"', {
+ 'variables': {
+ 'files': [
+ '<(PRODUCT_DIR)/libffmpegsumo.so',
+ ],
+ },
+ }],
+ ['OS=="mac"', {
+ 'variables': {
+ 'files': [
+ '<(PRODUCT_DIR)/ffmpegsumo.so',
+ ],
+ },
+ }],
['OS=="win"', {
'variables': {
'files': [
'<(PRODUCT_DIR)/d3dcompiler_47.dll',
'<(PRODUCT_DIR)/libEGL.dll',
'<(PRODUCT_DIR)/libGLESv2.dll',
+ '<(PRODUCT_DIR)/ffmpegsumo.dll',
'<(PRODUCT_DIR)/osmesa.dll',
],
},
diff --git a/content/content_shell.gypi b/content/content_shell.gypi
index 2f30de3..6893e2d 100644
--- a/content/content_shell.gypi
+++ b/content/content_shell.gypi
@@ -769,6 +769,13 @@
],
'copies': [
{
+ # Copy FFmpeg binaries for audio/video support.
+ 'destination': '<(PRODUCT_DIR)/$(CONTENTS_FOLDER_PATH)/Libraries',
+ 'files': [
+ '<(PRODUCT_DIR)/ffmpegsumo.so',
+ ],
+ },
+ {
'destination': '<(PRODUCT_DIR)/$(CONTENTS_FOLDER_PATH)/Resources',
'files': [
'<(PRODUCT_DIR)/crash_inspector',
diff --git a/content/content_unittests.isolate b/content/content_unittests.isolate
index 61eca66..07ac6e7 100644
--- a/content/content_unittests.isolate
+++ b/content/content_unittests.isolate
@@ -68,6 +68,7 @@
['OS=="linux"', {
'variables': {
'files': [
+ '<(PRODUCT_DIR)/libffmpegsumo.so',
'<(PRODUCT_DIR)/libosmesa.so',
],
},
@@ -75,6 +76,7 @@
['OS=="mac"', {
'variables': {
'files': [
+ '<(PRODUCT_DIR)/ffmpegsumo.so',
'<(PRODUCT_DIR)/osmesa.so',
],
},
@@ -82,6 +84,7 @@
['OS=="win"', {
'variables': {
'files': [
+ '<(PRODUCT_DIR)/ffmpegsumo.dll',
'<(PRODUCT_DIR)/osmesa.dll',
],
},
@@ -90,6 +93,7 @@
'variables': {
'files': [
'<(PRODUCT_DIR)/content_unittests.dSYM/',
+ '<(PRODUCT_DIR)/ffmpegsumo.so.dSYM/',
'<(PRODUCT_DIR)/osmesa.so.dSYM/',
],
},
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 7ad666e..d64ad77 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -647,7 +647,10 @@ void RenderThreadImpl::Init() {
// Note that under Linux, the media library will normally already have
// been initialized by the Zygote before this instance became a Renderer.
- media::InitializeMediaLibrary();
+ base::FilePath media_path;
+ PathService::Get(DIR_MEDIA_LIBS, &media_path);
+ if (!media_path.empty())
+ media::InitializeMediaLibrary(media_path);
memory_pressure_listener_.reset(new base::MemoryPressureListener(
base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this))));
@@ -1104,6 +1107,10 @@ void RenderThreadImpl::EnsureWebKitInitialized() {
EnableBlinkPlatformLogChannels(
command_line.GetSwitchValueASCII(switches::kBlinkPlatformLogChannels));
+ if (!media::IsMediaLibraryInitialized()) {
+ WebRuntimeFeatures::enableWebAudio(false);
+ }
+
RenderMediaClient::Initialize();
FOR_EACH_OBSERVER(RenderProcessObserver, observers_, WebKitInitialized());
diff --git a/content/test/content_test_suite.cc b/content/test/content_test_suite.cc
index e3b2ae28..20db1ea 100644
--- a/content/test/content_test_suite.cc
+++ b/content/test/content_test_suite.cc
@@ -153,7 +153,7 @@ void ContentTestSuite::Initialize() {
}
RegisterPathProvider();
#if !defined(OS_IOS)
- media::InitializeMediaLibrary();
+ media::InitializeMediaLibraryForTesting();
// When running in a child process for Mac sandbox tests, the sandbox exists
// to initialize GL, so don't do it here.
if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
diff --git a/content/test/test_blink_web_unit_test_support.cc b/content/test/test_blink_web_unit_test_support.cc
index 8a6f4fc..05a6b9b 100644
--- a/content/test/test_blink_web_unit_test_support.cc
+++ b/content/test/test_blink_web_unit_test_support.cc
@@ -127,9 +127,19 @@ TestBlinkWebUnitTestSupport::TestBlinkWebUnitTestSupport() {
blink::WebRuntimeFeatures::enableNotifications(true);
blink::WebRuntimeFeatures::enableTouch(true);
- // Initialize libraries for media and enable the media player.
- media::InitializeMediaLibrary();
- blink::WebRuntimeFeatures::enableMediaPlayer(true);
+ // Load libraries for media and enable the media player.
+ bool enable_media = false;
+ base::FilePath module_path;
+ if (PathService::Get(base::DIR_MODULE, &module_path)) {
+#if defined(OS_MACOSX)
+ if (base::mac::AmIBundled())
+ module_path = module_path.DirName().DirName().DirName();
+#endif
+ if (media::InitializeMediaLibrary(module_path))
+ enable_media = true;
+ }
+ blink::WebRuntimeFeatures::enableMediaPlayer(enable_media);
+ LOG_IF(WARNING, !enable_media) << "Failed to initialize the media library.\n";
file_utilities_.set_sandbox_enabled(false);
diff --git a/media/audio_unittests.isolate b/media/audio_unittests.isolate
index d91c636..fe84e1e 100644
--- a/media/audio_unittests.isolate
+++ b/media/audio_unittests.isolate
@@ -52,9 +52,31 @@
],
},
}],
+ ['OS=="linux"', {
+ 'variables': {
+ 'files': [
+ '<(PRODUCT_DIR)/libffmpegsumo.so',
+ ],
+ },
+ }],
+ ['OS=="mac"', {
+ 'variables': {
+ 'files': [
+ '<(PRODUCT_DIR)/ffmpegsumo.so',
+ ],
+ },
+ }],
+ ['OS=="win"', {
+ 'variables': {
+ 'files': [
+ '<(PRODUCT_DIR)/ffmpegsumo.dll',
+ ],
+ },
+ }],
['OS=="mac" and asan==1 and fastbuild==0', {
'variables': {
'files': [
+ '<(PRODUCT_DIR)/ffmpegsumo.so.dSYM/',
'<(PRODUCT_DIR)/audio_unittests.dSYM/',
],
},
diff --git a/media/base/BUILD.gn b/media/base/BUILD.gn
index 0ea6188..d81171e 100644
--- a/media/base/BUILD.gn
+++ b/media/base/BUILD.gn
@@ -216,6 +216,11 @@ source_set("base") {
"media_file_checker.cc",
"media_file_checker.h",
]
+ if (is_win) {
+ sources += [ "media_win.cc" ]
+ } else if (is_posix) {
+ sources += [ "media_posix.cc" ]
+ }
deps += [ "//third_party/ffmpeg" ]
}
@@ -230,6 +235,7 @@ source_set("base") {
}
if (is_android) {
+ sources += [ "media_stub.cc" ]
public_deps = [
"//media/base/android",
"//media/base/android:media_java",
diff --git a/media/base/media.cc b/media/base/media.cc
index c85d465..37fc02a 100644
--- a/media/base/media.cc
+++ b/media/base/media.cc
@@ -11,44 +11,70 @@
#include "build/build_config.h"
#include "media/base/yuv_convert.h"
-#if !defined(MEDIA_DISABLE_FFMPEG)
-#include "media/ffmpeg/ffmpeg_common.h"
-#endif
-
namespace media {
+namespace internal {
+// Platform specific initialization method.
+extern bool InitializeMediaLibraryInternal(const base::FilePath& module_dir);
+} // namespace internal
+
// Media must only be initialized once, so use a LazyInstance to ensure this.
class MediaInitializer {
+ public:
+ bool Initialize(const base::FilePath& module_dir) {
+ base::AutoLock auto_lock(lock_);
+ if (!tried_initialize_) {
+ tried_initialize_ = true;
+ initialized_ = internal::InitializeMediaLibraryInternal(module_dir);
+ }
+ return initialized_;
+ }
+
+ bool IsInitialized() {
+ base::AutoLock auto_lock(lock_);
+ return initialized_;
+ }
+
private:
friend struct base::DefaultLazyInstanceTraits<MediaInitializer>;
- MediaInitializer() {
+ MediaInitializer()
+ : initialized_(false),
+ tried_initialize_(false) {
// Perform initialization of libraries which require runtime CPU detection.
InitializeCPUSpecificYUVConversions();
-
-#if !defined(MEDIA_DISABLE_FFMPEG)
- // Disable logging as it interferes with layout tests.
- av_log_set_level(AV_LOG_QUIET);
-
-#if defined(ALLOCATOR_SHIM)
- // Remove allocation limit from ffmpeg, so calls go down to shim layer.
- av_max_alloc(0);
-#endif // defined(ALLOCATOR_SHIM)
-
-#endif // !defined(MEDIA_DISABLE_FFMPEG)
}
~MediaInitializer() {
NOTREACHED() << "MediaInitializer should be leaky!";
}
+ base::Lock lock_;
+ bool initialized_;
+ bool tried_initialize_;
+
DISALLOW_COPY_AND_ASSIGN(MediaInitializer);
};
static base::LazyInstance<MediaInitializer>::Leaky g_media_library =
LAZY_INSTANCE_INITIALIZER;
-void InitializeMediaLibrary() {
+bool InitializeMediaLibrary(const base::FilePath& module_dir) {
+ return g_media_library.Get().Initialize(module_dir);
+}
+
+void InitializeMediaLibraryForTesting() {
+ base::FilePath module_dir;
+ CHECK(PathService::Get(base::DIR_EXE, &module_dir));
+ CHECK(g_media_library.Get().Initialize(module_dir));
+}
+
+bool IsMediaLibraryInitialized() {
+ return g_media_library.Get().IsInitialized();
+}
+
+void InitializeCPUSpecificMediaFeatures() {
+ // Force initialization of the media initializer, but don't call Initialize().
g_media_library.Get();
}
diff --git a/media/base/media.h b/media/base/media.h
index 01a913b..c86e568 100644
--- a/media/base/media.h
+++ b/media/base/media.h
@@ -16,9 +16,32 @@ class FilePath;
namespace media {
-// Initializes media libraries (e.g. ffmpeg) as well as CPU specific media
-// features.
-MEDIA_EXPORT void InitializeMediaLibrary();
+// Attempts to initialize the media library (loading DLLs, DSOs, etc.).
+//
+// If |module_dir| is the empty string, then the system default library paths
+// are searched for the dynamic libraries. If a |module_dir| is provided, then
+// only the specified |module_dir| will be searched for the dynamic libraries.
+//
+// If multiple initializations are attempted with different |module_dir|s
+// specified then the first one to succeed remains effective for the lifetime
+// of the process.
+//
+// Returns true if everything was successfully initialized, false otherwise.
+MEDIA_EXPORT bool InitializeMediaLibrary(const base::FilePath& module_dir);
+
+// Helper function for unit tests to avoid boiler plate code everywhere. This
+// function will crash if it fails to load the media library. This ensures tests
+// fail if the media library is not available.
+MEDIA_EXPORT void InitializeMediaLibraryForTesting();
+
+// Use this if you need to check whether the media library is initialized
+// for the this process, without actually trying to initialize it.
+MEDIA_EXPORT bool IsMediaLibraryInitialized();
+
+// Use this if you need to initialize CPU specific features WITHOUT loading
+// DLLs, DSOs, etc. Only necessary if InitializeMediaLibrary() is not called;
+// does nothing if the media library has already been initialized.
+MEDIA_EXPORT void InitializeCPUSpecificMediaFeatures();
} // namespace media
diff --git a/media/base/media_posix.cc b/media/base/media_posix.cc
new file mode 100644
index 0000000..f8f0c99
--- /dev/null
+++ b/media/base/media_posix.cc
@@ -0,0 +1,66 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/base/media.h"
+
+#include <string>
+
+#include "base/files/file_path.h"
+#include "base/logging.h"
+#include "base/strings/stringize_macros.h"
+#include "media/ffmpeg/ffmpeg_common.h"
+#include "third_party/ffmpeg/ffmpeg_stubs.h"
+
+using third_party_ffmpeg::kNumStubModules;
+using third_party_ffmpeg::kModuleFfmpegsumo;
+using third_party_ffmpeg::InitializeStubs;
+using third_party_ffmpeg::StubPathMap;
+
+namespace media {
+namespace internal {
+
+// Handy to prevent shooting ourselves in the foot with macro wizardry.
+#if !defined(LIBAVCODEC_VERSION_MAJOR) || \
+ !defined(LIBAVFORMAT_VERSION_MAJOR) || \
+ !defined(LIBAVUTIL_VERSION_MAJOR)
+#error FFmpeg headers not included!
+#endif
+
+#define AVCODEC_VERSION STRINGIZE(LIBAVCODEC_VERSION_MAJOR)
+#define AVFORMAT_VERSION STRINGIZE(LIBAVFORMAT_VERSION_MAJOR)
+#define AVUTIL_VERSION STRINGIZE(LIBAVUTIL_VERSION_MAJOR)
+
+#if defined(OS_MACOSX)
+// TODO(evan): should be using .so like ffmepgsumo here.
+#define DSO_NAME(MODULE, VERSION) ("lib" MODULE "." VERSION ".dylib")
+static const base::FilePath::CharType kSumoLib[] =
+ FILE_PATH_LITERAL("ffmpegsumo.so");
+#elif defined(OS_POSIX)
+#define DSO_NAME(MODULE, VERSION) ("lib" MODULE ".so." VERSION)
+static const base::FilePath::CharType kSumoLib[] =
+ FILE_PATH_LITERAL("libffmpegsumo.so");
+#else
+#error "Do not know how to construct DSO name for this OS."
+#endif
+
+bool InitializeMediaLibraryInternal(const base::FilePath& module_dir) {
+ StubPathMap paths;
+
+ // First try to initialize with Chrome's sumo library.
+ DCHECK_EQ(kNumStubModules, 1);
+ paths[kModuleFfmpegsumo].push_back(module_dir.Append(kSumoLib).value());
+
+ // If that fails, see if any system libraries are available.
+ paths[kModuleFfmpegsumo].push_back(module_dir.Append(
+ FILE_PATH_LITERAL(DSO_NAME("avutil", AVUTIL_VERSION))).value());
+ paths[kModuleFfmpegsumo].push_back(module_dir.Append(
+ FILE_PATH_LITERAL(DSO_NAME("avcodec", AVCODEC_VERSION))).value());
+ paths[kModuleFfmpegsumo].push_back(module_dir.Append(
+ FILE_PATH_LITERAL(DSO_NAME("avformat", AVFORMAT_VERSION))).value());
+
+ return InitializeStubs(paths);
+}
+
+} // namespace internal
+} // namespace media
diff --git a/media/base/media_stub.cc b/media/base/media_stub.cc
new file mode 100644
index 0000000..e3e02e4
--- /dev/null
+++ b/media/base/media_stub.cc
@@ -0,0 +1,19 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/base/media.h"
+
+#include "base/files/file_path.h"
+
+// This file is intended for platforms that don't need to load any media
+// libraries (e.g., Android).
+namespace media {
+namespace internal {
+
+bool InitializeMediaLibraryInternal(const base::FilePath& module_dir) {
+ return true;
+}
+
+} // namespace internal
+} // namespace media
diff --git a/media/base/media_win.cc b/media/base/media_win.cc
new file mode 100644
index 0000000..03d78b1
--- /dev/null
+++ b/media/base/media_win.cc
@@ -0,0 +1,56 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/base/media.h"
+
+#include <windows.h>
+#if defined(_WIN32_WINNT_WIN8)
+// The Windows 8 SDK defines FACILITY_VISUALCPP in winerror.h.
+#undef FACILITY_VISUALCPP
+#endif
+#include <delayimp.h>
+
+#include "base/files/file_path.h"
+#include "base/metrics/sparse_histogram.h"
+#include "media/ffmpeg/ffmpeg_common.h"
+
+#pragma comment(lib, "delayimp.lib")
+
+namespace media {
+namespace internal {
+
+bool InitializeMediaLibraryInternal(const base::FilePath& module_dir) {
+ // LoadLibraryEx(..., LOAD_WITH_ALTERED_SEARCH_PATH) cannot handle
+ // relative path.
+ if (!module_dir.IsAbsolute())
+ return false;
+
+ // Use alternate DLL search path so we don't load dependencies from the
+ // system path. Refer to http://crbug.com/35857
+ static const char kFFmpegDLL[] = "ffmpegsumo.dll";
+ HMODULE lib = ::LoadLibraryEx(
+ module_dir.AppendASCII(kFFmpegDLL).value().c_str(), NULL,
+ LOAD_WITH_ALTERED_SEARCH_PATH);
+
+ bool initialized = (lib != NULL);
+
+ // TODO(scherkus): Remove all the bool-ness from these functions as we no
+ // longer support disabling HTML5 media at runtime. http://crbug.com/440892
+ if (!initialized) {
+ UMA_HISTOGRAM_SPARSE_SLOWLY("Media.Initialize.Windows", GetLastError());
+ return false;
+ }
+
+ // VS2013 has a bug where FMA3 instructions will be executed on CPUs that
+ // support them despite them being disabled at the OS level, causing illegal
+ // instruction exceptions. Because Web Audio's FFT code *might* run before
+ // HTML5 media code, call av_log_set_level() to force library initialziation.
+ // See http://crbug.com/440892 for details.
+ av_log_set_level(AV_LOG_QUIET);
+
+ return initialized;
+}
+
+} // namespace internal
+} // namespace media
diff --git a/media/base/run_all_perftests.cc b/media/base/run_all_perftests.cc
index dcf58fe..cf6bc47 100644
--- a/media/base/run_all_perftests.cc
+++ b/media/base/run_all_perftests.cc
@@ -37,7 +37,7 @@ void TestSuiteNoAtExit::Initialize() {
// Run this here instead of main() to ensure an AtExitManager is already
// present.
- media::InitializeMediaLibrary();
+ media::InitializeMediaLibraryForTesting();
}
int main(int argc, char** argv) {
diff --git a/media/base/run_all_unittests.cc b/media/base/run_all_unittests.cc
index 7c0c14a..0f741c3 100644
--- a/media/base/run_all_unittests.cc
+++ b/media/base/run_all_unittests.cc
@@ -42,7 +42,7 @@ void TestSuiteNoAtExit::Initialize() {
// Run this here instead of main() to ensure an AtExitManager is already
// present.
- media::InitializeMediaLibrary();
+ media::InitializeMediaLibraryForTesting();
}
int main(int argc, char** argv) {
diff --git a/media/blink/run_all_unittests.cc b/media/blink/run_all_unittests.cc
index 74f9ab9..0261dc2 100644
--- a/media/blink/run_all_unittests.cc
+++ b/media/blink/run_all_unittests.cc
@@ -76,7 +76,7 @@ void BlinkMediaTestSuite::Initialize() {
// Run this here instead of main() to ensure an AtExitManager is already
// present.
- media::InitializeMediaLibrary();
+ media::InitializeMediaLibraryForTesting();
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
gin::V8Initializer::LoadV8Snapshot();
diff --git a/media/cast/cast_unittests.isolate b/media/cast/cast_unittests.isolate
index bf207cd..26b9395 100644
--- a/media/cast/cast_unittests.isolate
+++ b/media/cast/cast_unittests.isolate
@@ -34,6 +34,13 @@
],
},
}],
+ ['OS=="linux"', {
+ 'variables': {
+ 'files': [
+ '<(PRODUCT_DIR)/libffmpegsumo.so',
+ ],
+ },
+ }],
['OS=="linux" or OS=="mac" or OS=="win"', {
'variables': {
'files': [
@@ -42,6 +49,13 @@
],
},
}],
+ ['OS=="mac"', {
+ 'variables': {
+ 'files': [
+ '<(PRODUCT_DIR)/ffmpegsumo.so',
+ ],
+ },
+ }],
['OS=="mac" and asan==1 and fastbuild==0', {
'variables': {
'files': [
@@ -49,6 +63,13 @@
],
},
}],
+ ['OS=="win"', {
+ 'variables': {
+ 'files': [
+ '<(PRODUCT_DIR)/ffmpegsumo.dll',
+ ],
+ },
+ }],
['OS=="win" and (fastbuild==0 or fastbuild==1)', {
'variables': {
'files': [
diff --git a/media/cast/sender/audio_encoder_unittest.cc b/media/cast/sender/audio_encoder_unittest.cc
index 3b623fe..12b5f2c 100644
--- a/media/cast/sender/audio_encoder_unittest.cc
+++ b/media/cast/sender/audio_encoder_unittest.cc
@@ -95,7 +95,7 @@ struct TestScenario {
class AudioEncoderTest : public ::testing::TestWithParam<TestScenario> {
public:
AudioEncoderTest() {
- InitializeMediaLibrary();
+ InitializeMediaLibraryForTesting();
testing_clock_ = new base::SimpleTestTickClock();
testing_clock_->Advance(base::TimeTicks::Now() - base::TimeTicks());
}
diff --git a/media/cast/sender/audio_sender_unittest.cc b/media/cast/sender/audio_sender_unittest.cc
index 1f4ae9e..b0662804 100644
--- a/media/cast/sender/audio_sender_unittest.cc
+++ b/media/cast/sender/audio_sender_unittest.cc
@@ -67,7 +67,7 @@ class TestPacketSender : public PacketSender {
class AudioSenderTest : public ::testing::Test {
protected:
AudioSenderTest() {
- InitializeMediaLibrary();
+ InitializeMediaLibraryForTesting();
testing_clock_ = new base::SimpleTestTickClock();
testing_clock_->Advance(base::TimeTicks::Now() - base::TimeTicks());
task_runner_ = new test::FakeSingleThreadTaskRunner(testing_clock_);
diff --git a/media/cast/sender/h264_vt_encoder_unittest.cc b/media/cast/sender/h264_vt_encoder_unittest.cc
index 534664b..d9790a8 100644
--- a/media/cast/sender/h264_vt_encoder_unittest.cc
+++ b/media/cast/sender/h264_vt_encoder_unittest.cc
@@ -42,7 +42,7 @@ void MediaTestSuite::Initialize() {
base::TestSuite::Initialize();
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
command_line->AppendSwitch(switches::kEnableInbandTextTracks);
- media::InitializeMediaLibrary();
+ media::InitializeMediaLibraryForTesting();
}
} // namespace
diff --git a/media/cast/test/sender.cc b/media/cast/test/sender.cc
index 4e3a8db..7398698 100644
--- a/media/cast/test/sender.cc
+++ b/media/cast/test/sender.cc
@@ -204,8 +204,13 @@ int main(int argc, char** argv) {
base::CommandLine::Init(argc, argv);
InitLogging(logging::LoggingSettings());
- // Prepare media module for FFmpeg decoding.
- media::InitializeMediaLibrary();
+ // Load the media module for FFmpeg decoding.
+ base::FilePath path;
+ PathService::Get(base::DIR_MODULE, &path);
+ if (!media::InitializeMediaLibrary(path)) {
+ LOG(ERROR) << "Could not initialize media library.";
+ return 1;
+ }
base::Thread test_thread("Cast sender test app thread");
base::Thread audio_thread("Cast audio encoder thread");
diff --git a/media/cast/test/simulator.cc b/media/cast/test/simulator.cc
index 540f377..a3a560e 100644
--- a/media/cast/test/simulator.cc
+++ b/media/cast/test/simulator.cc
@@ -739,7 +739,10 @@ int main(int argc, char** argv) {
}
}
- media::InitializeMediaLibrary();
+ if (!media::InitializeMediaLibrary(media_path)) {
+ LOG(ERROR) << "Failed to initialize FFmpeg.";
+ return 1;
+ }
base::FilePath source_path = cmd->GetSwitchValuePath(
media::cast::kSourcePath);
diff --git a/media/cdm/ppapi/external_clear_key/clear_key_cdm.cc b/media/cdm/ppapi/external_clear_key/clear_key_cdm.cc
index 6087dcc..6a6ff62 100644
--- a/media/cdm/ppapi/external_clear_key/clear_key_cdm.cc
+++ b/media/cdm/ppapi/external_clear_key/clear_key_cdm.cc
@@ -44,17 +44,25 @@ MSVC_PUSH_DISABLE_WARNING(4244);
MSVC_POP_WARNING();
} // extern "C"
+// TODO(tomfinegan): When COMPONENT_BUILD is not defined an AtExitManager must
+// exist before the call to InitializeFFmpegLibraries(). This should no longer
+// be required after http://crbug.com/91970 because we'll be able to get rid of
+// InitializeFFmpegLibraries().
#if !defined COMPONENT_BUILD
static base::AtExitManager g_at_exit_manager;
#endif
-// Prepare media library.
+// TODO(tomfinegan): InitializeFFmpegLibraries() and |g_cdm_module_initialized|
+// are required for running in the sandbox, and should no longer be required
+// after http://crbug.com/91970 is fixed.
static bool InitializeFFmpegLibraries() {
- media::InitializeMediaLibrary();
+ base::FilePath file_path;
+ CHECK(PathService::Get(base::DIR_MODULE, &file_path));
+ CHECK(media::InitializeMediaLibrary(file_path));
return true;
}
-static bool g_ffmpeg_lib_initialized = InitializeFFmpegLibraries();
+static bool g_ffmpeg_lib_initialized = InitializeFFmpegLibraries();
#endif // CLEAR_KEY_CDM_USE_FFMPEG_DECODER
const char kClearKeyCdmVersion[] = "0.1.0.1";
@@ -222,6 +230,7 @@ class ScopedResetter {
void INITIALIZE_CDM_MODULE() {
#if defined(CLEAR_KEY_CDM_USE_FFMPEG_DECODER)
+ DVLOG(2) << "FFmpeg libraries initialized: " << g_ffmpeg_lib_initialized;
av_register_all();
#endif // CLEAR_KEY_CDM_USE_FFMPEG_DECODER
}
diff --git a/media/ffmpeg/ffmpeg_common_unittest.cc b/media/ffmpeg/ffmpeg_common_unittest.cc
index 47c3db3..ff07307 100644
--- a/media/ffmpeg/ffmpeg_common_unittest.cc
+++ b/media/ffmpeg/ffmpeg_common_unittest.cc
@@ -4,7 +4,6 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
-#include "media/base/media.h"
#include "media/ffmpeg/ffmpeg_common.h"
#include "media/filters/ffmpeg_glue.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -13,9 +12,7 @@ namespace media {
class FFmpegCommonTest : public testing::Test {
public:
- FFmpegCommonTest() {
- FFmpegGlue::InitializeFFmpeg();
- }
+ FFmpegCommonTest() { FFmpegGlue::InitializeFFmpeg(); }
~FFmpegCommonTest() override{};
};
@@ -92,6 +89,17 @@ TEST_F(FFmpegCommonTest, UTCDateToTime_Valid) {
EXPECT_EQ(0, exploded.millisecond);
}
+#if defined(ALLOCATOR_SHIM) && defined(GTEST_HAS_DEATH_TEST)
+TEST_F(FFmpegCommonTest, WinAllocatorShimDeathTest) {
+ scoped_ptr<char, base::FreeDeleter> ptr;
+ // INT_MAX - 128 is carefully chosen to be below the default limit for
+ // ffmpeg allocations, but above the maximum allowed limit by the allocator
+ // shim, so we can be certain the code is being hit.
+ EXPECT_DEATH(ptr.reset(static_cast<char*>(av_malloc(INT_MAX - 128))), "");
+ ASSERT_TRUE(!ptr);
+}
+#endif
+
TEST_F(FFmpegCommonTest, UTCDateToTime_Invalid) {
const char* invalid_date_strings[] = {
"",
diff --git a/media/filters/ffmpeg_glue.cc b/media/filters/ffmpeg_glue.cc
index 7643f23..20ebeaf 100644
--- a/media/filters/ffmpeg_glue.cc
+++ b/media/filters/ffmpeg_glue.cc
@@ -96,6 +96,9 @@ class FFmpegInitializer {
FFmpegInitializer()
: initialized_(false) {
+ // Before doing anything disable logging as it interferes with layout tests.
+ av_log_set_level(AV_LOG_QUIET);
+
// Register our protocol glue code with FFmpeg.
if (av_lockmgr_register(&LockManagerOperation) != 0)
return;
diff --git a/media/media.gyp b/media/media.gyp
index 4afbb70..5b32db6 100644
--- a/media/media.gyp
+++ b/media/media.gyp
@@ -322,8 +322,10 @@
'base/media_log_event.h',
'base/media_permission.cc',
'base/media_permission.h',
+ 'base/media_posix.cc',
'base/media_switches.cc',
'base/media_switches.h',
+ 'base/media_win.cc',
'base/mime_util.cc',
'base/mime_util.h',
'base/moving_average.cc',
@@ -619,6 +621,7 @@
'base/container_names.h',
'base/media_file_checker.cc',
'base/media_file_checker.h',
+ 'base/media_posix.cc',
'ffmpeg/ffmpeg_common.cc',
'ffmpeg/ffmpeg_common.h',
'filters/audio_file_reader.cc',
@@ -687,6 +690,7 @@
'sources': [
'base/media.cc',
'base/media.h',
+ 'base/media_stub.cc',
],
'sources!': [
'filters/opus_audio_decoder.cc',
@@ -1247,7 +1251,7 @@
'test/pipeline_integration_test_base.cc',
],
}],
- ['(os_posix==1 and OS!="mac") or (OS=="win" and component!="shared_library" and win_use_allocator_shim==1)', {
+ ['os_posix==1 and OS!="mac"', {
'conditions': [
['use_allocator!="none"', {
'dependencies': [
diff --git a/media/media_nacl.gyp b/media/media_nacl.gyp
index f345376..9697a8a 100644
--- a/media/media_nacl.gyp
+++ b/media/media_nacl.gyp
@@ -53,6 +53,7 @@
'sources': [
'base/media.cc',
'base/media.h',
+ 'base/media_stub.cc',
'base/simd/convert_rgb_to_yuv.h',
'base/simd/convert_rgb_to_yuv_c.cc',
'base/simd/convert_yuv_to_rgb.h',
@@ -62,9 +63,6 @@
'base/yuv_convert.cc',
'base/yuv_convert.h',
],
- 'defines': [
- 'MEDIA_DISABLE_FFMPEG',
- ],
}, # end of target 'media_yuv_nacl'
],
}],
diff --git a/media/media_unittests.isolate b/media/media_unittests.isolate
index 7c0d4e4..449fa88 100644
--- a/media/media_unittests.isolate
+++ b/media/media_unittests.isolate
@@ -52,9 +52,31 @@
],
},
}],
+ ['OS=="linux"', {
+ 'variables': {
+ 'files': [
+ '<(PRODUCT_DIR)/libffmpegsumo.so',
+ ],
+ },
+ }],
+ ['OS=="mac"', {
+ 'variables': {
+ 'files': [
+ '<(PRODUCT_DIR)/ffmpegsumo.so',
+ ],
+ },
+ }],
+ ['OS=="win"', {
+ 'variables': {
+ 'files': [
+ '<(PRODUCT_DIR)/ffmpegsumo.dll',
+ ],
+ },
+ }],
['OS=="mac" and asan==1 and fastbuild==0', {
'variables': {
'files': [
+ '<(PRODUCT_DIR)/ffmpegsumo.so.dSYM/',
'<(PRODUCT_DIR)/media_unittests.dSYM/',
],
},
diff --git a/media/mojo/services/renderer_config_default.cc b/media/mojo/services/renderer_config_default.cc
index 3b520ef..7cee1a7 100644
--- a/media/mojo/services/renderer_config_default.cc
+++ b/media/mojo/services/renderer_config_default.cc
@@ -41,7 +41,12 @@ class DummyVideoRendererSink : public VideoRendererSink {
class DefaultRendererConfig : public PlatformRendererConfig {
public:
DefaultRendererConfig() {
- InitializeMediaLibrary();
+ // TODO(dalecurtis): This will not work if the process is sandboxed...
+ if (!media::IsMediaLibraryInitialized()) {
+ base::FilePath module_dir;
+ CHECK(PathService::Get(base::DIR_EXE, &module_dir));
+ CHECK(media::InitializeMediaLibrary(module_dir));
+ }
// TODO(dalecurtis): We should find a single owner per process for the audio
// manager or make it a lazy instance. It's not safe to call Get()/Create()
diff --git a/media/test/pipeline_integration_test.cc b/media/test/pipeline_integration_test.cc
index 5ae62a0..78ebfe0 100644
--- a/media/test/pipeline_integration_test.cc
+++ b/media/test/pipeline_integration_test.cc
@@ -631,7 +631,8 @@ class PipelineIntegrationTestHost : public mojo::test::ApplicationTestBase,
void SetUp() override {
ApplicationTestBase::SetUp();
- InitializeMediaLibrary();
+ if (!IsMediaLibraryInitialized())
+ InitializeMediaLibraryForTesting();
}
protected:
diff --git a/remoting/base/run_all_unittests.cc b/remoting/base/run_all_unittests.cc
index a9c5b64..5f52f7e 100644
--- a/remoting/base/run_all_unittests.cc
+++ b/remoting/base/run_all_unittests.cc
@@ -14,8 +14,8 @@ int main(int argc, char** argv) {
// single-threaded.
net::EnableSSLServerSockets();
- // Ensures that media library and specific CPU features are initialized.
- media::InitializeMediaLibrary();
+ // Ensures runtime specific CPU features are initialized.
+ media::InitializeCPUSpecificMediaFeatures();
return base::LaunchUnitTests(
argc, argv, base::Bind(&base::TestSuite::Run,
diff --git a/remoting/host/it2me/it2me_native_messaging_host.cc b/remoting/host/it2me/it2me_native_messaging_host.cc
index 4c2cb3b..415681c 100644
--- a/remoting/host/it2me/it2me_native_messaging_host.cc
+++ b/remoting/host/it2me/it2me_native_messaging_host.cc
@@ -50,8 +50,8 @@ It2MeNativeMessagingHost::It2MeNativeMessagingHost(
weak_factory_(this) {
weak_ptr_ = weak_factory_.GetWeakPtr();
- // Ensures that media library and specific CPU features are initialized.
- media::InitializeMediaLibrary();
+ // Ensures runtime specific CPU features are initialized.
+ media::InitializeCPUSpecificMediaFeatures();
const ServiceUrls* service_urls = ServiceUrls::GetInstance();
const bool xmpp_server_valid =
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc
index 34aa83f..943d1d8 100644
--- a/remoting/host/remoting_me2me_host.cc
+++ b/remoting/host/remoting_me2me_host.cc
@@ -1555,8 +1555,8 @@ int HostProcessMain() {
// single-threaded.
net::EnableSSLServerSockets();
- // Ensures that media library and specific CPU features are initialized.
- media::InitializeMediaLibrary();
+ // Ensures runtime specific CPU features are initialized.
+ media::InitializeCPUSpecificMediaFeatures();
// Create the main message loop and start helper threads.
base::MessageLoopForUI message_loop;
diff --git a/testing/chromoting/chromoting_integration_tests.isolate b/testing/chromoting/chromoting_integration_tests.isolate
index eb7fec0..6062cb2 100644
--- a/testing/chromoting/chromoting_integration_tests.isolate
+++ b/testing/chromoting/chromoting_integration_tests.isolate
@@ -24,6 +24,7 @@
'../xvfb.py',
'./browser_tests_launcher.py',
'./browser_test_commands_linux.txt',
+ '<(PRODUCT_DIR)/libffmpegsumo.so',
'<(PRODUCT_DIR)/libosmesa.so',
'<(PRODUCT_DIR)/nacl_irt_x86_64.nexe',
'../../remoting/tools/internal/test-account-host-config.json',
@@ -70,6 +71,7 @@
'variables': {
'files': [
'<(PRODUCT_DIR)/chrome_elf.dll',
+ '<(PRODUCT_DIR)/ffmpegsumo.dll',
'<(PRODUCT_DIR)/libglesv2.dll',
],
},
@@ -79,6 +81,7 @@
'files': [
'<(PRODUCT_DIR)/<(mac_product_name).app/',
'<(PRODUCT_DIR)/exif.so',
+ '<(PRODUCT_DIR)/ffmpegsumo.so',
],
},
}],
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index e43353b..bbc4354 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -15549,9 +15549,6 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</histogram>
<histogram name="Media.Initialize.Windows" units="GetLastError">
- <obsolete>
- Deprecated 05/2015 in Issue 1141703002. FFmpeg is now statically linked.
- </obsolete>
<owner>scherkus@chromium.org</owner>
<summary>
Errors returned by LoadLibraryEx on Windows while attempting to load