Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure DirectX capturer is supported. #13543

Merged
merged 2 commits into from
Jul 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions atom/browser/api/atom_api_desktop_capturer.cc
Expand Up @@ -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)

Expand Down Expand Up @@ -61,9 +62,14 @@ 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 = webrtc::DxgiDuplicatorController::Instance();
cap->using_directx_capturer_ =
webrtc::ScreenCapturerWinDirectx::IsSupported();
}
#endif // defined(OS_WIN)
std::unique_ptr<webrtc::DesktopCapturer> screen_capturer(
capture_screen ? content::desktop_capture::CreateScreenCapturer()
Expand Down
2 changes: 1 addition & 1 deletion atom/browser/api/atom_api_desktop_capturer.h
Expand Up @@ -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:
Expand Down