From 68541f2ae86c9d7647860f6881762b34da7c65d8 Mon Sep 17 00:00:00 2001 From: Andrew MacDonald Date: Mon, 2 Jul 2018 21:37:10 -0700 Subject: [PATCH 1/2] Ensure DirectX capturer is supported. --- atom/browser/api/atom_api_desktop_capturer.cc | 10 +++++++--- atom/browser/api/atom_api_desktop_capturer.h | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/atom/browser/api/atom_api_desktop_capturer.cc b/atom/browser/api/atom_api_desktop_capturer.cc index fa49b51f9815..8f0ab3c5061d 100644 --- a/atom/browser/api/atom_api_desktop_capturer.cc +++ b/atom/browser/api/atom_api_desktop_capturer.cc @@ -61,9 +61,13 @@ void StartHandlingTask(bool capture_window, const gfx::Size& thumbnail_size, atom::api::DesktopCapturer* cap) { #if defined(OS_WIN) - cap->using_directx_capturer_ = - content::desktop_capture::CreateDesktopCaptureOptions() - .allow_directx_capturer(); + if (content::desktop_capture::CreateDesktopCaptureOptions() + .allow_directx_capturer()) { + // DxgiDuplicatorController should be alive in this scope according to + // screen_capturer_win.cc. + auto duplicator = DxgiDuplicatorController::Instance(); + cap->using_directx_capturer_ = ScreenCapturerWinDirectx::IsSupported(); + } #endif // defined(OS_WIN) std::unique_ptr screen_capturer( capture_screen ? content::desktop_capture::CreateScreenCapturer() diff --git a/atom/browser/api/atom_api_desktop_capturer.h b/atom/browser/api/atom_api_desktop_capturer.h index 85244b47a013..88960e46d49d 100644 --- a/atom/browser/api/atom_api_desktop_capturer.h +++ b/atom/browser/api/atom_api_desktop_capturer.h @@ -36,7 +36,7 @@ class DesktopCapturer : public mate::EventEmitter, std::unique_ptr media_list_; #if defined(OS_WIN) - bool using_directx_capturer_; + bool using_directx_capturer_ = false; #endif // defined(OS_WIN) protected: From 7639e4a32a9f14f9ecbaa73ffd56c2f783e36fe6 Mon Sep 17 00:00:00 2001 From: Andrew MacDonald Date: Tue, 3 Jul 2018 01:03:05 -0700 Subject: [PATCH 2/2] Actually try building on Windows. --- atom/browser/api/atom_api_desktop_capturer.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/atom/browser/api/atom_api_desktop_capturer.cc b/atom/browser/api/atom_api_desktop_capturer.cc index 8f0ab3c5061d..08157cda58b4 100644 --- a/atom/browser/api/atom_api_desktop_capturer.cc +++ b/atom/browser/api/atom_api_desktop_capturer.cc @@ -22,6 +22,7 @@ using base::PlatformThreadRef; #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" #if defined(OS_WIN) #include "third_party/webrtc/modules/desktop_capture/win/dxgi_duplicator_controller.h" +#include "third_party/webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h" #include "ui/display/win/display_info.h" #endif // defined(OS_WIN) @@ -65,8 +66,9 @@ void StartHandlingTask(bool capture_window, .allow_directx_capturer()) { // DxgiDuplicatorController should be alive in this scope according to // screen_capturer_win.cc. - auto duplicator = DxgiDuplicatorController::Instance(); - cap->using_directx_capturer_ = ScreenCapturerWinDirectx::IsSupported(); + auto duplicator = webrtc::DxgiDuplicatorController::Instance(); + cap->using_directx_capturer_ = + webrtc::ScreenCapturerWinDirectx::IsSupported(); } #endif // defined(OS_WIN) std::unique_ptr screen_capturer(