Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1319)

Unified Diff: media/base/media_win.cc

Issue 1161183003: Revert "Chromium changes to statically link ffmpeg." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/media_stub.cc ('k') | media/base/run_all_perftests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/media_win.cc
diff --git a/media/base/media_win.cc b/media/base/media_win.cc
new file mode 100644
index 0000000000000000000000000000000000000000..03d78b1d454329bb0c8a8f648b3f0116ddcba75e
--- /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
« no previous file with comments | « media/base/media_stub.cc ('k') | media/base/run_all_perftests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698