OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "base/timer.h" | 15 #include "base/timer.h" |
16 #include "remoting/base/encoder.h" | 16 #include "remoting/base/encoder.h" |
17 #include "remoting/host/capturer.h" | 17 #include "remoting/host/capturer.h" |
18 #include "remoting/proto/video.pb.h" | 18 #include "remoting/proto/video.pb.h" |
19 | 19 |
| 20 namespace base { |
| 21 class MessageLoopProxy; |
| 22 } // namespace base |
| 23 |
20 namespace remoting { | 24 namespace remoting { |
21 | 25 |
22 namespace protocol { | 26 namespace protocol { |
23 class ConnectionToClient; | 27 class ConnectionToClient; |
24 } // namespace protocol | 28 } // namespace protocol |
25 | 29 |
26 class CaptureData; | 30 class CaptureData; |
27 | 31 |
28 // A class for controlling and coordinate Capturer, Encoder | 32 // A class for controlling and coordinate Capturer, Encoder |
29 // and NetworkChannel in a record session. | 33 // and NetworkChannel in a record session. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // the capture thread by this object. | 71 // the capture thread by this object. |
68 // |network_stopped_| - This state is to prevent activity on the network thread | 72 // |network_stopped_| - This state is to prevent activity on the network thread |
69 // if set to false. | 73 // if set to false. |
70 class ScreenRecorder : public base::RefCountedThreadSafe<ScreenRecorder> { | 74 class ScreenRecorder : public base::RefCountedThreadSafe<ScreenRecorder> { |
71 public: | 75 public: |
72 | 76 |
73 // Construct a ScreenRecorder. Message loops and threads are provided. | 77 // Construct a ScreenRecorder. Message loops and threads are provided. |
74 // This object does not own capturer but owns encoder. | 78 // This object does not own capturer but owns encoder. |
75 ScreenRecorder(MessageLoop* capture_loop, | 79 ScreenRecorder(MessageLoop* capture_loop, |
76 MessageLoop* encode_loop, | 80 MessageLoop* encode_loop, |
77 MessageLoop* network_loop, | 81 base::MessageLoopProxy* network_loop, |
78 Capturer* capturer, | 82 Capturer* capturer, |
79 Encoder* encoder); | 83 Encoder* encoder); |
80 | 84 |
81 virtual ~ScreenRecorder(); | 85 virtual ~ScreenRecorder(); |
82 | 86 |
83 // Start recording. | 87 // Start recording. |
84 void Start(); | 88 void Start(); |
85 | 89 |
86 // Stop the recording session. |done_task| is executed when recording is fully | 90 // Stop the recording session. |done_task| is executed when recording is fully |
87 // stopped. This object cannot be used again after |task| is executed. | 91 // stopped. This object cannot be used again after |task| is executed. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // Perform stop operations on encode thread. | 157 // Perform stop operations on encode thread. |
154 void DoStopOnEncodeThread(Task* done_task); | 158 void DoStopOnEncodeThread(Task* done_task); |
155 | 159 |
156 // EncodedDataAvailableCallback takes ownership of |packet|. | 160 // EncodedDataAvailableCallback takes ownership of |packet|. |
157 void EncodedDataAvailableCallback(VideoPacket* packet); | 161 void EncodedDataAvailableCallback(VideoPacket* packet); |
158 void SendVideoPacket(VideoPacket* packet); | 162 void SendVideoPacket(VideoPacket* packet); |
159 | 163 |
160 // Message loops used by this class. | 164 // Message loops used by this class. |
161 MessageLoop* capture_loop_; | 165 MessageLoop* capture_loop_; |
162 MessageLoop* encode_loop_; | 166 MessageLoop* encode_loop_; |
163 MessageLoop* network_loop_; | 167 scoped_refptr<base::MessageLoopProxy> network_loop_; |
164 | 168 |
165 // Reference to the capturer. This member is always accessed on the capture | 169 // Reference to the capturer. This member is always accessed on the capture |
166 // thread. | 170 // thread. |
167 Capturer* capturer_; | 171 Capturer* capturer_; |
168 | 172 |
169 // Reference to the encoder. This member is always accessed on the encode | 173 // Reference to the encoder. This member is always accessed on the encode |
170 // thread. | 174 // thread. |
171 scoped_ptr<Encoder> encoder_; | 175 scoped_ptr<Encoder> encoder_; |
172 | 176 |
173 // A list of clients connected to this hosts. | 177 // A list of clients connected to this hosts. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 210 |
207 // This is a number updated by client to trace performance. | 211 // This is a number updated by client to trace performance. |
208 int64 sequence_number_; | 212 int64 sequence_number_; |
209 | 213 |
210 DISALLOW_COPY_AND_ASSIGN(ScreenRecorder); | 214 DISALLOW_COPY_AND_ASSIGN(ScreenRecorder); |
211 }; | 215 }; |
212 | 216 |
213 } // namespace remoting | 217 } // namespace remoting |
214 | 218 |
215 #endif // REMOTING_HOST_SCREEN_RECORDER_H_ | 219 #endif // REMOTING_HOST_SCREEN_RECORDER_H_ |
OLD | NEW |