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

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: 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..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) {
« 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