Index: webrtc/modules/desktop_capture/win/window_capture_utils.cc |
diff --git a/webrtc/modules/desktop_capture/win/window_capture_utils.cc b/webrtc/modules/desktop_capture/win/window_capture_utils.cc |
index bfe7363f32d8c69b64a59e2388b47cb1a6c08ef5..7c81c4e7bcf3bdd08d00c441eec83fde209eb902 100644 |
--- a/webrtc/modules/desktop_capture/win/window_capture_utils.cc |
+++ b/webrtc/modules/desktop_capture/win/window_capture_utils.cc |
@@ -43,4 +43,21 @@ GetCroppedWindowRect(HWND window, |
return true; |
} |
+bool IsAeroEnabled() { |
+ typedef HRESULT (WINAPI *DwmIsCompositionEnabledFunc)(BOOL* enabled); |
+ |
+ static BOOL result = FALSE; |
+ // Try to load dwmapi.dll dynamically since it is not available on XP. |
+ static HMODULE dwmapi_library = LoadLibrary(L"dwmapi.dll"); |
Sergey Ulanov
2015/07/09 18:41:38
IsAeroEnabled() is called for every frame. There i
jiayl2
2015/07/09 18:44:57
LoadLibrary is called only once since it's static.
Sergey Ulanov
2015/07/09 23:02:39
Ah I missed that. Then the problem is that it's no
Sergey Ulanov
2015/07/09 23:06:23
Or you can also use this pattern: https://code.goo
jiayl2
2015/07/13 23:24:34
Done.
|
+ if (dwmapi_library) { |
+ DwmIsCompositionEnabledFunc is_composition_enabled_func = |
+ reinterpret_cast<DwmIsCompositionEnabledFunc>( |
+ GetProcAddress(dwmapi_library, "DwmIsCompositionEnabled")); |
+ is_composition_enabled_func(&result); |
+ FreeLibrary(dwmapi_library); |
+ dwmapi_library = NULL; |
+ } |
+ return result != FALSE; |
+} |
+ |
} // namespace webrtc |