Merge pull request #13543 from electron/ajm-win7-crash

Ensure DirectX capturer is supported.
This commit is contained in:
John Kleinschmidt 2018-07-19 15:11:42 -04:00 committed by GitHub
commit f8b646c90a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View file

@ -22,6 +22,7 @@ using base::PlatformThreadRef;
#include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
#if defined(OS_WIN) #if defined(OS_WIN)
#include "third_party/webrtc/modules/desktop_capture/win/dxgi_duplicator_controller.h" #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" #include "ui/display/win/display_info.h"
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
@ -61,9 +62,14 @@ void StartHandlingTask(bool capture_window,
const gfx::Size& thumbnail_size, const gfx::Size& thumbnail_size,
atom::api::DesktopCapturer* cap) { atom::api::DesktopCapturer* cap) {
#if defined(OS_WIN) #if defined(OS_WIN)
if (content::desktop_capture::CreateDesktopCaptureOptions()
.allow_directx_capturer()) {
// DxgiDuplicatorController should be alive in this scope according to
// screen_capturer_win.cc.
auto duplicator = webrtc::DxgiDuplicatorController::Instance();
cap->using_directx_capturer_ = cap->using_directx_capturer_ =
content::desktop_capture::CreateDesktopCaptureOptions() webrtc::ScreenCapturerWinDirectx::IsSupported();
.allow_directx_capturer(); }
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
std::unique_ptr<webrtc::DesktopCapturer> screen_capturer( std::unique_ptr<webrtc::DesktopCapturer> screen_capturer(
capture_screen ? content::desktop_capture::CreateScreenCapturer() capture_screen ? content::desktop_capture::CreateScreenCapturer()

View file

@ -36,7 +36,7 @@ class DesktopCapturer : public mate::EventEmitter<DesktopCapturer>,
std::unique_ptr<DesktopMediaList> media_list_; std::unique_ptr<DesktopMediaList> media_list_;
#if defined(OS_WIN) #if defined(OS_WIN)
bool using_directx_capturer_; bool using_directx_capturer_ = false;
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
protected: protected: