Make desktop capture API work on Windows.

This commit is contained in:
Haojian Wu 2015-10-03 10:41:08 +08:00
parent c9fbde321c
commit 48fbd47416
2 changed files with 26 additions and 2 deletions

View file

@ -275,8 +275,14 @@
'-lcomctl32.lib', '-lcomctl32.lib',
'-lcomdlg32.lib', '-lcomdlg32.lib',
'-lwininet.lib', '-lwininet.lib',
'-lwinmm.lib',
], ],
}, },
'defines': [
# The usage of "webrtc/modules/desktop_capture/desktop_capture_options.h"
# is required to see this macro.
'WEBRTC_WIN',
],
'dependencies': [ 'dependencies': [
# Node is built as static_library on Windows, so we also need to # Node is built as static_library on Windows, so we also need to
# include its dependencies here. # include its dependencies here.
@ -290,6 +296,11 @@
], ],
}], # OS=="win" }], # OS=="win"
['OS=="mac"', { ['OS=="mac"', {
'defines': [
# The usage of "webrtc/modules/desktop_capture/desktop_capture_options.h"
# is required to see this macro.
'WEBRTC_MAC',
],
'dependencies': [ 'dependencies': [
'vendor/crashpad/client/client.gyp:crashpad_client', 'vendor/crashpad/client/client.gyp:crashpad_client',
'vendor/crashpad/handler/handler.gyp:crashpad_handler', 'vendor/crashpad/handler/handler.gyp:crashpad_handler',

View file

@ -47,10 +47,23 @@ const int kThumbnailHeight = 150;
} // namespace } // namespace
DesktopCapturer::DesktopCapturer(bool show_screens, bool show_windows) { DesktopCapturer::DesktopCapturer(bool show_screens, bool show_windows) {
webrtc::DesktopCaptureOptions options =
webrtc::DesktopCaptureOptions::CreateDefault();
#if defined(OS_WIN)
// On windows, desktop effects (e.g. Aero) will be disabled when the Desktop
// capture API is active by default.
// We keep the desktop effects in most times. Howerver, the screen still
// fickers when the API is capturing the window due to limitation of current
// implemetation. This is a known and wontFix issue in webrtc (see:
// http://code.google.com/p/webrtc/issues/detail?id=3373)
options.set_disable_effects(false);
#endif
scoped_ptr<webrtc::ScreenCapturer> screen_capturer( scoped_ptr<webrtc::ScreenCapturer> screen_capturer(
show_screens ? webrtc::ScreenCapturer::Create() : nullptr); show_screens ? webrtc::ScreenCapturer::Create(options) : nullptr);
scoped_ptr<webrtc::WindowCapturer> window_capturer( scoped_ptr<webrtc::WindowCapturer> window_capturer(
show_windows ? webrtc::WindowCapturer::Create() : nullptr); show_windows ? webrtc::WindowCapturer::Create(options) : nullptr);
media_list_.reset(new NativeDesktopMediaList(screen_capturer.Pass(), media_list_.reset(new NativeDesktopMediaList(screen_capturer.Pass(),
window_capturer.Pass())); window_capturer.Pass()));
media_list_->SetThumbnailSize(gfx::Size(kThumbnailWidth, kThumbnailHeight)); media_list_->SetThumbnailSize(gfx::Size(kThumbnailWidth, kThumbnailHeight));