Ensure DirectX capturer is supported.

This commit is contained in:
Andrew MacDonald 2018-07-02 21:37:10 -07:00
parent eb223f8bc3
commit 68541f2ae8
2 changed files with 8 additions and 4 deletions

View file

@ -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<webrtc::DesktopCapturer> screen_capturer(
capture_screen ? content::desktop_capture::CreateScreenCapturer()

View file

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