| 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" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 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 } // namespace protocol | 30 } // namespace protocol |
| 31 | 31 |
| 32 class CaptureData; | 32 class CaptureData; |
| 33 class CursorShapeData; |
| 33 | 34 |
| 34 // A class for controlling and coordinate Capturer, Encoder | 35 // A class for controlling and coordinate Capturer, Encoder |
| 35 // and NetworkChannel in a record session. | 36 // and NetworkChannel in a record session. |
| 36 // | 37 // |
| 37 // THREADING | 38 // THREADING |
| 38 // | 39 // |
| 39 // This class works on three threads, namely capture, encode and network | 40 // This class works on three threads, namely capture, encode and network |
| 40 // thread. The main function of this class is to coordinate and schedule | 41 // thread. The main function of this class is to coordinate and schedule |
| 41 // capture, encode and transmission of data on different threads. | 42 // capture, encode and transmission of data on different threads. |
| 42 // | 43 // |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // Capturer thread ---------------------------------------------------------- | 117 // Capturer thread ---------------------------------------------------------- |
| 117 | 118 |
| 118 void DoStart(); | 119 void DoStart(); |
| 119 void DoSetMaxRate(double max_rate); | 120 void DoSetMaxRate(double max_rate); |
| 120 | 121 |
| 121 // Hepler method to schedule next capture using the current rate. | 122 // Hepler method to schedule next capture using the current rate. |
| 122 void StartCaptureTimer(); | 123 void StartCaptureTimer(); |
| 123 | 124 |
| 124 void DoCapture(); | 125 void DoCapture(); |
| 125 void CaptureDoneCallback(scoped_refptr<CaptureData> capture_data); | 126 void CaptureDoneCallback(scoped_refptr<CaptureData> capture_data); |
| 127 void CursorShapeChangedCallback(scoped_refptr<CursorShapeData> cursor_data); |
| 126 void DoFinishOneRecording(); | 128 void DoFinishOneRecording(); |
| 127 void DoInvalidateFullScreen(); | 129 void DoInvalidateFullScreen(); |
| 128 | 130 |
| 129 // Network thread ----------------------------------------------------------- | 131 // Network thread ----------------------------------------------------------- |
| 130 | 132 |
| 131 void DoSendVideoPacket(scoped_ptr<VideoPacket> packet); | 133 void DoSendVideoPacket(scoped_ptr<VideoPacket> packet); |
| 132 | 134 |
| 133 void DoSendInit(scoped_refptr<protocol::ConnectionToClient> connection, | 135 void DoSendInit(scoped_refptr<protocol::ConnectionToClient> connection, |
| 134 int width, int height); | 136 int width, int height); |
| 135 | 137 |
| 136 // Signal network thread to cease activities. | 138 // Signal network thread to cease activities. |
| 137 void DoStopOnNetworkThread(const base::Closure& done_task); | 139 void DoStopOnNetworkThread(const base::Closure& done_task); |
| 138 | 140 |
| 139 // Callback for VideoStub::ProcessVideoPacket() that is used for | 141 // Callback for VideoStub::ProcessVideoPacket() that is used for |
| 140 // each last packet in a frame. | 142 // each last packet in a frame. |
| 141 void VideoFrameSentCallback(); | 143 void VideoFrameSentCallback(); |
| 142 | 144 |
| 143 // Encoder thread ----------------------------------------------------------- | 145 // Encoder thread ----------------------------------------------------------- |
| 144 | 146 |
| 145 void DoEncode(scoped_refptr<CaptureData> capture_data); | 147 void DoEncode(scoped_refptr<CaptureData> capture_data); |
| 148 void DoEncodeCursor(scoped_refptr<CursorShapeData> cursor); |
| 146 | 149 |
| 147 // Perform stop operations on encode thread. | 150 // Perform stop operations on encode thread. |
| 148 void DoStopOnEncodeThread(const base::Closure& done_task); | 151 void DoStopOnEncodeThread(const base::Closure& done_task); |
| 149 | 152 |
| 150 void EncodedDataAvailableCallback(scoped_ptr<VideoPacket> packet); | 153 void EncodedDataAvailableCallback(scoped_ptr<VideoPacket> packet); |
| 151 void SendVideoPacket(VideoPacket* packet); | 154 void SendVideoPacket(VideoPacket* packet); |
| 152 | 155 |
| 153 // Message loops used by this class. | 156 // Message loops used by this class. |
| 154 MessageLoop* capture_loop_; | 157 MessageLoop* capture_loop_; |
| 155 MessageLoop* encode_loop_; | 158 MessageLoop* encode_loop_; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 200 |
| 198 // An object to schedule capturing. | 201 // An object to schedule capturing. |
| 199 CaptureScheduler scheduler_; | 202 CaptureScheduler scheduler_; |
| 200 | 203 |
| 201 DISALLOW_COPY_AND_ASSIGN(ScreenRecorder); | 204 DISALLOW_COPY_AND_ASSIGN(ScreenRecorder); |
| 202 }; | 205 }; |
| 203 | 206 |
| 204 } // namespace remoting | 207 } // namespace remoting |
| 205 | 208 |
| 206 #endif // REMOTING_HOST_SCREEN_RECORDER_H_ | 209 #endif // REMOTING_HOST_SCREEN_RECORDER_H_ |
| OLD | NEW |