Chromium Code Reviews| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 // take about a year of allocating 100 new buffers every second. | 135 // take about a year of allocating 100 new buffers every second. |
| 136 // Practically speaking it never happens. | 136 // Practically speaking it never happens. |
| 137 next_shared_buffer_id_ += 2; | 137 next_shared_buffer_id_ += 2; |
| 138 | 138 |
| 139 send_message_callback_.Run( | 139 send_message_callback_.Run( |
| 140 base::WrapUnique(new ChromotingDesktopNetworkMsg_CreateSharedBuffer( | 140 base::WrapUnique(new ChromotingDesktopNetworkMsg_CreateSharedBuffer( |
| 141 buffer->id(), buffer->shared_memory()->handle(), | 141 buffer->id(), buffer->shared_memory()->handle(), |
| 142 buffer->size()))); | 142 buffer->size()))); |
| 143 } | 143 } |
| 144 | 144 |
| 145 return rtc_make_scoped_ptr(buffer.release()); | 145 return rtc::scoped_ptr<webrtc::SharedMemory>(buffer.release()); |
|
tommi
2016/04/25 10:24:22
looks like CreateSharedMemory is only being called
kwiberg-chromium
2016/04/25 10:41:59
We could, but changing the return value of an inte
tommi
2016/04/25 12:30:26
ok, sgtm
| |
| 146 } | 146 } |
| 147 | 147 |
| 148 private: | 148 private: |
| 149 int next_shared_buffer_id_ = 1; | 149 int next_shared_buffer_id_ = 1; |
| 150 SendMessageCallback send_message_callback_; | 150 SendMessageCallback send_message_callback_; |
| 151 | 151 |
| 152 DISALLOW_COPY_AND_ASSIGN(SharedMemoryFactoryImpl); | 152 DISALLOW_COPY_AND_ASSIGN(SharedMemoryFactoryImpl); |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 } // namespace | 155 } // namespace |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 303 if (delegate_->desktop_environment_factory().SupportsAudioCapture()) { | 303 if (delegate_->desktop_environment_factory().SupportsAudioCapture()) { |
| 304 audio_capturer_ = desktop_environment_->CreateAudioCapturer(); | 304 audio_capturer_ = desktop_environment_->CreateAudioCapturer(); |
| 305 audio_capture_task_runner_->PostTask( | 305 audio_capture_task_runner_->PostTask( |
| 306 FROM_HERE, base::Bind(&DesktopSessionAgent::StartAudioCapturer, this)); | 306 FROM_HERE, base::Bind(&DesktopSessionAgent::StartAudioCapturer, this)); |
| 307 } | 307 } |
| 308 | 308 |
| 309 // Start the video capturer and mouse cursor monitor. | 309 // Start the video capturer and mouse cursor monitor. |
| 310 video_capturer_ = desktop_environment_->CreateVideoCapturer(); | 310 video_capturer_ = desktop_environment_->CreateVideoCapturer(); |
| 311 video_capturer_->Start(this); | 311 video_capturer_->Start(this); |
| 312 video_capturer_->SetSharedMemoryFactory( | 312 video_capturer_->SetSharedMemoryFactory( |
| 313 rtc_make_scoped_ptr(new SharedMemoryFactoryImpl( | 313 rtc::scoped_ptr<webrtc::SharedMemoryFactory>(new SharedMemoryFactoryImpl( |
| 314 base::Bind(&DesktopSessionAgent::SendToNetwork, this)))); | 314 base::Bind(&DesktopSessionAgent::SendToNetwork, this)))); |
| 315 mouse_cursor_monitor_ = desktop_environment_->CreateMouseCursorMonitor(); | 315 mouse_cursor_monitor_ = desktop_environment_->CreateMouseCursorMonitor(); |
| 316 mouse_cursor_monitor_->Init(this, webrtc::MouseCursorMonitor::SHAPE_ONLY); | 316 mouse_cursor_monitor_->Init(this, webrtc::MouseCursorMonitor::SHAPE_ONLY); |
| 317 } | 317 } |
| 318 | 318 |
| 319 void DesktopSessionAgent::OnCaptureCompleted(webrtc::DesktopFrame* frame) { | 319 void DesktopSessionAgent::OnCaptureCompleted(webrtc::DesktopFrame* frame) { |
| 320 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 320 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 321 | 321 |
| 322 last_frame_.reset(frame); | 322 last_frame_.reset(frame); |
| 323 | 323 |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 569 } | 569 } |
| 570 } | 570 } |
| 571 | 571 |
| 572 void DesktopSessionAgent::StopAudioCapturer() { | 572 void DesktopSessionAgent::StopAudioCapturer() { |
| 573 DCHECK(audio_capture_task_runner_->BelongsToCurrentThread()); | 573 DCHECK(audio_capture_task_runner_->BelongsToCurrentThread()); |
| 574 | 574 |
| 575 audio_capturer_.reset(); | 575 audio_capturer_.reset(); |
| 576 } | 576 } |
| 577 | 577 |
| 578 } // namespace remoting | 578 } // namespace remoting |
| OLD | NEW |