Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(807)

Unified Diff: webrtc/modules/desktop_capture/screen_capturer_win.cc

Issue 2933893003: Add reference counter of DxgiDuplicatorController to unload DXGI components (Closed)
Patch Set: Add reference counter for DxgiDuplicatorController Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/desktop_capture/screen_capturer_win.cc
diff --git a/webrtc/modules/desktop_capture/screen_capturer_win.cc b/webrtc/modules/desktop_capture/screen_capturer_win.cc
index d8aecb15c7e86a6f5c124504f1c72f569baa9b7c..80e1ea358e78d3fb3f376ca857fd92c2a4d8ee5b 100644
--- a/webrtc/modules/desktop_capture/screen_capturer_win.cc
+++ b/webrtc/modules/desktop_capture/screen_capturer_win.cc
@@ -27,7 +27,7 @@ namespace {
std::unique_ptr<DesktopCapturer> CreateScreenCapturerWinDirectx(
const DesktopCaptureOptions& options) {
std::unique_ptr<DesktopCapturer> capturer(
- new ScreenCapturerWinDirectx(options));
+ new ScreenCapturerWinDirectx());
capturer.reset(new BlankDetectorDesktopCapturerWrapper(
std::move(capturer), RgbaColor(0, 0, 0, 0)));
return capturer;
@@ -39,10 +39,14 @@ std::unique_ptr<DesktopCapturer> CreateScreenCapturerWinDirectx(
std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer(
const DesktopCaptureOptions& options) {
std::unique_ptr<DesktopCapturer> capturer(new ScreenCapturerWinGdi(options));
- if (options.allow_directx_capturer() &&
- ScreenCapturerWinDirectx::IsSupported()) {
- capturer.reset(new FallbackDesktopCapturerWrapper(
- CreateScreenCapturerWinDirectx(options), std::move(capturer)));
+ if (options.allow_directx_capturer()) {
+ // |directx_capturer| should be alive in this scope to ensure it won't
+ // unload DxgiDuplicatorController.
+ ScreenCapturerWinDirectx directx_capturer;
+ if (directx_capturer.IsAvailable()) {
+ capturer.reset(new FallbackDesktopCapturerWrapper(
+ CreateScreenCapturerWinDirectx(options), std::move(capturer)));
+ }
}
if (options.allow_use_magnification_api()) {

Powered by Google App Engine
This is Rietveld 408576698