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/encoder.h" |
16 #include "remoting/host/capturer.h" | 16 #include "remoting/host/capturer.h" |
17 #include "remoting/proto/video.pb.h" | 17 // TODO(hclam): This class should not know the internal protobuf types. |
| 18 #include "remoting/proto/internal.pb.h" |
18 | 19 |
19 namespace remoting { | 20 namespace remoting { |
20 | 21 |
21 class CaptureData; | 22 class CaptureData; |
22 class ClientConnection; | 23 class ClientConnection; |
23 | 24 |
24 // A class for controlling and coordinate Capturer, Encoder | 25 // A class for controlling and coordinate Capturer, Encoder |
25 // and NetworkChannel in a record session. | 26 // and NetworkChannel in a record session. |
26 // | 27 // |
27 // THREADING | 28 // THREADING |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 119 |
119 void DoStartRateControl(); | 120 void DoStartRateControl(); |
120 void DoPauseRateControl(); | 121 void DoPauseRateControl(); |
121 | 122 |
122 // Helper method to schedule next rate regulation task. | 123 // Helper method to schedule next rate regulation task. |
123 void ScheduleNextRateControl(); | 124 void ScheduleNextRateControl(); |
124 | 125 |
125 void DoRateControl(); | 126 void DoRateControl(); |
126 | 127 |
127 // DoSendUpdate takes ownership of header and is responsible for deleting it. | 128 // DoSendUpdate takes ownership of header and is responsible for deleting it. |
128 void DoSendVideoPacket(VideoPacket* packet); | 129 void DoSendUpdate(ChromotingHostMessage* message, |
| 130 Encoder::EncodingState state); |
129 void DoSendInit(scoped_refptr<ClientConnection> client, | 131 void DoSendInit(scoped_refptr<ClientConnection> client, |
130 int width, int height); | 132 int width, int height); |
131 | 133 |
132 void DoAddClient(scoped_refptr<ClientConnection> client); | 134 void DoAddClient(scoped_refptr<ClientConnection> client); |
133 void DoRemoveClient(scoped_refptr<ClientConnection> client); | 135 void DoRemoveClient(scoped_refptr<ClientConnection> client); |
134 void DoRemoveAllClients(); | 136 void DoRemoveAllClients(); |
135 | 137 |
136 // Encoder thread ----------------------------------------------------------- | 138 // Encoder thread ----------------------------------------------------------- |
137 | 139 |
138 void DoEncode(scoped_refptr<CaptureData> capture_data); | 140 void DoEncode(scoped_refptr<CaptureData> capture_data); |
139 | 141 |
140 // EncodeDataAvailableTask takes ownership of header and is responsible for | 142 // EncodeDataAvailableTask takes ownership of header and is responsible for |
141 // deleting it. | 143 // deleting it. |
142 void EncodeDataAvailableTask(VideoPacket* packet); | 144 void EncodeDataAvailableTask(ChromotingHostMessage* message, |
| 145 Encoder::EncodingState state); |
143 | 146 |
144 // Message loops used by this class. | 147 // Message loops used by this class. |
145 MessageLoop* capture_loop_; | 148 MessageLoop* capture_loop_; |
146 MessageLoop* encode_loop_; | 149 MessageLoop* encode_loop_; |
147 MessageLoop* network_loop_; | 150 MessageLoop* network_loop_; |
148 | 151 |
149 // Reference to the capturer. This member is always accessed on the capture | 152 // Reference to the capturer. This member is always accessed on the capture |
150 // thread. | 153 // thread. |
151 scoped_ptr<Capturer> capturer_; | 154 scoped_ptr<Capturer> capturer_; |
152 | 155 |
(...skipping 21 matching lines...) Expand all Loading... |
174 | 177 |
175 // The following member is accessed on the network thread. | 178 // The following member is accessed on the network thread. |
176 bool rate_control_started_; | 179 bool rate_control_started_; |
177 | 180 |
178 DISALLOW_COPY_AND_ASSIGN(SessionManager); | 181 DISALLOW_COPY_AND_ASSIGN(SessionManager); |
179 }; | 182 }; |
180 | 183 |
181 } // namespace remoting | 184 } // namespace remoting |
182 | 185 |
183 #endif // REMOTING_HOST_RECORD_SESSION_H_ | 186 #endif // REMOTING_HOST_RECORD_SESSION_H_ |
OLD | NEW |