OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_VIDEO_SCHEDULER_H_ | 5 #ifndef REMOTING_HOST_VIDEO_SCHEDULER_H_ |
6 #define REMOTING_HOST_VIDEO_SCHEDULER_H_ | 6 #define REMOTING_HOST_VIDEO_SCHEDULER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 class DesktopCapturer; | 26 class DesktopCapturer; |
27 } // namespace media | 27 } // namespace media |
28 | 28 |
29 namespace remoting { | 29 namespace remoting { |
30 | 30 |
31 class CursorShapeInfo; | 31 class CursorShapeInfo; |
32 | 32 |
33 namespace protocol { | 33 namespace protocol { |
34 class CursorShapeInfo; | 34 class CursorShapeInfo; |
35 class CursorShapeStub; | 35 class CursorShapeStub; |
36 class VideoStub; | 36 class VideoSender; |
37 } // namespace protocol | 37 } // namespace protocol |
38 | 38 |
39 // Class responsible for scheduling frame captures from a | 39 // Class responsible for scheduling frame captures from a |
40 // webrtc::DesktopCapturer, delivering them to a VideoEncoder to encode, and | 40 // webrtc::DesktopCapturer, delivering them to a VideoEncoder to encode, and |
41 // finally passing the encoded video packets to the specified VideoStub to send | 41 // finally passing the encoded video packets to the specified VideoSender to |
42 // on the network. | 42 // send on the network. |
43 // | 43 // |
44 // THREADING | 44 // THREADING |
45 // | 45 // |
46 // This class is supplied TaskRunners to use for capture, encode and network | 46 // This class is supplied TaskRunners to use for capture, encode and network |
47 // operations. Capture, encode and network transmission tasks are interleaved | 47 // operations. Capture, encode and network transmission tasks are interleaved |
48 // as illustrated below: | 48 // as illustrated below: |
49 // | 49 // |
50 // | CAPTURE ENCODE NETWORK | 50 // | CAPTURE ENCODE NETWORK |
51 // | ............. | 51 // | ............. |
52 // | . Capture . | 52 // | . Capture . |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // |video_stub| and |client_stub|, which must remain valid until Stop() is | 85 // |video_stub| and |client_stub|, which must remain valid until Stop() is |
86 // called. |capturer| is used to capture frames. | 86 // called. |capturer| is used to capture frames. |
87 VideoScheduler( | 87 VideoScheduler( |
88 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, | 88 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, |
89 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner, | 89 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner, |
90 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, | 90 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, |
91 scoped_ptr<webrtc::DesktopCapturer> capturer, | 91 scoped_ptr<webrtc::DesktopCapturer> capturer, |
92 scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor, | 92 scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor, |
93 scoped_ptr<VideoEncoder> encoder, | 93 scoped_ptr<VideoEncoder> encoder, |
94 protocol::CursorShapeStub* cursor_stub, | 94 protocol::CursorShapeStub* cursor_stub, |
95 protocol::VideoStub* video_stub); | 95 protocol::VideoSender* video_stub); |
96 | 96 |
97 // webrtc::DesktopCapturer::Callback implementation. | 97 // webrtc::DesktopCapturer::Callback implementation. |
98 webrtc::SharedMemory* CreateSharedMemory(size_t size) override; | 98 webrtc::SharedMemory* CreateSharedMemory(size_t size) override; |
99 void OnCaptureCompleted(webrtc::DesktopFrame* frame) override; | 99 void OnCaptureCompleted(webrtc::DesktopFrame* frame) override; |
100 | 100 |
101 // webrtc::MouseCursorMonitor::Callback implementation. | 101 // webrtc::MouseCursorMonitor::Callback implementation. |
102 void OnMouseCursor(webrtc::MouseCursor* mouse_cursor) override; | 102 void OnMouseCursor(webrtc::MouseCursor* mouse_cursor) override; |
103 void OnMouseCursorPosition(webrtc::MouseCursorMonitor::CursorState state, | 103 void OnMouseCursorPosition(webrtc::MouseCursorMonitor::CursorState state, |
104 const webrtc::DesktopVector& position) override; | 104 const webrtc::DesktopVector& position) override; |
105 | 105 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 // Used to capture mouse cursor shapes. Always accessed on the capture thread. | 183 // Used to capture mouse cursor shapes. Always accessed on the capture thread. |
184 scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor_; | 184 scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor_; |
185 | 185 |
186 // Used to encode captured frames. Always accessed on the encode thread. | 186 // Used to encode captured frames. Always accessed on the encode thread. |
187 scoped_ptr<VideoEncoder> encoder_; | 187 scoped_ptr<VideoEncoder> encoder_; |
188 | 188 |
189 // Interfaces through which video frames and cursor shapes are passed to the | 189 // Interfaces through which video frames and cursor shapes are passed to the |
190 // client. These members are always accessed on the network thread. | 190 // client. These members are always accessed on the network thread. |
191 protocol::CursorShapeStub* cursor_stub_; | 191 protocol::CursorShapeStub* cursor_stub_; |
192 protocol::VideoStub* video_stub_; | 192 protocol::VideoSender* video_sender_; |
193 | 193 |
194 // Timer used to schedule CaptureNextFrame(). | 194 // Timer used to schedule CaptureNextFrame(). |
195 scoped_ptr<base::OneShotTimer<VideoScheduler> > capture_timer_; | 195 scoped_ptr<base::OneShotTimer<VideoScheduler> > capture_timer_; |
196 | 196 |
197 // Timer used to ensure that we send empty keep-alive frames to the client | 197 // Timer used to ensure that we send empty keep-alive frames to the client |
198 // even when the video stream is paused or encoder is busy. | 198 // even when the video stream is paused or encoder is busy. |
199 scoped_ptr<base::DelayTimer<VideoScheduler> > keep_alive_timer_; | 199 scoped_ptr<base::DelayTimer<VideoScheduler> > keep_alive_timer_; |
200 | 200 |
201 // The number of frames being processed, i.e. frames that we are currently | 201 // The number of frames being processed, i.e. frames that we are currently |
202 // capturing, encoding or sending. The value is capped at 2 to minimize | 202 // capturing, encoding or sending. The value is capped at 2 to minimize |
(...skipping 14 matching lines...) Expand all Loading... |
217 | 217 |
218 // An object to schedule capturing. | 218 // An object to schedule capturing. |
219 CaptureScheduler scheduler_; | 219 CaptureScheduler scheduler_; |
220 | 220 |
221 DISALLOW_COPY_AND_ASSIGN(VideoScheduler); | 221 DISALLOW_COPY_AND_ASSIGN(VideoScheduler); |
222 }; | 222 }; |
223 | 223 |
224 } // namespace remoting | 224 } // namespace remoting |
225 | 225 |
226 #endif // REMOTING_HOST_VIDEO_SCHEDULER_H_ | 226 #endif // REMOTING_HOST_VIDEO_SCHEDULER_H_ |
OLD | NEW |