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

Unified Diff: remoting/host/desktop_session_proxy.cc

Issue 1996753002: Fix DesktopSessioAgent crash when handling nullptr OnCaptureCompleted callback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Share two --pending_capture_frame_requests_ calls Created 4 years, 7 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 | « remoting/host/desktop_session_agent.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/desktop_session_proxy.cc
diff --git a/remoting/host/desktop_session_proxy.cc b/remoting/host/desktop_session_proxy.cc
index 4d1f5402882079ad288c69d8be0b8ce63bfc3fa6..2cd68c3d85f9c7f0278024d61c51db9324e14e00 100644
--- a/remoting/host/desktop_session_proxy.cc
+++ b/remoting/host/desktop_session_proxy.cc
@@ -471,6 +471,15 @@ void DesktopSessionProxy::OnCaptureCompleted(
const SerializedDesktopFrame& serialized_frame) {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
+ --pending_capture_frame_requests_;
+
+ // If the input serialized_frame does not have a screen size, it means the
+ // capturer returns a nullptr for OnCaptureCompleted call.
+ if (serialized_frame.dimensions.is_empty()) {
+ video_capturer_->OnCaptureCompleted(nullptr);
+ return;
+ }
+
// Assume that |serialized_frame| is well-formed because it was received from
// a more privileged process.
scoped_refptr<IpcSharedBufferCore> shared_buffer_core =
@@ -488,7 +497,6 @@ void DesktopSessionProxy::OnCaptureCompleted(
frame->mutable_updated_region()->AddRect(serialized_frame.dirty_region[i]);
}
- --pending_capture_frame_requests_;
video_capturer_->OnCaptureCompleted(std::move(frame));
}
« no previous file with comments | « remoting/host/desktop_session_agent.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698