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

Side by Side 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: Return an empty SerializedDesktopFrame if input DesktopFrame is nullptr 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 unified diff | Download patch
« no previous file with comments | « remoting/host/desktop_session_agent.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/host/desktop_session_proxy.h" 5 #include "remoting/host/desktop_session_proxy.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 464 DCHECK(caller_task_runner_->BelongsToCurrentThread());
465 465
466 // Drop the cached reference to the buffer. 466 // Drop the cached reference to the buffer.
467 shared_buffers_.erase(id); 467 shared_buffers_.erase(id);
468 } 468 }
469 469
470 void DesktopSessionProxy::OnCaptureCompleted( 470 void DesktopSessionProxy::OnCaptureCompleted(
471 const SerializedDesktopFrame& serialized_frame) { 471 const SerializedDesktopFrame& serialized_frame) {
472 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 472 DCHECK(caller_task_runner_->BelongsToCurrentThread());
473 473
474 // If the input serialized_frame does not have a screen size, it means the
475 // capturer returns a nullptr for OnCaptureCompleted call.
476 if (serialized_frame.dimensions.is_empty()) {
477 --pending_capture_frame_requests_;
Sergey Ulanov 2016/05/26 12:20:10 Move this out of the if block and remove duplicate
Hzj_jie 2016/05/26 20:59:22 Done.
478 video_capturer_->OnCaptureCompleted(nullptr);
479 return;
480 }
481
474 // Assume that |serialized_frame| is well-formed because it was received from 482 // Assume that |serialized_frame| is well-formed because it was received from
475 // a more privileged process. 483 // a more privileged process.
476 scoped_refptr<IpcSharedBufferCore> shared_buffer_core = 484 scoped_refptr<IpcSharedBufferCore> shared_buffer_core =
477 GetSharedBufferCore(serialized_frame.shared_buffer_id); 485 GetSharedBufferCore(serialized_frame.shared_buffer_id);
478 CHECK(shared_buffer_core.get()); 486 CHECK(shared_buffer_core.get());
479 487
480 std::unique_ptr<webrtc::DesktopFrame> frame( 488 std::unique_ptr<webrtc::DesktopFrame> frame(
481 new webrtc::SharedMemoryDesktopFrame( 489 new webrtc::SharedMemoryDesktopFrame(
482 serialized_frame.dimensions, serialized_frame.bytes_per_row, 490 serialized_frame.dimensions, serialized_frame.bytes_per_row,
483 new IpcSharedBuffer(shared_buffer_core))); 491 new IpcSharedBuffer(shared_buffer_core)));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 } 536 }
529 537
530 // static 538 // static
531 void DesktopSessionProxyTraits::Destruct( 539 void DesktopSessionProxyTraits::Destruct(
532 const DesktopSessionProxy* desktop_session_proxy) { 540 const DesktopSessionProxy* desktop_session_proxy) {
533 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, 541 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE,
534 desktop_session_proxy); 542 desktop_session_proxy);
535 } 543 }
536 544
537 } // namespace remoting 545 } // namespace remoting
OLDNEW
« 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