Removes usage of FrameArrived event for WGC - part 2

Minor changes adding a final touch to
https://webrtc-review.googlesource.com/c/src/+/301200

Bug: chromium:1428592
Change-Id: I6271b01f2c63645db080897f19fbdb343ae499b8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/301520
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39882}
This commit is contained in:
henrika 2023-04-17 12:40:35 +02:00 committed by WebRTC LUCI CQ
parent 69c8d3c843
commit 56e830819f
2 changed files with 2 additions and 8 deletions

View File

@ -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<DesktopFrame>* 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.";

View File

@ -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.