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

Side by Side Diff: remoting/host/desktop_session_agent.cc

Issue 2050353002: Update webrtc::DesktopCapturer clients to implement OnCaptureResult(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix chromeos Created 4 years, 6 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.h ('k') | remoting/host/desktop_session_proxy.h » ('j') | 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_agent.h" 5 #include "remoting/host/desktop_session_agent.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 // Start the video capturer and mouse cursor monitor. 314 // Start the video capturer and mouse cursor monitor.
315 video_capturer_ = desktop_environment_->CreateVideoCapturer(); 315 video_capturer_ = desktop_environment_->CreateVideoCapturer();
316 video_capturer_->Start(this); 316 video_capturer_->Start(this);
317 video_capturer_->SetSharedMemoryFactory( 317 video_capturer_->SetSharedMemoryFactory(
318 std::unique_ptr<webrtc::SharedMemoryFactory>(new SharedMemoryFactoryImpl( 318 std::unique_ptr<webrtc::SharedMemoryFactory>(new SharedMemoryFactoryImpl(
319 base::Bind(&DesktopSessionAgent::SendToNetwork, this)))); 319 base::Bind(&DesktopSessionAgent::SendToNetwork, this))));
320 mouse_cursor_monitor_ = desktop_environment_->CreateMouseCursorMonitor(); 320 mouse_cursor_monitor_ = desktop_environment_->CreateMouseCursorMonitor();
321 mouse_cursor_monitor_->Init(this, webrtc::MouseCursorMonitor::SHAPE_ONLY); 321 mouse_cursor_monitor_->Init(this, webrtc::MouseCursorMonitor::SHAPE_ONLY);
322 } 322 }
323 323
324 void DesktopSessionAgent::OnCaptureCompleted(webrtc::DesktopFrame* frame) { 324 void DesktopSessionAgent::OnCaptureResult(
325 webrtc::DesktopCapturer::Result result,
326 std::unique_ptr<webrtc::DesktopFrame> frame) {
325 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 327 DCHECK(caller_task_runner_->BelongsToCurrentThread());
326 328
327 last_frame_.reset(frame);
328
329 // Serialize webrtc::DesktopFrame. 329 // Serialize webrtc::DesktopFrame.
330 SerializedDesktopFrame serialized_frame; 330 SerializedDesktopFrame serialized_frame;
331 if (frame) { 331 if (frame) {
332 serialized_frame.shared_buffer_id = frame->shared_memory()->id(); 332 serialized_frame.shared_buffer_id = frame->shared_memory()->id();
333 serialized_frame.bytes_per_row = frame->stride(); 333 serialized_frame.bytes_per_row = frame->stride();
334 serialized_frame.dimensions = frame->size(); 334 serialized_frame.dimensions = frame->size();
335 serialized_frame.capture_time_ms = frame->capture_time_ms(); 335 serialized_frame.capture_time_ms = frame->capture_time_ms();
336 serialized_frame.dpi = frame->dpi(); 336 serialized_frame.dpi = frame->dpi();
337 for (webrtc::DesktopRegion::Iterator i(frame->updated_region()); 337 for (webrtc::DesktopRegion::Iterator i(frame->updated_region());
338 !i.IsAtEnd(); i.Advance()) { 338 !i.IsAtEnd(); i.Advance()) {
339 serialized_frame.dirty_region.push_back(i.rect()); 339 serialized_frame.dirty_region.push_back(i.rect());
340 } 340 }
341 } 341 }
342 342
343 last_frame_ = std::move(frame);
344
343 SendToNetwork(base::WrapUnique( 345 SendToNetwork(base::WrapUnique(
344 new ChromotingDesktopNetworkMsg_CaptureCompleted(serialized_frame))); 346 new ChromotingDesktopNetworkMsg_CaptureResult(result, serialized_frame)));
345 } 347 }
346 348
347 void DesktopSessionAgent::OnMouseCursor(webrtc::MouseCursor* cursor) { 349 void DesktopSessionAgent::OnMouseCursor(webrtc::MouseCursor* cursor) {
348 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 350 DCHECK(caller_task_runner_->BelongsToCurrentThread());
349 351
350 std::unique_ptr<webrtc::MouseCursor> owned_cursor(cursor); 352 std::unique_ptr<webrtc::MouseCursor> owned_cursor(cursor);
351 353
352 SendToNetwork(base::WrapUnique( 354 SendToNetwork(base::WrapUnique(
353 new ChromotingDesktopNetworkMsg_MouseCursor(*owned_cursor))); 355 new ChromotingDesktopNetworkMsg_MouseCursor(*owned_cursor)));
354 } 356 }
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 } 580 }
579 } 581 }
580 582
581 void DesktopSessionAgent::StopAudioCapturer() { 583 void DesktopSessionAgent::StopAudioCapturer() {
582 DCHECK(audio_capture_task_runner_->BelongsToCurrentThread()); 584 DCHECK(audio_capture_task_runner_->BelongsToCurrentThread());
583 585
584 audio_capturer_.reset(); 586 audio_capturer_.reset();
585 } 587 }
586 588
587 } // namespace remoting 589 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/desktop_session_agent.h ('k') | remoting/host/desktop_session_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698