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

Unified Diff: webrtc/modules/desktop_capture/win/dxgi_output_duplicator.cc

Issue 2703123002: Skips the first frame in DxgiDuplicatorController (Closed)
Patch Set: Resolve review comments Created 3 years, 10 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
« no previous file with comments | « webrtc/modules/desktop_capture/win/dxgi_output_duplicator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/desktop_capture/win/dxgi_output_duplicator.cc
diff --git a/webrtc/modules/desktop_capture/win/dxgi_output_duplicator.cc b/webrtc/modules/desktop_capture/win/dxgi_output_duplicator.cc
index e2b2235352d1dd2173c47e9fb05bf583ec1288b9..ebd8a6aeb5266910445fc22ed24d527002f671ab 100644
--- a/webrtc/modules/desktop_capture/win/dxgi_output_duplicator.cc
+++ b/webrtc/modules/desktop_capture/win/dxgi_output_duplicator.cc
@@ -31,7 +31,10 @@ using Microsoft::WRL::ComPtr;
namespace {
// Timeout for AcquireNextFrame() call.
-const int kAcquireTimeoutMs = 10;
+// DxgiDuplicatorController leverages external components to do the capture
+// scheduling. So here DxgiOutputDuplicator does not need to actively wait for a
+// new frame. 1 millisecond is the minimium value AcquireNextFrame() accepts.
+const int kAcquireTimeoutMs = 1;
DesktopRect RECTToDesktopRect(const RECT& rect) {
return DesktopRect::MakeLTRB(rect.left, rect.top, rect.right, rect.bottom);
@@ -204,6 +207,7 @@ bool DxgiOutputDuplicator::Duplicate(Context* context,
last_frame_ = target->Share();
last_frame_offset_ = offset;
target->mutable_updated_region()->AddRegion(updated_region);
+ num_frames_captured_++;
return texture_->Release() && ReleaseFrame();
}
@@ -338,4 +342,11 @@ void DxgiOutputDuplicator::SpreadContextChange(const Context* const source) {
}
}
+int64_t DxgiOutputDuplicator::num_frames_captured() const {
+#if !defined(NDEBUG)
+ RTC_DCHECK_EQ(!!last_frame_, num_frames_captured_ > 0);
+#endif
+ return num_frames_captured_;
+}
+
} // namespace webrtc
« no previous file with comments | « webrtc/modules/desktop_capture/win/dxgi_output_duplicator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698