OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_RECORD_SESSION_H_ | 5 #ifndef REMOTING_HOST_RECORD_SESSION_H_ |
6 #define REMOTING_HOST_RECORD_SESSION_H_ | 6 #define REMOTING_HOST_RECORD_SESSION_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "remoting/base/encoder.h" |
15 #include "remoting/base/protocol/chromotocol.pb.h" | 16 #include "remoting/base/protocol/chromotocol.pb.h" |
16 #include "remoting/host/capturer.h" | 17 #include "remoting/host/capturer.h" |
17 #include "remoting/host/encoder.h" | |
18 | 18 |
19 namespace media { | 19 namespace media { |
20 | 20 |
21 class DataBuffer; | 21 class DataBuffer; |
22 | 22 |
23 } // namespace media | 23 } // namespace media |
24 | 24 |
25 namespace remoting { | 25 namespace remoting { |
26 | 26 |
27 class Encoder; | 27 class CaptureData; |
28 class ClientConnection; | 28 class ClientConnection; |
29 | 29 |
30 // A class for controlling and coordinate Capturer, Encoder | 30 // A class for controlling and coordinate Capturer, Encoder |
31 // and NetworkChannel in a record session. | 31 // and NetworkChannel in a record session. |
32 // | 32 // |
33 // THREADING | 33 // THREADING |
34 // | 34 // |
35 // This class works on three threads, namely capture, encode and network | 35 // This class works on three threads, namely capture, encode and network |
36 // thread. The main function of this class is to coordinate and schedule | 36 // thread. The main function of this class is to coordinate and schedule |
37 // capture, encode and transmission of data on different threads. | 37 // capture, encode and transmission of data on different threads. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 void DoStart(); | 108 void DoStart(); |
109 void DoPause(); | 109 void DoPause(); |
110 | 110 |
111 void DoSetRate(double rate); | 111 void DoSetRate(double rate); |
112 void DoSetMaxRate(double max_rate); | 112 void DoSetMaxRate(double max_rate); |
113 | 113 |
114 // Hepler method to schedule next capture using the current rate. | 114 // Hepler method to schedule next capture using the current rate. |
115 void ScheduleNextCapture(); | 115 void ScheduleNextCapture(); |
116 | 116 |
117 void DoCapture(); | 117 void DoCapture(); |
118 void CaptureDoneCallback(scoped_refptr<Capturer::CaptureData> capture_data); | 118 void CaptureDoneCallback(scoped_refptr<CaptureData> capture_data); |
119 void DoFinishEncode(); | 119 void DoFinishEncode(); |
120 | 120 |
121 void DoGetInitInfo(scoped_refptr<ClientConnection> client); | 121 void DoGetInitInfo(scoped_refptr<ClientConnection> client); |
122 | 122 |
123 // Network thread ----------------------------------------------------------- | 123 // Network thread ----------------------------------------------------------- |
124 | 124 |
125 void DoStartRateControl(); | 125 void DoStartRateControl(); |
126 void DoPauseRateControl(); | 126 void DoPauseRateControl(); |
127 | 127 |
128 // Helper method to schedule next rate regulation task. | 128 // Helper method to schedule next rate regulation task. |
129 void ScheduleNextRateControl(); | 129 void ScheduleNextRateControl(); |
130 | 130 |
131 void DoRateControl(); | 131 void DoRateControl(); |
132 | 132 |
133 // DoSendUpdate takes ownership of header and is responsible for deleting it. | 133 // DoSendUpdate takes ownership of header and is responsible for deleting it. |
134 void DoSendUpdate(HostMessage* message, | 134 void DoSendUpdate(HostMessage* message, |
135 Encoder::EncodingState state); | 135 Encoder::EncodingState state); |
136 void DoSendInit(scoped_refptr<ClientConnection> client, | 136 void DoSendInit(scoped_refptr<ClientConnection> client, |
137 int width, int height); | 137 int width, int height); |
138 | 138 |
139 void DoAddClient(scoped_refptr<ClientConnection> client); | 139 void DoAddClient(scoped_refptr<ClientConnection> client); |
140 void DoRemoveClient(scoped_refptr<ClientConnection> client); | 140 void DoRemoveClient(scoped_refptr<ClientConnection> client); |
141 void DoRemoveAllClients(); | 141 void DoRemoveAllClients(); |
142 | 142 |
143 // Encoder thread ----------------------------------------------------------- | 143 // Encoder thread ----------------------------------------------------------- |
144 | 144 |
145 void DoEncode(scoped_refptr<Capturer::CaptureData> capture_data); | 145 void DoEncode(scoped_refptr<CaptureData> capture_data); |
146 | 146 |
147 // EncodeDataAvailableTask takes ownership of header and is responsible for | 147 // EncodeDataAvailableTask takes ownership of header and is responsible for |
148 // deleting it. | 148 // deleting it. |
149 void EncodeDataAvailableTask(HostMessage* message, | 149 void EncodeDataAvailableTask(HostMessage* message, |
150 Encoder::EncodingState state); | 150 Encoder::EncodingState state); |
151 | 151 |
152 // Message loops used by this class. | 152 // Message loops used by this class. |
153 MessageLoop* capture_loop_; | 153 MessageLoop* capture_loop_; |
154 MessageLoop* encode_loop_; | 154 MessageLoop* encode_loop_; |
155 MessageLoop* network_loop_; | 155 MessageLoop* network_loop_; |
(...skipping 26 matching lines...) Expand all Loading... |
182 | 182 |
183 // The following member is accessed on the network thread. | 183 // The following member is accessed on the network thread. |
184 bool rate_control_started_; | 184 bool rate_control_started_; |
185 | 185 |
186 DISALLOW_COPY_AND_ASSIGN(SessionManager); | 186 DISALLOW_COPY_AND_ASSIGN(SessionManager); |
187 }; | 187 }; |
188 | 188 |
189 } // namespace remoting | 189 } // namespace remoting |
190 | 190 |
191 #endif // REMOTING_HOST_RECORD_SESSION_H_ | 191 #endif // REMOTING_HOST_RECORD_SESSION_H_ |
OLD | NEW |