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_SCREEN_RECORDER_H_ | 5 #ifndef REMOTING_HOST_SCREEN_RECORDER_H_ |
6 #define REMOTING_HOST_SCREEN_RECORDER_H_ | 6 #define REMOTING_HOST_SCREEN_RECORDER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
16 #include "base/timer.h" | 16 #include "base/timer.h" |
17 #include "remoting/base/encoder.h" | 17 #include "remoting/base/encoder.h" |
18 #include "remoting/host/capturer.h" | 18 #include "remoting/host/capturer.h" |
19 #include "remoting/host/capture_scheduler.h" | 19 #include "remoting/host/capture_scheduler.h" |
20 #include "remoting/proto/video.pb.h" | 20 #include "remoting/proto/video.pb.h" |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 class MessageLoopProxy; | 23 class MessageLoopProxy; |
24 } // namespace base | 24 } // namespace base |
25 | 25 |
26 namespace remoting { | 26 namespace remoting { |
27 | 27 |
28 namespace protocol { | 28 namespace protocol { |
29 class ConnectionToClient; | 29 class ConnectionToClient; |
| 30 class CursorShapeInfo; |
30 } // namespace protocol | 31 } // namespace protocol |
31 | 32 |
32 class CaptureData; | 33 class CaptureData; |
| 34 class CursorShapeData; |
33 | 35 |
34 // A class for controlling and coordinate Capturer, Encoder | 36 // A class for controlling and coordinate Capturer, Encoder |
35 // and NetworkChannel in a record session. | 37 // and NetworkChannel in a record session. |
36 // | 38 // |
37 // THREADING | 39 // THREADING |
38 // | 40 // |
39 // This class works on three threads, namely capture, encode and network | 41 // This class works on three threads, namely capture, encode and network |
40 // thread. The main function of this class is to coordinate and schedule | 42 // thread. The main function of this class is to coordinate and schedule |
41 // capture, encode and transmission of data on different threads. | 43 // capture, encode and transmission of data on different threads. |
42 // | 44 // |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // Capturer thread ---------------------------------------------------------- | 118 // Capturer thread ---------------------------------------------------------- |
117 | 119 |
118 void DoStart(); | 120 void DoStart(); |
119 void DoSetMaxRate(double max_rate); | 121 void DoSetMaxRate(double max_rate); |
120 | 122 |
121 // Hepler method to schedule next capture using the current rate. | 123 // Hepler method to schedule next capture using the current rate. |
122 void StartCaptureTimer(); | 124 void StartCaptureTimer(); |
123 | 125 |
124 void DoCapture(); | 126 void DoCapture(); |
125 void CaptureDoneCallback(scoped_refptr<CaptureData> capture_data); | 127 void CaptureDoneCallback(scoped_refptr<CaptureData> capture_data); |
| 128 void CursorShapeChangedCallback(scoped_refptr<CursorShapeData> cursor_data); |
126 void DoFinishOneRecording(); | 129 void DoFinishOneRecording(); |
127 void DoInvalidateFullScreen(); | 130 void DoInvalidateFullScreen(); |
128 | 131 |
129 // Network thread ----------------------------------------------------------- | 132 // Network thread ----------------------------------------------------------- |
130 | 133 |
131 void DoSendVideoPacket(scoped_ptr<VideoPacket> packet); | 134 void DoSendVideoPacket(scoped_ptr<VideoPacket> packet); |
132 | 135 |
133 void DoSendInit(scoped_refptr<protocol::ConnectionToClient> connection, | 136 void DoSendInit(scoped_refptr<protocol::ConnectionToClient> connection, |
134 int width, int height); | 137 int width, int height); |
135 | 138 |
136 // Signal network thread to cease activities. | 139 // Signal network thread to cease activities. |
137 void DoStopOnNetworkThread(const base::Closure& done_task); | 140 void DoStopOnNetworkThread(const base::Closure& done_task); |
138 | 141 |
139 // Callback for VideoStub::ProcessVideoPacket() that is used for | 142 // Callback for VideoStub::ProcessVideoPacket() that is used for |
140 // each last packet in a frame. | 143 // each last packet in a frame. |
141 void VideoFrameSentCallback(); | 144 void VideoFrameSentCallback(); |
142 | 145 |
| 146 // Send updated cursor shape to client. |
| 147 void DoSendCursorShape(scoped_ptr<protocol::CursorShapeInfo> cursor_shape); |
| 148 |
143 // Encoder thread ----------------------------------------------------------- | 149 // Encoder thread ----------------------------------------------------------- |
144 | 150 |
145 void DoEncode(scoped_refptr<CaptureData> capture_data); | 151 void DoEncode(scoped_refptr<CaptureData> capture_data); |
| 152 void DoEncodeCursorShape(scoped_refptr<CursorShapeData> cursor); |
146 | 153 |
147 // Perform stop operations on encode thread. | 154 // Perform stop operations on encode thread. |
148 void DoStopOnEncodeThread(const base::Closure& done_task); | 155 void DoStopOnEncodeThread(const base::Closure& done_task); |
149 | 156 |
150 void EncodedDataAvailableCallback(scoped_ptr<VideoPacket> packet); | 157 void EncodedDataAvailableCallback(scoped_ptr<VideoPacket> packet); |
151 void SendVideoPacket(VideoPacket* packet); | 158 void SendVideoPacket(VideoPacket* packet); |
152 | 159 |
153 // Message loops used by this class. | 160 // Message loops used by this class. |
154 MessageLoop* capture_loop_; | 161 MessageLoop* capture_loop_; |
155 MessageLoop* encode_loop_; | 162 MessageLoop* encode_loop_; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 204 |
198 // An object to schedule capturing. | 205 // An object to schedule capturing. |
199 CaptureScheduler scheduler_; | 206 CaptureScheduler scheduler_; |
200 | 207 |
201 DISALLOW_COPY_AND_ASSIGN(ScreenRecorder); | 208 DISALLOW_COPY_AND_ASSIGN(ScreenRecorder); |
202 }; | 209 }; |
203 | 210 |
204 } // namespace remoting | 211 } // namespace remoting |
205 | 212 |
206 #endif // REMOTING_HOST_SCREEN_RECORDER_H_ | 213 #endif // REMOTING_HOST_SCREEN_RECORDER_H_ |
OLD | NEW |