| 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; |
| 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 |
| (...skipping 76 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( |
| 128 scoped_ptr<protocol::CursorShapeInfo> 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); |
| 146 | 152 |
| 147 // Perform stop operations on encode thread. | 153 // Perform stop operations on encode thread. |
| 148 void DoStopOnEncodeThread(const base::Closure& done_task); | 154 void DoStopOnEncodeThread(const base::Closure& done_task); |
| 149 | 155 |
| 150 void EncodedDataAvailableCallback(scoped_ptr<VideoPacket> packet); | 156 void EncodedDataAvailableCallback(scoped_ptr<VideoPacket> packet); |
| 151 void SendVideoPacket(VideoPacket* packet); | 157 void SendVideoPacket(VideoPacket* packet); |
| 152 | 158 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 203 |
| 198 // An object to schedule capturing. | 204 // An object to schedule capturing. |
| 199 CaptureScheduler scheduler_; | 205 CaptureScheduler scheduler_; |
| 200 | 206 |
| 201 DISALLOW_COPY_AND_ASSIGN(ScreenRecorder); | 207 DISALLOW_COPY_AND_ASSIGN(ScreenRecorder); |
| 202 }; | 208 }; |
| 203 | 209 |
| 204 } // namespace remoting | 210 } // namespace remoting |
| 205 | 211 |
| 206 #endif // REMOTING_HOST_SCREEN_RECORDER_H_ | 212 #endif // REMOTING_HOST_SCREEN_RECORDER_H_ |
| OLD | NEW |