OLD | NEW |
1 // Copyright (c) 2011 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 #ifndef REMOTING_HOST_CAPTURE_SCHEDULER_H_ | 5 #ifndef REMOTING_PROTOCOL_CAPTURE_SCHEDULER_H_ |
6 #define REMOTING_HOST_CAPTURE_SCHEDULER_H_ | 6 #define REMOTING_PROTOCOL_CAPTURE_SCHEDULER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/macros.h" |
9 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
10 #include "base/time/tick_clock.h" | 11 #include "base/time/tick_clock.h" |
11 #include "base/time/time.h" | 12 #include "base/time/time.h" |
12 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
13 #include "remoting/base/running_average.h" | 14 #include "remoting/base/running_average.h" |
14 #include "remoting/protocol/video_feedback_stub.h" | 15 #include "remoting/protocol/video_feedback_stub.h" |
15 | 16 |
16 namespace remoting { | 17 namespace remoting { |
17 | 18 |
18 class VideoPacket; | 19 class VideoPacket; |
19 | 20 |
| 21 namespace protocol { |
| 22 |
20 // CaptureScheduler is used by the VideoFramePump to schedule frame capturer, | 23 // CaptureScheduler is used by the VideoFramePump to schedule frame capturer, |
21 // taking into account capture delay, encoder delay, network bandwidth, etc. | 24 // taking into account capture delay, encoder delay, network bandwidth, etc. |
22 // It implements VideoFeedbackStub to receive frame acknowledgments from the | 25 // It implements VideoFeedbackStub to receive frame acknowledgments from the |
23 // client. | 26 // client. |
24 // | 27 // |
25 // It attempts to achieve the following goals when scheduling frames: | 28 // It attempts to achieve the following goals when scheduling frames: |
26 // - Keep round-trip latency as low a possible. | 29 // - Keep round-trip latency as low a possible. |
27 // - Parallelize capture, encode and transmission, to achieve frame rate as | 30 // - Parallelize capture, encode and transmission, to achieve frame rate as |
28 // close to the target of 30fps as possible. | 31 // close to the target of 30fps as possible. |
29 // - Limit CPU usage to 50%. | 32 // - Limit CPU usage to 50%. |
30 class CaptureScheduler : public protocol::VideoFeedbackStub { | 33 class CaptureScheduler : public VideoFeedbackStub { |
31 public: | 34 public: |
32 explicit CaptureScheduler(const base::Closure& capture_closure); | 35 explicit CaptureScheduler(const base::Closure& capture_closure); |
33 ~CaptureScheduler() override; | 36 ~CaptureScheduler() override; |
34 | 37 |
35 // Starts the scheduler. | 38 // Starts the scheduler. |
36 void Start(); | 39 void Start(); |
37 | 40 |
38 // Pauses or unpauses the stream. | 41 // Pauses or unpauses the stream. |
39 void Pause(bool pause); | 42 void Pause(bool pause); |
40 | 43 |
(...skipping 60 matching lines...) Loading... |
101 bool is_paused_; | 104 bool is_paused_; |
102 | 105 |
103 // Frame ID to be assigned to the next outgoing video frame. | 106 // Frame ID to be assigned to the next outgoing video frame. |
104 uint32_t next_frame_id_; | 107 uint32_t next_frame_id_; |
105 | 108 |
106 base::ThreadChecker thread_checker_; | 109 base::ThreadChecker thread_checker_; |
107 | 110 |
108 DISALLOW_COPY_AND_ASSIGN(CaptureScheduler); | 111 DISALLOW_COPY_AND_ASSIGN(CaptureScheduler); |
109 }; | 112 }; |
110 | 113 |
| 114 } // namespace protocol |
111 } // namespace remoting | 115 } // namespace remoting |
112 | 116 |
113 #endif // REMOTING_HOST_CAPTURE_SCHEDULER_H_ | 117 #endif // REMOTING_PROTOCOL_CAPTURE_SCHEDULER_H_ |
OLD | NEW |