OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/cast_video_capturer_adapter.h" | 5 #include "remoting/host/cast_video_capturer_adapter.h" |
6 | 6 |
7 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | 7 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
8 | 8 |
9 namespace remoting { | 9 namespace remoting { |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 // Disable video adaptation since we don't intend to use it. | 21 // Disable video adaptation since we don't intend to use it. |
22 set_enable_video_adapter(false); | 22 set_enable_video_adapter(false); |
23 } | 23 } |
24 | 24 |
25 CastVideoCapturerAdapter::~CastVideoCapturerAdapter() { | 25 CastVideoCapturerAdapter::~CastVideoCapturerAdapter() { |
26 DCHECK(!capture_timer_); | 26 DCHECK(!capture_timer_); |
27 } | 27 } |
28 | 28 |
29 webrtc::SharedMemory* CastVideoCapturerAdapter::CreateSharedMemory( | 29 webrtc::SharedMemory* CastVideoCapturerAdapter::CreateSharedMemory( |
30 size_t size) { | 30 size_t size) { |
31 return NULL; | 31 return nullptr; |
32 } | 32 } |
33 | 33 |
34 void CastVideoCapturerAdapter::OnCaptureCompleted(webrtc::DesktopFrame* frame) { | 34 void CastVideoCapturerAdapter::OnCaptureCompleted(webrtc::DesktopFrame* frame) { |
35 scoped_ptr<webrtc::DesktopFrame> owned_frame(frame); | 35 scoped_ptr<webrtc::DesktopFrame> owned_frame(frame); |
36 | 36 |
37 // Drop the owned_frame if there were no changes. | 37 // Drop the owned_frame if there were no changes. |
38 if (!owned_frame || owned_frame->updated_region().is_empty()) { | 38 if (!owned_frame || owned_frame->updated_region().is_empty()) { |
39 owned_frame.reset(); | 39 owned_frame.reset(); |
40 return; | 40 return; |
41 } | 41 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 } | 156 } |
157 return true; | 157 return true; |
158 } | 158 } |
159 | 159 |
160 void CastVideoCapturerAdapter::Stop() { | 160 void CastVideoCapturerAdapter::Stop() { |
161 DCHECK(thread_checker_.CalledOnValidThread()); | 161 DCHECK(thread_checker_.CalledOnValidThread()); |
162 DCHECK_NE(capture_state(), cricket::CS_STOPPED); | 162 DCHECK_NE(capture_state(), cricket::CS_STOPPED); |
163 | 163 |
164 capture_timer_.reset(); | 164 capture_timer_.reset(); |
165 | 165 |
166 SetCaptureFormat(NULL); | 166 SetCaptureFormat(nullptr); |
167 SetCaptureState(cricket::CS_STOPPED); | 167 SetCaptureState(cricket::CS_STOPPED); |
168 | 168 |
169 VLOG(1) << "CastVideoCapturerAdapter stopped."; | 169 VLOG(1) << "CastVideoCapturerAdapter stopped."; |
170 } | 170 } |
171 | 171 |
172 | 172 |
173 bool CastVideoCapturerAdapter::IsRunning() { | 173 bool CastVideoCapturerAdapter::IsRunning() { |
174 DCHECK(thread_checker_.CalledOnValidThread()); | 174 DCHECK(thread_checker_.CalledOnValidThread()); |
175 | 175 |
176 return capture_timer_->IsRunning(); | 176 return capture_timer_->IsRunning(); |
(...skipping 15 matching lines...) Expand all Loading... |
192 void CastVideoCapturerAdapter::CaptureNextFrame() { | 192 void CastVideoCapturerAdapter::CaptureNextFrame() { |
193 // If we are paused, then don't capture. | 193 // If we are paused, then don't capture. |
194 if (!IsRunning()) | 194 if (!IsRunning()) |
195 return; | 195 return; |
196 | 196 |
197 desktop_capturer_->Capture(webrtc::DesktopRegion()); | 197 desktop_capturer_->Capture(webrtc::DesktopRegion()); |
198 } | 198 } |
199 | 199 |
200 } // namespace remoting | 200 } // namespace remoting |
201 | 201 |
OLD | NEW |