1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "media/base/media.h"
8 #if defined(_WIN32_WINNT_WIN8)
9 // The Windows 8 SDK defines FACILITY_VISUALCPP in winerror.h.
10 #undef FACILITY_VISUALCPP
14 #include "base/files/file_path.h"
15 #include "base/metrics/sparse_histogram.h"
16 #include "media/ffmpeg/ffmpeg_common.h"
18 #pragma comment(lib, "delayimp.lib")
23 bool InitializeMediaLibraryInternal(const base::FilePath
& module_dir
) {
24 // LoadLibraryEx(..., LOAD_WITH_ALTERED_SEARCH_PATH) cannot handle
26 if (!module_dir
.IsAbsolute())
29 // Use alternate DLL search path so we don't load dependencies from the
30 // system path. Refer to http://crbug.com/35857
31 static const char kFFmpegDLL
[] = "ffmpegsumo.dll";
32 HMODULE lib
= ::LoadLibraryEx(
33 module_dir
.AppendASCII(kFFmpegDLL
).value().c_str(), NULL
,
34 LOAD_WITH_ALTERED_SEARCH_PATH
);
36 bool initialized
= (lib
!= NULL
);
38 // TODO(scherkus): Remove all the bool-ness from these functions as we no
39 // longer support disabling HTML5 media at runtime. http://crbug.com/440892
41 UMA_HISTOGRAM_SPARSE_SLOWLY("Media.Initialize.Windows", GetLastError());
45 // VS2013 has a bug where FMA3 instructions will be executed on CPUs that
46 // support them despite them being disabled at the OS level, causing illegal
47 // instruction exceptions. Because Web Audio's FFT code *might* run before
48 // HTML5 media code, call av_log_set_level() to force library initialziation.
49 // See http://crbug.com/440892 for details.
50 av_log_set_level(AV_LOG_QUIET
);
55 } // namespace internal