OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/screen_recorder.h" | 5 #include "remoting/host/screen_recorder.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 capture_timer_.Stop(); | 174 capture_timer_.Stop(); |
175 StartCaptureTimer(); | 175 StartCaptureTimer(); |
176 } | 176 } |
177 } | 177 } |
178 | 178 |
179 void ScreenRecorder::StartCaptureTimer() { | 179 void ScreenRecorder::StartCaptureTimer() { |
180 DCHECK_EQ(capture_loop_, MessageLoop::current()); | 180 DCHECK_EQ(capture_loop_, MessageLoop::current()); |
181 | 181 |
182 base::TimeDelta interval = base::TimeDelta::FromMilliseconds( | 182 base::TimeDelta interval = base::TimeDelta::FromMilliseconds( |
183 static_cast<int>(base::Time::kMillisecondsPerSecond / max_rate_)); | 183 static_cast<int>(base::Time::kMillisecondsPerSecond / max_rate_)); |
184 capture_timer_.Start(FROM_HERE, interval, this, &ScreenRecorder::DoCapture); | 184 capture_timer_.Start(interval, this, &ScreenRecorder::DoCapture); |
185 } | 185 } |
186 | 186 |
187 void ScreenRecorder::DoCapture() { | 187 void ScreenRecorder::DoCapture() { |
188 DCHECK_EQ(capture_loop_, MessageLoop::current()); | 188 DCHECK_EQ(capture_loop_, MessageLoop::current()); |
189 // Make sure we have at most two oustanding recordings. We can simply return | 189 // Make sure we have at most two oustanding recordings. We can simply return |
190 // if we can't make a capture now, the next capture will be started by the | 190 // if we can't make a capture now, the next capture will be started by the |
191 // end of an encode operation. | 191 // end of an encode operation. |
192 if (recordings_ >= kMaxRecordings || !is_recording_) { | 192 if (recordings_ >= kMaxRecordings || !is_recording_) { |
193 frame_skipped_ = true; | 193 frame_skipped_ = true; |
194 return; | 194 return; |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 (base::Time::Now() - encode_start_time_).InMilliseconds()); | 397 (base::Time::Now() - encode_start_time_).InMilliseconds()); |
398 packet->set_encode_time_ms(encode_time); | 398 packet->set_encode_time_ms(encode_time); |
399 } | 399 } |
400 | 400 |
401 network_loop_->PostTask( | 401 network_loop_->PostTask( |
402 FROM_HERE, | 402 FROM_HERE, |
403 NewTracedMethod(this, &ScreenRecorder::DoSendVideoPacket, packet)); | 403 NewTracedMethod(this, &ScreenRecorder::DoSendVideoPacket, packet)); |
404 } | 404 } |
405 | 405 |
406 } // namespace remoting | 406 } // namespace remoting |
OLD | NEW |