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

Unified Diff: media/audio/win/core_audio_util_win.cc

Issue 11666005: Improves CoreAudioUtil::IsSupported by also loading Audioses.dll DLL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Feedback from Tommi Created 8 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..2c262b4e72d37026199881a3fdaae3ef37601964 100644
--- a/media/audio/win/core_audio_util_win.cc
+++ b/media/audio/win/core_audio_util_win.cc
@@ -66,6 +66,15 @@ 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));
+ return (LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH) != NULL);
+}
+
// Scoped PROPVARIANT class for automatically freeing a COM PROPVARIANT
// structure at the end of a scope.
class ScopedPropertyVariant {
@@ -103,7 +112,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.
+ // Dependency Walker shows that it is enough to verify possibility to load
+ // the Audioses DLL since it depends on Mmdevapi.dll.
+ // 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) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698