| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // 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 |
| 89 // capture format will be. | 89 // capture format will be. |
| 90 SetCaptureFormat(&capture_format); | 90 SetCaptureFormat(&capture_format); |
| 91 | 91 |
| 92 desktop_capturer_->Start(this); | 92 desktop_capturer_->Start(this); |
| 93 | 93 |
| 94 // Save the Start() time of |desktop_capturer_|. This will be used | 94 // Save the Start() time of |desktop_capturer_|. This will be used |
| 95 // to estimate the creation time of the frame source, to set the elapsed_time | 95 // to estimate the creation time of the frame source, to set the elapsed_time |
| 96 // of future CapturedFrames in OnCaptureCompleted(). | 96 // of future CapturedFrames in OnCaptureCompleted(). |
| 97 start_time_ = base::TimeTicks::Now(); | 97 start_time_ = base::TimeTicks::Now(); |
| 98 capture_timer_.reset(new base::RepeatingTimer<CastVideoCapturerAdapter>()); | 98 capture_timer_.reset(new base::RepeatingTimer()); |
| 99 capture_timer_->Start(FROM_HERE, | 99 capture_timer_->Start(FROM_HERE, |
| 100 base::TimeDelta::FromMicroseconds( | 100 base::TimeDelta::FromMicroseconds( |
| 101 GetCaptureFormat()->interval / | 101 GetCaptureFormat()->interval / |
| 102 (base::Time::kNanosecondsPerMicrosecond)), | 102 (base::Time::kNanosecondsPerMicrosecond)), |
| 103 this, | 103 this, |
| 104 &CastVideoCapturerAdapter::CaptureNextFrame); | 104 &CastVideoCapturerAdapter::CaptureNextFrame); |
| 105 | 105 |
| 106 return cricket::CS_RUNNING; | 106 return cricket::CS_RUNNING; |
| 107 } | 107 } |
| 108 | 108 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |