| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/protocol/webrtc_video_capturer_adapter.h" | 5 #include "remoting/protocol/webrtc_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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 best_format->height = desired.height; | 70 best_format->height = desired.height; |
| 71 best_format->fourcc = cricket::FOURCC_ARGB; | 71 best_format->fourcc = cricket::FOURCC_ARGB; |
| 72 best_format->interval = FPS_TO_INTERVAL(kFramesPerSec); | 72 best_format->interval = FPS_TO_INTERVAL(kFramesPerSec); |
| 73 return true; | 73 return true; |
| 74 } | 74 } |
| 75 | 75 |
| 76 cricket::CaptureState WebrtcVideoCapturerAdapter::Start( | 76 cricket::CaptureState WebrtcVideoCapturerAdapter::Start( |
| 77 const cricket::VideoFormat& capture_format) { | 77 const cricket::VideoFormat& capture_format) { |
| 78 DCHECK(thread_checker_.CalledOnValidThread()); | 78 DCHECK(thread_checker_.CalledOnValidThread()); |
| 79 DCHECK(!capture_timer_); | 79 DCHECK(!capture_timer_); |
| 80 DCHECK_EQ(capture_format.fourcc, (static_cast<uint32>(cricket::FOURCC_ARGB))); | 80 DCHECK_EQ(capture_format.fourcc, |
| 81 (static_cast<uint32_t>(cricket::FOURCC_ARGB))); |
| 81 | 82 |
| 82 if (!desktop_capturer_) { | 83 if (!desktop_capturer_) { |
| 83 VLOG(1) << "WebrtcVideoCapturerAdapter failed to start."; | 84 VLOG(1) << "WebrtcVideoCapturerAdapter failed to start."; |
| 84 return cricket::CS_FAILED; | 85 return cricket::CS_FAILED; |
| 85 } | 86 } |
| 86 | 87 |
| 87 // This is required to tell the cricket::VideoCapturer base class what the | 88 // This is required to tell the cricket::VideoCapturer base class what the |
| 88 // capture format will be. | 89 // capture format will be. |
| 89 SetCaptureFormat(&capture_format); | 90 SetCaptureFormat(&capture_format); |
| 90 | 91 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 DCHECK(thread_checker_.CalledOnValidThread()); | 170 DCHECK(thread_checker_.CalledOnValidThread()); |
| 170 | 171 |
| 171 return capture_timer_->IsRunning(); | 172 return capture_timer_->IsRunning(); |
| 172 } | 173 } |
| 173 | 174 |
| 174 bool WebrtcVideoCapturerAdapter::IsScreencast() const { | 175 bool WebrtcVideoCapturerAdapter::IsScreencast() const { |
| 175 return true; | 176 return true; |
| 176 } | 177 } |
| 177 | 178 |
| 178 bool WebrtcVideoCapturerAdapter::GetPreferredFourccs( | 179 bool WebrtcVideoCapturerAdapter::GetPreferredFourccs( |
| 179 std::vector<uint32>* fourccs) { | 180 std::vector<uint32_t>* fourccs) { |
| 180 DCHECK(thread_checker_.CalledOnValidThread()); | 181 DCHECK(thread_checker_.CalledOnValidThread()); |
| 181 if (!fourccs) | 182 if (!fourccs) |
| 182 return false; | 183 return false; |
| 183 fourccs->push_back(cricket::FOURCC_ARGB); | 184 fourccs->push_back(cricket::FOURCC_ARGB); |
| 184 return true; | 185 return true; |
| 185 } | 186 } |
| 186 | 187 |
| 187 void WebrtcVideoCapturerAdapter::CaptureNextFrame() { | 188 void WebrtcVideoCapturerAdapter::CaptureNextFrame() { |
| 188 // If we are paused, then don't capture. | 189 // If we are paused, then don't capture. |
| 189 if (!IsRunning()) | 190 if (!IsRunning()) |
| 190 return; | 191 return; |
| 191 | 192 |
| 192 desktop_capturer_->Capture(webrtc::DesktopRegion()); | 193 desktop_capturer_->Capture(webrtc::DesktopRegion()); |
| 193 } | 194 } |
| 194 | 195 |
| 195 } // namespace remoting | 196 } // namespace remoting |
| OLD | NEW |