Index: webrtc/modules/desktop_capture/win/screen_capturer_win_directx.cc |
diff --git a/webrtc/modules/desktop_capture/win/screen_capturer_win_directx.cc b/webrtc/modules/desktop_capture/win/screen_capturer_win_directx.cc |
index c30356e5753a5e454d9140106bcc223fc1fc41d5..4b789589886143c60e7e0aff00604dd86af5cae2 100644 |
--- a/webrtc/modules/desktop_capture/win/screen_capturer_win_directx.cc |
+++ b/webrtc/modules/desktop_capture/win/screen_capturer_win_directx.cc |
@@ -16,6 +16,7 @@ |
#include "webrtc/base/logging.h" |
#include "webrtc/base/timeutils.h" |
#include "webrtc/modules/desktop_capture/desktop_frame.h" |
+#include "webrtc/modules/desktop_capture/win/screen_capture_utils.h" |
namespace webrtc { |
@@ -66,6 +67,15 @@ void ScreenCapturerWinDirectx::CaptureFrame() { |
int64_t capture_start_time_nanos = rtc::TimeNanos(); |
+ if (resolution_change_detector_.IsChanged( |
+ GetScreenRect(kFullDesktopScreenId, L"").size())) { |
Sergey Ulanov
2017/02/10 19:58:25
std::wstring() for the second parameter
Sergey Ulanov
2017/02/10 19:58:25
Why is it kFullDesktopScreenId instead of current_
Sergey Ulanov
2017/02/10 19:58:25
indentation - this line should be indented 4 space
Hzj_jie
2017/02/11 01:51:22
Done.
Hzj_jie
2017/02/11 01:51:22
Done.
Hzj_jie
2017/02/11 01:51:22
Three reasons,
1. it's not guaranteed GetScreenRec
Sergey Ulanov
2017/02/15 01:38:52
They maybe we should use DX API to get the screen
Hzj_jie
2017/02/15 03:53:16
Yes, technically, we can do this. But we need to i
Sergey Ulanov
2017/02/15 22:39:38
Not sure why it's a cyclic dependency. This functi
|
+ // The next Duplicate() call is expected to fail. So we reset the dxgi |
+ // components in-place. |
+ frames_.Reset(); |
+ DxgiDuplicatorController::Instance()->Reset(); |
+ resolution_change_detector_.Reset(); |
+ } |
+ |
frames_.MoveToNextFrame(); |
if (!frames_.current_frame()) { |
std::unique_ptr<DesktopFrame> new_frame; |
@@ -90,6 +100,7 @@ void ScreenCapturerWinDirectx::CaptureFrame() { |
&context_, frames_.current_frame())) { |
// Screen size may be changed, so we need to reset the frames. |
frames_.Reset(); |
+ resolution_change_detector_.Reset(); |
callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); |
return; |
} |
@@ -98,6 +109,7 @@ void ScreenCapturerWinDirectx::CaptureFrame() { |
&context_, current_screen_id_, frames_.current_frame())) { |
// Screen size may be changed, so we need to reset the frames. |
frames_.Reset(); |
+ resolution_change_detector_.Reset(); |
if (current_screen_id_ >= |
DxgiDuplicatorController::Instance()->ScreenCount()) { |
// Current monitor has been removed from the system. |