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 // This class chooses a capture interval so as to limit CPU usage to not exceed | 5 // This class chooses a capture interval so as to limit CPU usage to not exceed |
6 // a specified %age. It bases this on the CPU usage of recent capture and encode | 6 // a specified %age. It bases this on the CPU usage of recent capture and encode |
7 // operations, and on the number of available CPUs. | 7 // operations, and on the number of available CPUs. |
8 | 8 |
9 #ifndef REMOTING_HOST_CAPTURE_SCHEDULER_H_ | 9 #ifndef REMOTING_HOST_CAPTURE_SCHEDULER_H_ |
10 #define REMOTING_HOST_CAPTURE_SCHEDULER_H_ | 10 #define REMOTING_HOST_CAPTURE_SCHEDULER_H_ |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/non_thread_safe.h" |
14 #include "base/time/tick_clock.h" | 14 #include "base/time/tick_clock.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
17 #include "remoting/base/running_average.h" | 17 #include "remoting/base/running_average.h" |
18 | 18 |
19 namespace remoting { | 19 namespace remoting { |
20 | 20 |
21 // CaptureScheduler is used by the VideoScheduler to schedule frame capturer, | 21 // CaptureScheduler is used by the VideoFramePump to schedule frame capturer, |
22 // taking into account capture delay, encoder delay, network bandwidth, etc. | 22 // taking into account capture delay, encoder delay, network bandwidth, etc. |
23 class CaptureScheduler : public base::NonThreadSafe { | 23 class CaptureScheduler : public base::NonThreadSafe { |
24 public: | 24 public: |
25 // |capture_closure| is called every time a new frame needs to be captured. | 25 // |capture_closure| is called every time a new frame needs to be captured. |
26 explicit CaptureScheduler(const base::Closure& capture_closure); | 26 explicit CaptureScheduler(const base::Closure& capture_closure); |
27 ~CaptureScheduler(); | 27 ~CaptureScheduler(); |
28 | 28 |
29 // Starts the scheduler. | 29 // Starts the scheduler. |
30 void Start(); | 30 void Start(); |
31 | 31 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 base::TimeTicks last_capture_started_time_; | 86 base::TimeTicks last_capture_started_time_; |
87 | 87 |
88 bool is_paused_; | 88 bool is_paused_; |
89 | 89 |
90 DISALLOW_COPY_AND_ASSIGN(CaptureScheduler); | 90 DISALLOW_COPY_AND_ASSIGN(CaptureScheduler); |
91 }; | 91 }; |
92 | 92 |
93 } // namespace remoting | 93 } // namespace remoting |
94 | 94 |
95 #endif // REMOTING_HOST_CAPTURE_SCHEDULER_H_ | 95 #endif // REMOTING_HOST_CAPTURE_SCHEDULER_H_ |
OLD | NEW |