OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/base/media.h" | 5 #include "media/base/media.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #if defined(_WIN32_WINNT_WIN8) | 8 #if defined(_WIN32_WINNT_WIN8) |
9 // The Windows 8 SDK defines FACILITY_VISUALCPP in winerror.h. | 9 // The Windows 8 SDK defines FACILITY_VISUALCPP in winerror.h. |
10 #undef FACILITY_VISUALCPP | 10 #undef FACILITY_VISUALCPP |
11 #endif | 11 #endif |
12 #include <delayimp.h> | 12 #include <delayimp.h> |
13 | 13 |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "media/ffmpeg/ffmpeg_common.h" | |
15 | 16 |
16 #pragma comment(lib, "delayimp.lib") | 17 #pragma comment(lib, "delayimp.lib") |
17 | 18 |
18 namespace media { | 19 namespace media { |
19 namespace internal { | 20 namespace internal { |
20 | 21 |
21 bool InitializeMediaLibraryInternal(const base::FilePath& module_dir) { | 22 bool InitializeMediaLibraryInternal(const base::FilePath& module_dir) { |
22 // LoadLibraryEx(..., LOAD_WITH_ALTERED_SEARCH_PATH) cannot handle | 23 // LoadLibraryEx(..., LOAD_WITH_ALTERED_SEARCH_PATH) cannot handle |
23 // relative path. | 24 // relative path. |
24 if (!module_dir.IsAbsolute()) | 25 if (!module_dir.IsAbsolute()) |
25 return false; | 26 return false; |
26 | 27 |
27 // Use alternate DLL search path so we don't load dependencies from the | 28 // Use alternate DLL search path so we don't load dependencies from the |
28 // system path. Refer to http://crbug.com/35857 | 29 // system path. Refer to http://crbug.com/35857 |
29 static const char kFFmpegDLL[] = "ffmpegsumo.dll"; | 30 static const char kFFmpegDLL[] = "ffmpegsumo.dll"; |
30 HMODULE lib = ::LoadLibraryEx( | 31 HMODULE lib = ::LoadLibraryEx( |
31 module_dir.AppendASCII(kFFmpegDLL).value().c_str(), NULL, | 32 module_dir.AppendASCII(kFFmpegDLL).value().c_str(), NULL, |
32 LOAD_WITH_ALTERED_SEARCH_PATH); | 33 LOAD_WITH_ALTERED_SEARCH_PATH); |
33 | 34 |
34 // Check that we loaded the library successfully. | 35 bool initialized = (lib != NULL); |
35 return lib != NULL; | 36 |
37 // TODO(scherkus): Remove all the bool-ness from these functions as we no | |
38 // longer support disabling HTML5 media at runtime. http://crbug.com/440892 | |
39 CHECK(initialized); | |
40 | |
41 // VS2013 has a bug where FMA3 instructions will be executed on CPUs that | |
DaleCurtis
2014/12/12 22:58:01
An alternative to doing this is to add the code to
| |
42 // support them despite them being disabled at the OS level, causing illegal | |
43 // instruction exceptions. Because Web Audio's FFT code *might* run before | |
44 // HTML5 media code, call av_log_set_level() to force library initialziation. | |
45 // See http://crbug.com/440892 for details. | |
46 av_log_set_level(AV_LOG_QUIET); | |
47 | |
48 return initialized; | |
36 } | 49 } |
37 | 50 |
38 } // namespace internal | 51 } // namespace internal |
39 } // namespace media | 52 } // namespace media |
OLD | NEW |