From fd11b3c3aa6730ae1f024811b61913cd63f9d39a Mon Sep 17 00:00:00 2001 From: chcunningham Date: Mon, 8 Jun 2015 19:09:42 -0700 Subject: Chromium changes to statically link ffmpeg. Motivations: 1. Eliminates a large number of windows crashes hit while loading the DLL (see bugs) 2. Reducing the size of binary (about 400KB on linux, about 265KB on 32bit windows) due to dead-code elimination 3. Simplifying media library initialization (Remove bool-ness, it just works) Licensing: We've audited all the licenses for the files we actually use and have the green light from legal as long as we include the license text in the credits. BUG=435455, 429131, 441908 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Committed: https://crrev.com/bfef6d6ba82b172ac0e48c80d9ccf1a1ca0ea5c5 Cr-Commit-Position: refs/heads/master@{#332891} Review URL: https://codereview.chromium.org/1141703002 Cr-Commit-Position: refs/heads/master@{#333423} --- DEPS | 2 +- ash/ash_unittests.isolate | 2 - cc/cc_unittests.isolate | 3 - cc/trees/layer_tree_host_impl_unittest.cc | 2 +- cc/trees/layer_tree_host_unittest_context.cc | 2 +- chrome/chrome.isolate | 4 -- chrome/chrome_dll_bundle.gypi | 1 - chrome/chrome_installer.gypi | 1 - chrome/installer/linux/common/installer.include | 3 - chrome/installer/mini_installer/chrome.release | 1 - chrome/interactive_ui_tests.isolate | 4 -- chrome/plugin/chrome_content_plugin_client.cc | 7 +-- chrome/sync_integration_tests.isolate | 4 -- chrome/test/base/chrome_test_suite.cc | 2 +- .../client/deps/chrome_test/setup_test_links.sh | 1 - .../client/deps/pyauto_dep/setup_test_links.sh | 1 - chrome/tools/build/chromeos/FILES.cfg | 4 -- chrome/tools/build/linux/FILES.cfg | 4 -- chrome/tools/build/mac/TESTS | 1 - chrome/tools/build/mac/dump_product_syms | 1 - chrome/tools/build/win/FILES.cfg | 5 -- chrome/unit_tests.isolate | 4 -- chrome/utility/extensions/extensions_handler.cc | 7 +-- chromecast/media/cma/test/run_all_unittests.cc | 2 +- components/components_unittests.isolate | 4 -- components/html_viewer/media_factory.cc | 6 +- content/app/content_main_runner.cc | 7 +-- content/browser/browser_main_loop.cc | 2 +- content/content_browsertests.isolate | 4 -- content/content_gl_tests.isolate | 15 ----- content/content_shell.gypi | 7 --- content/content_unittests.isolate | 4 -- content/renderer/render_thread_impl.cc | 9 +-- content/test/content_test_suite.cc | 2 +- content/test/test_blink_web_unit_test_support.cc | 16 +----- media/audio_unittests.isolate | 22 -------- media/base/BUILD.gn | 6 -- media/base/media.cc | 60 ++++++-------------- media/base/media.h | 29 +--------- media/base/media_posix.cc | 66 ---------------------- media/base/media_stub.cc | 19 ------- media/base/media_win.cc | 56 ------------------ media/base/run_all_perftests.cc | 2 +- media/base/run_all_unittests.cc | 2 +- media/blink/run_all_unittests.cc | 2 +- media/cast/cast_unittests.isolate | 21 ------- media/cast/sender/audio_encoder_unittest.cc | 2 +- media/cast/sender/audio_sender_unittest.cc | 2 +- media/cast/sender/h264_vt_encoder_unittest.cc | 2 +- media/cast/test/sender.cc | 9 +-- media/cast/test/simulator.cc | 5 +- .../cdm/ppapi/external_clear_key/clear_key_cdm.cc | 15 +---- media/ffmpeg/ffmpeg_common_unittest.cc | 16 ++---- media/filters/ffmpeg_glue.cc | 3 - media/media.gyp | 6 +- media/media_nacl.gyp | 4 +- media/media_unittests.isolate | 22 -------- media/mojo/services/renderer_config_default.cc | 7 +-- media/test/pipeline_integration_test.cc | 3 +- remoting/base/run_all_unittests.cc | 4 +- remoting/host/it2me/it2me_native_messaging_host.cc | 4 +- remoting/host/remoting_me2me_host.cc | 4 +- .../chromoting_integration_tests.isolate | 3 - tools/metrics/histograms/histograms.xml | 3 + 64 files changed, 68 insertions(+), 475 deletions(-) delete mode 100644 media/base/media_posix.cc delete mode 100644 media/base/media_stub.cc delete mode 100644 media/base/media_win.cc diff --git a/DEPS b/DEPS index 4afc9f9..fc9da1e 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' + '@' + 'c0f05636c4472e5d3c0045ec34464aec46c5fb70', + Var('chromium_git') + '/chromium/third_party/ffmpeg.git' + '@' + '0ec2f1eee82359bb9c02a912feb1914a3a169cbe', 'src/third_party/libjingle/source/talk': Var('chromium_git') + '/external/webrtc/trunk/talk.git' + '@' + '76def906af6fd52acec7b8dbc3d2de83cf510a76', # commit position 9392 diff --git a/ash/ash_unittests.isolate b/ash/ash_unittests.isolate index 40e3e79..4866e71 100644 --- a/ash/ash_unittests.isolate +++ b/ash/ash_unittests.isolate @@ -41,7 +41,6 @@ ['OS=="linux"', { 'variables': { 'files': [ - '<(PRODUCT_DIR)/libffmpegsumo.so', '<(PRODUCT_DIR)/libosmesa.so', ], }, @@ -49,7 +48,6 @@ ['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 7c359d0..6a16fcd 100644 --- a/cc/cc_unittests.isolate +++ b/cc/cc_unittests.isolate @@ -46,7 +46,6 @@ ['OS=="linux"', { 'variables': { 'files': [ - '<(PRODUCT_DIR)/libffmpegsumo.so', '<(PRODUCT_DIR)/libosmesa.so', ], }, @@ -54,7 +53,6 @@ ['OS=="mac"', { 'variables': { 'files': [ - '<(PRODUCT_DIR)/ffmpegsumo.so', '<(PRODUCT_DIR)/osmesa.so', ], }, @@ -62,7 +60,6 @@ ['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 5e9fcce..2dedeed 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::InitializeMediaLibraryForTesting(); + media::InitializeMediaLibrary(); } LayerTreeSettings DefaultSettings() { diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc index e440260..c7dd28c 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::InitializeMediaLibraryForTesting(); + media::InitializeMediaLibrary(); } void LoseContext() { diff --git a/chrome/chrome.isolate b/chrome/chrome.isolate index 6ba6903..43bc605 100644 --- a/chrome/chrome.isolate +++ b/chrome/chrome.isolate @@ -6,7 +6,6 @@ ['OS=="linux"', { 'variables': { 'files': [ - '<(PRODUCT_DIR)/libffmpegsumo.so', '<(PRODUCT_DIR)/libosmesa.so', ], }, @@ -71,7 +70,6 @@ '<(PRODUCT_DIR)/<(mac_product_name) Helper.app/', '<(PRODUCT_DIR)/<(mac_product_name).app/', '<(PRODUCT_DIR)/exif.so', - '<(PRODUCT_DIR)/ffmpegsumo.so', ], }, }], @@ -82,7 +80,6 @@ '<(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/', ], }, }], @@ -93,7 +90,6 @@ '<(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 a938500..e9fc103 100644 --- a/chrome/chrome_dll_bundle.gypi +++ b/chrome/chrome_dll_bundle.gypi @@ -136,7 +136,6 @@ '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 cc1a332..99ccd5c 100644 --- a/chrome/chrome_installer.gypi +++ b/chrome/chrome_installer.gypi @@ -438,7 +438,6 @@ # 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 14171f7..7f4ef77 100644 --- a/chrome/installer/linux/common/installer.include +++ b/chrome/installer/linux/common/installer.include @@ -156,9 +156,6 @@ 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 b6d3d48..07bc305 100644 --- a/chrome/installer/mini_installer/chrome.release +++ b/chrome/installer/mini_installer/chrome.release @@ -24,7 +24,6 @@ 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 084c69ab..f013ef6 100644 --- a/chrome/interactive_ui_tests.isolate +++ b/chrome/interactive_ui_tests.isolate @@ -35,7 +35,6 @@ ['OS=="linux"', { 'variables': { 'files': [ - '<(PRODUCT_DIR)/libffmpegsumo.so', '<(PRODUCT_DIR)/libosmesa.so', '<(PRODUCT_DIR)/libppapi_tests.so', '<(PRODUCT_DIR)/pyproto/google/', @@ -77,7 +76,6 @@ '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', ], @@ -88,7 +86,6 @@ '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/', @@ -100,7 +97,6 @@ '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 d54e0c4..3e254c6 100644 --- a/chrome/plugin/chrome_content_plugin_client.cc +++ b/chrome/plugin/chrome_content_plugin_client.cc @@ -44,11 +44,8 @@ void ChromeContentPluginClient::PreSandboxInitialization() { LOG(ERROR) << "Failed to load crypto32.dll: " << error.ToString(); #endif // defined(OS_WIN) - // 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); + // Initialize media libraries for the Chromoting client plugin. + media::InitializeMediaLibrary(); #endif // defined(ENABLE_REMOTING) } diff --git a/chrome/sync_integration_tests.isolate b/chrome/sync_integration_tests.isolate index 3ff1056..0b22cf6 100644 --- a/chrome/sync_integration_tests.isolate +++ b/chrome/sync_integration_tests.isolate @@ -29,7 +29,6 @@ ['OS=="linux"', { 'variables': { 'files': [ - '<(PRODUCT_DIR)/libffmpegsumo.so', '<(PRODUCT_DIR)/libosmesa.so', ], }, @@ -62,7 +61,6 @@ 'files': [ '<(PRODUCT_DIR)/<(mac_product_name) Framework.framework/', '<(PRODUCT_DIR)/<(mac_product_name).app/', - '<(PRODUCT_DIR)/ffmpegsumo.so', ], }, }], @@ -71,7 +69,6 @@ 'files': [ '<(PRODUCT_DIR)/<(mac_product_name) Framework.framework.dSYM/', '<(PRODUCT_DIR)/<(mac_product_name).app.dSYM/', - '<(PRODUCT_DIR)/ffmpegsumo.so.dSYM/', ], }, }], @@ -79,7 +76,6 @@ '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 a2258b5..933d6a0 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::InitializeMediaLibraryForTesting(); + media::InitializeMediaLibrary(); #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 a47b005..7e212e1 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,7 +53,6 @@ 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 2be6bd2..4a08de6 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,4 +12,3 @@ 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 9bed5dd..1089fd2 100644 --- a/chrome/tools/build/chromeos/FILES.cfg +++ b/chrome/tools/build/chromeos/FILES.cfg @@ -61,10 +61,6 @@ 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 8ec10a5..52a09f2 100644 --- a/chrome/tools/build/linux/FILES.cfg +++ b/chrome/tools/build/linux/FILES.cfg @@ -72,10 +72,6 @@ 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 4a81ea9..d77adcf 100644 --- a/chrome/tools/build/mac/TESTS +++ b/chrome/tools/build/mac/TESTS @@ -1,3 +1,2 @@ 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 c9ef590..0673a1e 100755 --- a/chrome/tools/build/mac/dump_product_syms +++ b/chrome/tools/build/mac/dump_product_syms @@ -81,7 +81,6 @@ 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 6c779d5..2dcef76 100644 --- a/chrome/tools/build/win/FILES.cfg +++ b/chrome/tools/build/win/FILES.cfg @@ -41,11 +41,6 @@ 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 146ca41..8c17738 100644 --- a/chrome/unit_tests.isolate +++ b/chrome/unit_tests.isolate @@ -73,7 +73,6 @@ ['OS=="linux"', { 'variables': { 'files': [ - '<(PRODUCT_DIR)/libffmpegsumo.so', '<(PRODUCT_DIR)/libosmesa.so', '<(PRODUCT_DIR)/locales/fr.pak', ], @@ -102,7 +101,6 @@ 'files': [ '<(PRODUCT_DIR)/<(mac_product_name) Framework.framework/', '<(PRODUCT_DIR)/exif.so', - '<(PRODUCT_DIR)/ffmpegsumo.so', '<(PRODUCT_DIR)/osmesa.so', ], }, @@ -112,7 +110,6 @@ '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/', ], @@ -126,7 +123,6 @@ '../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 982045f..942545e 100644 --- a/chrome/utility/extensions/extensions_handler.cc +++ b/chrome/utility/extensions/extensions_handler.cc @@ -65,11 +65,8 @@ void ExtensionsHandler::PreSandboxStartup() { // Initialize libexif for image metadata parsing. metadata::ImageMetadataExtractor::InitializeLibrary(); - // 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); + // Initialize media libraries for media file validation. + media::InitializeMediaLibrary(); } 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 4820fb0..133f8bed 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::InitializeMediaLibraryForTesting(); + media::InitializeMediaLibrary(); } int main(int argc, char** argv) { diff --git a/components/components_unittests.isolate b/components/components_unittests.isolate index 3c1f393..ccdaf16 100644 --- a/components/components_unittests.isolate +++ b/components/components_unittests.isolate @@ -54,7 +54,6 @@ ['OS=="linux"', { 'variables': { 'files': [ - '<(PRODUCT_DIR)/libffmpegsumo.so', '<(PRODUCT_DIR)/libosmesa.so', ], }, @@ -62,7 +61,6 @@ ['OS=="mac"', { 'variables': { 'files': [ - '<(PRODUCT_DIR)/ffmpegsumo.so', '<(PRODUCT_DIR)/osmesa.so', ], }, @@ -71,7 +69,6 @@ 'variables': { 'files': [ '../chrome/test/data/policy/', - '<(PRODUCT_DIR)/ffmpegsumo.dll', '<(PRODUCT_DIR)/osmesa.dll', ], }, @@ -87,7 +84,6 @@ '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 101015a..29a153b 100644 --- a/components/html_viewer/media_factory.cc +++ b/components/html_viewer/media_factory.cc @@ -88,11 +88,7 @@ MediaFactory::MediaFactory( ->HasSwitch(kEnableMojoMediaRenderer)), compositor_task_runner_(compositor_task_runner), shell_(shell) { - if (!media::IsMediaLibraryInitialized()) { - base::FilePath module_dir; - CHECK(PathService::Get(base::DIR_EXE, &module_dir)); - CHECK(media::InitializeMediaLibrary(module_dir)); - } + media::InitializeMediaLibrary(); } MediaFactory::~MediaFactory() { diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc index 1a39863..cdb519f 100644 --- a/content/app/content_main_runner.cc +++ b/content/app/content_main_runner.cc @@ -282,12 +282,7 @@ int RunZygote(const MainFunctionParams& main_function_params, ScopedVector zygote_fork_delegates; if (delegate) { delegate->ZygoteStarting(&zygote_fork_delegates); - // 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); + media::InitializeMediaLibrary(); } // 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 9ed607a..0cf5367 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc @@ -548,7 +548,7 @@ void BrowserMainLoop::PostMainMessageLoopStart() { #if !defined(OS_IOS) { TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:MediaFeatures"); - media::InitializeCPUSpecificMediaFeatures(); + media::InitializeMediaLibrary(); } { TRACE_EVENT0("startup", diff --git a/content/content_browsertests.isolate b/content/content_browsertests.isolate index 2fcab67..a6f069f 100644 --- a/content/content_browsertests.isolate +++ b/content/content_browsertests.isolate @@ -66,7 +66,6 @@ 'variables': { 'files': [ '<(PRODUCT_DIR)/content_shell.pak', - '<(PRODUCT_DIR)/libffmpegsumo.so', '<(PRODUCT_DIR)/libosmesa.so', ], }, @@ -96,7 +95,6 @@ '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', @@ -110,7 +108,6 @@ '<(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/', @@ -121,7 +118,6 @@ '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 ea9938d..b685ea7 100644 --- a/content/content_gl_tests.isolate +++ b/content/content_gl_tests.isolate @@ -24,27 +24,12 @@ ], }, }], - ['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 6893e2d..2f30de3 100644 --- a/content/content_shell.gypi +++ b/content/content_shell.gypi @@ -769,13 +769,6 @@ ], '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 07ac6e7..61eca66 100644 --- a/content/content_unittests.isolate +++ b/content/content_unittests.isolate @@ -68,7 +68,6 @@ ['OS=="linux"', { 'variables': { 'files': [ - '<(PRODUCT_DIR)/libffmpegsumo.so', '<(PRODUCT_DIR)/libosmesa.so', ], }, @@ -76,7 +75,6 @@ ['OS=="mac"', { 'variables': { 'files': [ - '<(PRODUCT_DIR)/ffmpegsumo.so', '<(PRODUCT_DIR)/osmesa.so', ], }, @@ -84,7 +82,6 @@ ['OS=="win"', { 'variables': { 'files': [ - '<(PRODUCT_DIR)/ffmpegsumo.dll', '<(PRODUCT_DIR)/osmesa.dll', ], }, @@ -93,7 +90,6 @@ '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 8fe83ef..b74e5c9 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc @@ -646,10 +646,7 @@ 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. - base::FilePath media_path; - PathService::Get(DIR_MEDIA_LIBS, &media_path); - if (!media_path.empty()) - media::InitializeMediaLibrary(media_path); + media::InitializeMediaLibrary(); memory_pressure_listener_.reset(new base::MemoryPressureListener( base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this)))); @@ -1106,10 +1103,6 @@ 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 20db1ea..e3b2ae28 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::InitializeMediaLibraryForTesting(); + media::InitializeMediaLibrary(); // 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 0739137..177f7d6 100644 --- a/content/test/test_blink_web_unit_test_support.cc +++ b/content/test/test_blink_web_unit_test_support.cc @@ -129,19 +129,9 @@ TestBlinkWebUnitTestSupport::TestBlinkWebUnitTestSupport() { blink::WebRuntimeFeatures::enableNotifications(true); blink::WebRuntimeFeatures::enableTouch(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"; + // Initialize libraries for media and enable the media player. + media::InitializeMediaLibrary(); + blink::WebRuntimeFeatures::enableMediaPlayer(true); file_utilities_.set_sandbox_enabled(false); diff --git a/media/audio_unittests.isolate b/media/audio_unittests.isolate index fe84e1e..d91c636 100644 --- a/media/audio_unittests.isolate +++ b/media/audio_unittests.isolate @@ -52,31 +52,9 @@ ], }, }], - ['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 29547f3..96254cf 100644 --- a/media/base/BUILD.gn +++ b/media/base/BUILD.gn @@ -216,11 +216,6 @@ 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" ] } @@ -235,7 +230,6 @@ 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 37fc02a..c85d465 100644 --- a/media/base/media.cc +++ b/media/base/media.cc @@ -11,70 +11,44 @@ #include "build/build_config.h" #include "media/base/yuv_convert.h" -namespace media { +#if !defined(MEDIA_DISABLE_FFMPEG) +#include "media/ffmpeg/ffmpeg_common.h" +#endif -namespace internal { -// Platform specific initialization method. -extern bool InitializeMediaLibraryInternal(const base::FilePath& module_dir); -} // namespace internal +namespace media { // 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() - : initialized_(false), - tried_initialize_(false) { + MediaInitializer() { // 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::Leaky g_media_library = LAZY_INSTANCE_INITIALIZER; -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(). +void InitializeMediaLibrary() { g_media_library.Get(); } diff --git a/media/base/media.h b/media/base/media.h index c86e568..01a913b 100644 --- a/media/base/media.h +++ b/media/base/media.h @@ -16,32 +16,9 @@ class FilePath; namespace media { -// 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(); +// Initializes media libraries (e.g. ffmpeg) as well as CPU specific media +// features. +MEDIA_EXPORT void InitializeMediaLibrary(); } // namespace media diff --git a/media/base/media_posix.cc b/media/base/media_posix.cc deleted file mode 100644 index f8f0c99..0000000 --- a/media/base/media_posix.cc +++ /dev/null @@ -1,66 +0,0 @@ -// 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 - -#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 deleted file mode 100644 index e3e02e4..0000000 --- a/media/base/media_stub.cc +++ /dev/null @@ -1,19 +0,0 @@ -// 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 deleted file mode 100644 index 03d78b1..0000000 --- a/media/base/media_win.cc +++ /dev/null @@ -1,56 +0,0 @@ -// 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 -#if defined(_WIN32_WINNT_WIN8) -// The Windows 8 SDK defines FACILITY_VISUALCPP in winerror.h. -#undef FACILITY_VISUALCPP -#endif -#include - -#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 cf6bc47..dcf58fe 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::InitializeMediaLibraryForTesting(); + media::InitializeMediaLibrary(); } int main(int argc, char** argv) { diff --git a/media/base/run_all_unittests.cc b/media/base/run_all_unittests.cc index 0f741c3..7c0c14a 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::InitializeMediaLibraryForTesting(); + media::InitializeMediaLibrary(); } int main(int argc, char** argv) { diff --git a/media/blink/run_all_unittests.cc b/media/blink/run_all_unittests.cc index e7b8b72..8af78f7 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::InitializeMediaLibraryForTesting(); + media::InitializeMediaLibrary(); #ifdef V8_USE_EXTERNAL_STARTUP_DATA gin::V8Initializer::LoadV8Snapshot(); diff --git a/media/cast/cast_unittests.isolate b/media/cast/cast_unittests.isolate index 26b9395..bf207cd 100644 --- a/media/cast/cast_unittests.isolate +++ b/media/cast/cast_unittests.isolate @@ -34,13 +34,6 @@ ], }, }], - ['OS=="linux"', { - 'variables': { - 'files': [ - '<(PRODUCT_DIR)/libffmpegsumo.so', - ], - }, - }], ['OS=="linux" or OS=="mac" or OS=="win"', { 'variables': { 'files': [ @@ -49,13 +42,6 @@ ], }, }], - ['OS=="mac"', { - 'variables': { - 'files': [ - '<(PRODUCT_DIR)/ffmpegsumo.so', - ], - }, - }], ['OS=="mac" and asan==1 and fastbuild==0', { 'variables': { 'files': [ @@ -63,13 +49,6 @@ ], }, }], - ['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 70b5041..5fd80f1 100644 --- a/media/cast/sender/audio_encoder_unittest.cc +++ b/media/cast/sender/audio_encoder_unittest.cc @@ -98,7 +98,7 @@ struct TestScenario { class AudioEncoderTest : public ::testing::TestWithParam { public: AudioEncoderTest() { - InitializeMediaLibraryForTesting(); + InitializeMediaLibrary(); 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 b0662804..1f4ae9e 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() { - InitializeMediaLibraryForTesting(); + InitializeMediaLibrary(); 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 89e7c54..62fcb00 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::InitializeMediaLibraryForTesting(); + media::InitializeMediaLibrary(); } } // namespace diff --git a/media/cast/test/sender.cc b/media/cast/test/sender.cc index 7398698..4e3a8db 100644 --- a/media/cast/test/sender.cc +++ b/media/cast/test/sender.cc @@ -204,13 +204,8 @@ int main(int argc, char** argv) { base::CommandLine::Init(argc, argv); InitLogging(logging::LoggingSettings()); - // 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; - } + // Prepare media module for FFmpeg decoding. + media::InitializeMediaLibrary(); 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 a3a560e..540f377 100644 --- a/media/cast/test/simulator.cc +++ b/media/cast/test/simulator.cc @@ -739,10 +739,7 @@ int main(int argc, char** argv) { } } - if (!media::InitializeMediaLibrary(media_path)) { - LOG(ERROR) << "Failed to initialize FFmpeg."; - return 1; - } + media::InitializeMediaLibrary(); 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 6a6ff62..6087dcc 100644 --- a/media/cdm/ppapi/external_clear_key/clear_key_cdm.cc +++ b/media/cdm/ppapi/external_clear_key/clear_key_cdm.cc @@ -44,25 +44,17 @@ 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 -// 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. +// Prepare media library. static bool InitializeFFmpegLibraries() { - base::FilePath file_path; - CHECK(PathService::Get(base::DIR_MODULE, &file_path)); - CHECK(media::InitializeMediaLibrary(file_path)); + media::InitializeMediaLibrary(); return true; } - static bool g_ffmpeg_lib_initialized = InitializeFFmpegLibraries(); + #endif // CLEAR_KEY_CDM_USE_FFMPEG_DECODER const char kClearKeyCdmVersion[] = "0.1.0.1"; @@ -230,7 +222,6 @@ 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 ff07307..47c3db3 100644 --- a/media/ffmpeg/ffmpeg_common_unittest.cc +++ b/media/ffmpeg/ffmpeg_common_unittest.cc @@ -4,6 +4,7 @@ #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" @@ -12,7 +13,9 @@ namespace media { class FFmpegCommonTest : public testing::Test { public: - FFmpegCommonTest() { FFmpegGlue::InitializeFFmpeg(); } + FFmpegCommonTest() { + FFmpegGlue::InitializeFFmpeg(); + } ~FFmpegCommonTest() override{}; }; @@ -89,17 +92,6 @@ 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 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(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 20ebeaf..7643f23 100644 --- a/media/filters/ffmpeg_glue.cc +++ b/media/filters/ffmpeg_glue.cc @@ -96,9 +96,6 @@ 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 4427bf0..0f90a57 100644 --- a/media/media.gyp +++ b/media/media.gyp @@ -322,10 +322,8 @@ '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', @@ -621,7 +619,6 @@ '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', @@ -690,7 +687,6 @@ 'sources': [ 'base/media.cc', 'base/media.h', - 'base/media_stub.cc', ], 'sources!': [ 'filters/opus_audio_decoder.cc', @@ -1253,7 +1249,7 @@ 'test/pipeline_integration_test_base.cc', ], }], - ['os_posix==1 and OS!="mac"', { + ['(os_posix==1 and OS!="mac") or (OS=="win" and component!="shared_library" and win_use_allocator_shim==1)', { 'conditions': [ ['use_allocator!="none"', { 'dependencies': [ diff --git a/media/media_nacl.gyp b/media/media_nacl.gyp index 9697a8a..f345376 100644 --- a/media/media_nacl.gyp +++ b/media/media_nacl.gyp @@ -53,7 +53,6 @@ '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', @@ -63,6 +62,9 @@ '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 449fa88..7c0d4e4 100644 --- a/media/media_unittests.isolate +++ b/media/media_unittests.isolate @@ -52,31 +52,9 @@ ], }, }], - ['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 7cee1a7..3b520ef 100644 --- a/media/mojo/services/renderer_config_default.cc +++ b/media/mojo/services/renderer_config_default.cc @@ -41,12 +41,7 @@ class DummyVideoRendererSink : public VideoRendererSink { class DefaultRendererConfig : public PlatformRendererConfig { public: DefaultRendererConfig() { - // 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)); - } + InitializeMediaLibrary(); // 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 dcbb66d..1e89119 100644 --- a/media/test/pipeline_integration_test.cc +++ b/media/test/pipeline_integration_test.cc @@ -631,8 +631,7 @@ class PipelineIntegrationTestHost : public mojo::test::ApplicationTestBase, void SetUp() override { ApplicationTestBase::SetUp(); - if (!IsMediaLibraryInitialized()) - InitializeMediaLibraryForTesting(); + InitializeMediaLibrary(); } protected: diff --git a/remoting/base/run_all_unittests.cc b/remoting/base/run_all_unittests.cc index 5f52f7e..a9c5b64 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 runtime specific CPU features are initialized. - media::InitializeCPUSpecificMediaFeatures(); + // Ensures that media library and specific CPU features are initialized. + media::InitializeMediaLibrary(); 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 415681c..4c2cb3b 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 runtime specific CPU features are initialized. - media::InitializeCPUSpecificMediaFeatures(); + // Ensures that media library and specific CPU features are initialized. + media::InitializeMediaLibrary(); 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 3b52799..11858f7 100644 --- a/remoting/host/remoting_me2me_host.cc +++ b/remoting/host/remoting_me2me_host.cc @@ -1558,8 +1558,8 @@ int HostProcessMain() { // single-threaded. net::EnableSSLServerSockets(); - // Ensures runtime specific CPU features are initialized. - media::InitializeCPUSpecificMediaFeatures(); + // Ensures that media library and specific CPU features are initialized. + media::InitializeMediaLibrary(); // 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 6062cb2..eb7fec0 100644 --- a/testing/chromoting/chromoting_integration_tests.isolate +++ b/testing/chromoting/chromoting_integration_tests.isolate @@ -24,7 +24,6 @@ '../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', @@ -71,7 +70,6 @@ 'variables': { 'files': [ '<(PRODUCT_DIR)/chrome_elf.dll', - '<(PRODUCT_DIR)/ffmpegsumo.dll', '<(PRODUCT_DIR)/libglesv2.dll', ], }, @@ -81,7 +79,6 @@ '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 198b5e9..713874a 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -15582,6 +15582,9 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. + + Deprecated 05/2015 in Issue 1141703002. FFmpeg is now statically linked. + scherkus@chromium.org Errors returned by LoadLibraryEx on Windows while attempting to load -- cgit v1.1