OLD | NEW |
---|---|
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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
450 // Stop the video capturer. | 450 // Stop the video capturer. |
451 video_capturer_.reset(); | 451 video_capturer_.reset(); |
452 last_frame_.reset(); | 452 last_frame_.reset(); |
453 mouse_cursor_monitor_.reset(); | 453 mouse_cursor_monitor_.reset(); |
454 } | 454 } |
455 } | 455 } |
456 | 456 |
457 void DesktopSessionAgent::OnCaptureFrame() { | 457 void DesktopSessionAgent::OnCaptureFrame() { |
458 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 458 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
459 | 459 |
460 mouse_cursor_monitor_->Capture(); | |
461 | |
462 // webrtc::DesktopCapturer supports a very few (currently 2) outstanding | 460 // webrtc::DesktopCapturer supports a very few (currently 2) outstanding |
463 // capture requests. The requests are serialized on | 461 // capture requests. The requests are serialized on |
464 // |video_capture_task_runner()| task runner. If the client issues more | 462 // |video_capture_task_runner()| task runner. If the client issues more |
465 // requests, pixel data in captured frames will likely be corrupted but | 463 // requests, pixel data in captured frames will likely be corrupted but |
466 // stability of webrtc::DesktopCapturer will not be affected. | 464 // stability of webrtc::DesktopCapturer will not be affected. |
467 video_capturer_->Capture(webrtc::DesktopRegion()); | 465 video_capturer_->Capture(webrtc::DesktopRegion()); |
466 | |
467 // Note, the client may switch between hardware and software renderers | |
468 // according to the first desktop image. So we need to make sure the first | |
469 // desktop image has been sent before the mouse cursor. | |
470 mouse_cursor_monitor_->Capture(); | |
Sergey Ulanov
2016/07/14 17:45:28
This doesn't guarantee that the cursor will be rec
Hzj_jie
2016/07/15 02:30:50
Sorry, my fault. I have double confirmed, the mous
| |
468 } | 471 } |
469 | 472 |
470 void DesktopSessionAgent::OnInjectClipboardEvent( | 473 void DesktopSessionAgent::OnInjectClipboardEvent( |
471 const std::string& serialized_event) { | 474 const std::string& serialized_event) { |
472 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 475 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
473 | 476 |
474 protocol::ClipboardEvent event; | 477 protocol::ClipboardEvent event; |
475 if (!event.ParseFromString(serialized_event)) { | 478 if (!event.ParseFromString(serialized_event)) { |
476 LOG(ERROR) << "Failed to parse protocol::ClipboardEvent."; | 479 LOG(ERROR) << "Failed to parse protocol::ClipboardEvent."; |
477 return; | 480 return; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
580 } | 583 } |
581 } | 584 } |
582 | 585 |
583 void DesktopSessionAgent::StopAudioCapturer() { | 586 void DesktopSessionAgent::StopAudioCapturer() { |
584 DCHECK(audio_capture_task_runner_->BelongsToCurrentThread()); | 587 DCHECK(audio_capture_task_runner_->BelongsToCurrentThread()); |
585 | 588 |
586 audio_capturer_.reset(); | 589 audio_capturer_.reset(); |
587 } | 590 } |
588 | 591 |
589 } // namespace remoting | 592 } // namespace remoting |
OLD | NEW |