Chromium Code Reviews| Index: media/audio/win/core_audio_util_win.cc |
| diff --git a/media/audio/win/core_audio_util_win.cc b/media/audio/win/core_audio_util_win.cc |
| index b501cbfa98c6400c326ef26301419ce645eb6514..a15e5f4a094e4b9585debe6427ee95290be9d183 100644 |
| --- a/media/audio/win/core_audio_util_win.cc |
| +++ b/media/audio/win/core_audio_util_win.cc |
| @@ -66,6 +66,18 @@ static ChannelLayout ChannelConfigToChannelLayout(ChannelConfig config) { |
| } |
| } |
| +bool LoadAudiosesDll() { |
| + static const wchar_t* const kAudiosesDLL = |
| + L"%WINDIR%\\system32\\audioses.dll"; |
| + |
| + wchar_t path[MAX_PATH] = {0}; |
| + ExpandEnvironmentStringsW(kAudiosesDLL, path, arraysize(path)); |
| + if (!LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH)) |
|
tommi (sloooow) - chröme
2012/12/21 09:58:14
return LoadLibraryExW(path, NULL, LOAD_WITH_ALTERE
henrika (OOO until Aug 14)
2012/12/21 10:03:36
OK. I followed your example BTW ;-)
tommi (sloooow) - chröme
2012/12/21 10:29:18
Hah, well, you should have noticed that in the oth
|
| + return false; |
| + |
| + return true; |
| +} |
| + |
| // Scoped PROPVARIANT class for automatically freeing a COM PROPVARIANT |
| // structure at the end of a scope. |
| class ScopedPropertyVariant { |
| @@ -103,7 +115,17 @@ bool CoreAudioUtil::IsSupported() { |
| // Microsoft does not plan to make the Core Audio APIs available for use |
| // with earlier versions of Windows, including Microsoft Windows Server 2003, |
| // Windows XP, Windows Millennium Edition, Windows 2000, and Windows 98. |
| - return (base::win::GetVersion() >= base::win::VERSION_VISTA); |
| + if (base::win::GetVersion() < base::win::VERSION_VISTA) |
| + return false; |
| + |
| + // The audio core APIs are implemented in the Mmdevapi.dll and Audioses.dll |
| + // system components, both of which run in user mode. |
|
tommi (sloooow) - chröme
2012/12/21 09:58:14
nit: dll's generally do run in usermode so you can
henrika (OOO until Aug 14)
2012/12/21 10:03:36
Got it. Copy paste from MSDN.
|
| + // Dependcy Walker shows that it is enough to verify possibility to load |
|
tommi (sloooow) - chröme
2012/12/21 09:58:14
Dependency
henrika (OOO until Aug 14)
2012/12/21 10:03:36
Done.
|
| + // the Audioses DLL since it loads Mmdevapi.dll as well. |
|
tommi (sloooow) - chröme
2012/12/21 09:58:14
s/it loads Mmdevapi.dll as well/it depends on Mmde
henrika (OOO until Aug 14)
2012/12/21 10:03:36
Thanks. Much better.
|
| + // See http://crbug.com/166397 why this extra step is required to guarantee |
| + // Core Audio support. |
| + static bool g_audioses_dll_available = LoadAudiosesDll(); |
| + return g_audioses_dll_available; |
| } |
| base::TimeDelta CoreAudioUtil::RefererenceTimeToTimeDelta(REFERENCE_TIME time) { |