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/capture_scheduler.h" | 5 #include "remoting/protocol/capture_scheduler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
11 #include "base/time/default_tick_clock.h" | 11 #include "base/time/default_tick_clock.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "remoting/proto/video.pb.h" | 13 #include "remoting/proto/video.pb.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 // Number of samples to average the most recent capture and encode time | 17 // Number of samples to average the most recent capture and encode time |
18 // over. | 18 // over. |
19 const int kStatisticsWindow = 3; | 19 const int kStatisticsWindow = 3; |
20 | 20 |
21 // The hard limit is 30fps or 33ms per recording cycle. | 21 // The hard limit is 30fps or 33ms per recording cycle. |
22 const int64 kDefaultMinimumIntervalMs = 33; | 22 const int64_t kDefaultMinimumIntervalMs = 33; |
23 | 23 |
24 // Controls how much CPU time we can use for encode and capture. | 24 // Controls how much CPU time we can use for encode and capture. |
25 // Range of this value is between 0 to 1. 0 means using 0% of of all CPUs | 25 // Range of this value is between 0 to 1. 0 means using 0% of of all CPUs |
26 // available while 1 means using 100% of all CPUs available. | 26 // available while 1 means using 100% of all CPUs available. |
27 const double kRecordingCpuConsumption = 0.5; | 27 const double kRecordingCpuConsumption = 0.5; |
28 | 28 |
29 // Maximum number of captured frames in the encoding queue. Currently capturer | 29 // Maximum number of captured frames in the encoding queue. Currently capturer |
30 // implementations do not allow to keep more than 2 DesktopFrame objects. | 30 // implementations do not allow to keep more than 2 DesktopFrame objects. |
31 static const int kMaxFramesInEncodingQueue = 2; | 31 static const int kMaxFramesInEncodingQueue = 2; |
32 | 32 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 DCHECK(!is_paused_); | 174 DCHECK(!is_paused_); |
175 DCHECK(!capture_pending_); | 175 DCHECK(!capture_pending_); |
176 | 176 |
177 capture_pending_ = true; | 177 capture_pending_ = true; |
178 last_capture_started_time_ = tick_clock_->NowTicks(); | 178 last_capture_started_time_ = tick_clock_->NowTicks(); |
179 capture_closure_.Run(); | 179 capture_closure_.Run(); |
180 } | 180 } |
181 | 181 |
182 } // namespace protocol | 182 } // namespace protocol |
183 } // namespace remoting | 183 } // namespace remoting |
OLD | NEW |