diff --git a/modules/desktop_capture/win/wgc_capture_session.cc b/modules/desktop_capture/win/wgc_capture_session.cc index 5f3db106cc..64247d2739 100644 --- a/modules/desktop_capture/win/wgc_capture_session.cc +++ b/modules/desktop_capture/win/wgc_capture_session.cc @@ -234,7 +234,7 @@ void WgcCaptureSession::EnsureFrame() { RTC_DLOG(LS_WARNING) << "ProcessFrame failed during startup: " << hr; } } - RTC_LOG_IF(LS_ERROR, !is_frame_captured_) + RTC_LOG_IF(LS_ERROR, !queue_.current_frame()) << "Unable to process a valid frame even after trying 10 times."; } @@ -242,7 +242,6 @@ bool WgcCaptureSession::GetFrame(std::unique_ptr* output_frame) { RTC_DCHECK_RUN_ON(&sequence_checker_); EnsureFrame(); - RTC_DCHECK(is_frame_captured_); // Return a NULL frame and false as `result` if we still don't have a valid // frame. This will lead to a DesktopCapturer::Result::ERROR_PERMANENT being @@ -310,15 +309,13 @@ HRESULT WgcCaptureSession::ProcessFrame() { if (!capture_frame) { // Avoid logging errors until at least one valid frame has been captured. - if (is_frame_captured_) { + if (queue_.current_frame()) { RTC_DLOG(LS_WARNING) << "Frame pool was empty => kFrameDropped."; RecordGetFrameResult(GetFrameResult::kFrameDropped); } return E_FAIL; } - is_frame_captured_ = true; - queue_.MoveToNextFrame(); if (queue_.current_frame() && queue_.current_frame()->IsShared()) { RTC_DLOG(LS_VERBOSE) << "Overwriting frame that is still shared."; diff --git a/modules/desktop_capture/win/wgc_capture_session.h b/modules/desktop_capture/win/wgc_capture_session.h index c25ef0f105..ee15096eab 100644 --- a/modules/desktop_capture/win/wgc_capture_session.h +++ b/modules/desktop_capture/win/wgc_capture_session.h @@ -130,9 +130,6 @@ class WgcCaptureSession final { bool item_closed_ = false; bool is_capture_started_ = false; - // Set to true when at least one frame has been captured. - bool is_frame_captured_ = false; - // Caches the value of DesktopCaptureOptions.allow_wgc_zero_hertz() in // StartCapture(). Adds 0Hz detection in ProcessFrame() when enabled which // adds complexity since memcmp() is performed on two successive frames.