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

Unified Diff: content/browser/media/capture/aura_window_capture_machine.cc

Issue 1913283004: Aura Window Capture: Ensure capture callback is always run. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix hole in ThreadSafeCaptureOracle as well. Created 4 years, 8 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: content/browser/media/capture/aura_window_capture_machine.cc
diff --git a/content/browser/media/capture/aura_window_capture_machine.cc b/content/browser/media/capture/aura_window_capture_machine.cc
index b959e153f658f60d03d379ce17e639b5e910b28e..daaa5cc0758d62e4a895ddab5dfd37d395318048 100644
--- a/content/browser/media/capture/aura_window_capture_machine.cc
+++ b/content/browser/media/capture/aura_window_capture_machine.cc
@@ -199,7 +199,7 @@ void AuraWindowCaptureMachine::DidCopyOutput(
static bool first_call = true;
- bool succeeded = ProcessCopyOutputResponse(
+ const bool succeeded = ProcessCopyOutputResponse(
video_frame, start_time, capture_frame_cb, std::move(result));
base::TimeDelta capture_time = base::TimeTicks::Now() - start_time;
@@ -223,6 +223,11 @@ void AuraWindowCaptureMachine::DidCopyOutput(
: FIRST_WINDOW_CAPTURE_FAILED);
}
}
+
+ // If ProcessCopyOutputResponse() failed, it will not run |capture_frame_cb|,
+ // so do that now.
+ if (!succeeded)
+ capture_frame_cb.Run(video_frame, start_time, false);
}
bool AuraWindowCaptureMachine::ProcessCopyOutputResponse(
@@ -310,8 +315,11 @@ void AuraWindowCaptureMachine::CopyOutputFinishedForVideo(
if (machine) {
if (machine->cursor_renderer_ && result)
machine->cursor_renderer_->RenderOnVideoFrame(target);
- capture_frame_cb.Run(target, start_time, result);
+ } else {
+ result = false;
}
+
+ capture_frame_cb.Run(target, start_time, result);
}
void AuraWindowCaptureMachine::OnWindowBoundsChanged(
« no previous file with comments | « content/browser/media/capture/aura_window_capture_machine.h ('k') | media/capture/content/thread_safe_capture_oracle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698