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 #include "remoting/host/client_session.h" | 5 #include "remoting/host/client_session.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "remoting/capturer/video_frame_capturer.h" | 10 #include "remoting/capturer/video_frame_capturer.h" |
11 #include "remoting/codec/audio_encoder.h" | 11 #include "remoting/codec/audio_encoder.h" |
12 #include "remoting/codec/audio_encoder_opus.h" | 12 #include "remoting/codec/audio_encoder_opus.h" |
13 #include "remoting/codec/audio_encoder_speex.h" | 13 #include "remoting/codec/audio_encoder_speex.h" |
14 #include "remoting/codec/audio_encoder_verbatim.h" | 14 #include "remoting/codec/audio_encoder_verbatim.h" |
15 #include "remoting/codec/video_encoder.h" | 15 #include "remoting/codec/video_encoder.h" |
16 #include "remoting/codec/video_encoder_verbatim.h" | 16 #include "remoting/codec/video_encoder_verbatim.h" |
17 #include "remoting/codec/video_encoder_vp8.h" | 17 #include "remoting/codec/video_encoder_vp8.h" |
| 18 #include "remoting/host/audio_capturer.h" |
18 #include "remoting/host/audio_scheduler.h" | 19 #include "remoting/host/audio_scheduler.h" |
19 #include "remoting/host/desktop_environment.h" | 20 #include "remoting/host/desktop_environment.h" |
20 #include "remoting/host/desktop_environment_factory.h" | 21 #include "remoting/host/desktop_environment_factory.h" |
21 #include "remoting/host/event_executor.h" | 22 #include "remoting/host/event_executor.h" |
22 #include "remoting/host/video_scheduler.h" | 23 #include "remoting/host/video_scheduler.h" |
23 #include "remoting/proto/control.pb.h" | 24 #include "remoting/proto/control.pb.h" |
24 #include "remoting/proto/event.pb.h" | 25 #include "remoting/proto/event.pb.h" |
25 #include "remoting/protocol/client_stub.h" | 26 #include "remoting/protocol/client_stub.h" |
26 #include "remoting/protocol/clipboard_thread_proxy.h" | 27 #include "remoting/protocol/clipboard_thread_proxy.h" |
27 | 28 |
28 namespace remoting { | 29 namespace remoting { |
29 | 30 |
30 ClientSession::ClientSession( | 31 ClientSession::ClientSession( |
31 EventHandler* event_handler, | 32 EventHandler* event_handler, |
32 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, | 33 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, |
| 34 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
33 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, | 35 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, |
34 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner, | 36 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner, |
35 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, | 37 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, |
| 38 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
36 scoped_ptr<protocol::ConnectionToClient> connection, | 39 scoped_ptr<protocol::ConnectionToClient> connection, |
37 DesktopEnvironmentFactory* desktop_environment_factory, | 40 DesktopEnvironmentFactory* desktop_environment_factory, |
38 const base::TimeDelta& max_duration) | 41 const base::TimeDelta& max_duration) |
39 : event_handler_(event_handler), | 42 : event_handler_(event_handler), |
40 connection_(connection.Pass()), | 43 connection_(connection.Pass()), |
41 connection_factory_(connection_.get()), | 44 connection_factory_(connection_.get()), |
42 desktop_environment_(desktop_environment_factory->Create()), | |
43 client_jid_(connection_->session()->jid()), | 45 client_jid_(connection_->session()->jid()), |
| 46 desktop_environment_(desktop_environment_factory->Create( |
| 47 client_jid_, |
| 48 base::Bind(&protocol::ConnectionToClient::Disconnect, |
| 49 connection_factory_.GetWeakPtr()))), |
44 input_tracker_(&host_input_filter_), | 50 input_tracker_(&host_input_filter_), |
45 remote_input_filter_(&input_tracker_), | 51 remote_input_filter_(&input_tracker_), |
46 mouse_clamping_filter_(&remote_input_filter_, connection_->video_stub()), | 52 mouse_clamping_filter_(&remote_input_filter_, connection_->video_stub()), |
47 disable_input_filter_(mouse_clamping_filter_.input_filter()), | 53 disable_input_filter_(mouse_clamping_filter_.input_filter()), |
48 disable_clipboard_filter_(clipboard_echo_filter_.host_filter()), | 54 disable_clipboard_filter_(clipboard_echo_filter_.host_filter()), |
49 auth_input_filter_(&disable_input_filter_), | 55 auth_input_filter_(&disable_input_filter_), |
50 auth_clipboard_filter_(&disable_clipboard_filter_), | 56 auth_clipboard_filter_(&disable_clipboard_filter_), |
51 client_clipboard_factory_(clipboard_echo_filter_.client_filter()), | 57 client_clipboard_factory_(clipboard_echo_filter_.client_filter()), |
52 max_duration_(max_duration), | 58 max_duration_(max_duration), |
53 audio_task_runner_(audio_task_runner), | 59 audio_task_runner_(audio_task_runner), |
| 60 input_task_runner_(input_task_runner), |
54 video_capture_task_runner_(video_capture_task_runner), | 61 video_capture_task_runner_(video_capture_task_runner), |
55 video_encode_task_runner_(video_encode_task_runner), | 62 video_encode_task_runner_(video_encode_task_runner), |
56 network_task_runner_(network_task_runner), | 63 network_task_runner_(network_task_runner), |
57 active_recorders_(0) { | 64 ui_task_runner_(ui_task_runner) { |
58 connection_->SetEventHandler(this); | 65 connection_->SetEventHandler(this); |
59 | 66 |
60 // TODO(sergeyu): Currently ConnectionToClient expects stubs to be | 67 // TODO(sergeyu): Currently ConnectionToClient expects stubs to be |
61 // set before channels are connected. Make it possible to set stubs | 68 // set before channels are connected. Make it possible to set stubs |
62 // later and set them only when connection is authenticated. | 69 // later and set them only when connection is authenticated. |
63 connection_->set_clipboard_stub(&auth_clipboard_filter_); | 70 connection_->set_clipboard_stub(&auth_clipboard_filter_); |
64 connection_->set_host_stub(this); | 71 connection_->set_host_stub(this); |
65 connection_->set_input_stub(&auth_input_filter_); | 72 connection_->set_input_stub(&auth_input_filter_); |
66 | 73 |
67 // |auth_*_filter_|'s states reflect whether the session is authenticated. | 74 // |auth_*_filter_|'s states reflect whether the session is authenticated. |
68 auth_input_filter_.set_enabled(false); | 75 auth_input_filter_.set_enabled(false); |
69 auth_clipboard_filter_.set_enabled(false); | 76 auth_clipboard_filter_.set_enabled(false); |
70 } | 77 } |
71 | 78 |
72 void ClientSession::NotifyClientDimensions( | 79 void ClientSession::NotifyClientDimensions( |
73 const protocol::ClientDimensions& dimensions) { | 80 const protocol::ClientDimensions& dimensions) { |
74 if (dimensions.has_width() && dimensions.has_height()) { | 81 if (dimensions.has_width() && dimensions.has_height()) { |
75 VLOG(1) << "Received ClientDimensions (width=" | 82 VLOG(1) << "Received ClientDimensions (width=" |
76 << dimensions.width() << ", height=" << dimensions.height() << ")"; | 83 << dimensions.width() << ", height=" << dimensions.height() << ")"; |
77 event_handler_->OnClientDimensionsChanged( | 84 event_handler_->OnClientDimensionsChanged( |
78 this, SkISize::Make(dimensions.width(), dimensions.height())); | 85 this, SkISize::Make(dimensions.width(), dimensions.height())); |
79 } | 86 } |
80 } | 87 } |
81 | 88 |
82 void ClientSession::ControlVideo(const protocol::VideoControl& video_control) { | 89 void ClientSession::ControlVideo(const protocol::VideoControl& video_control) { |
83 if (video_control.has_enable()) { | 90 if (video_control.has_enable()) { |
84 VLOG(1) << "Received VideoControl (enable=" | 91 VLOG(1) << "Received VideoControl (enable=" |
85 << video_control.enable() << ")"; | 92 << video_control.enable() << ")"; |
86 if (video_scheduler_.get()) { | 93 if (video_scheduler_.get()) |
87 video_scheduler_->Pause(!video_control.enable()); | 94 video_scheduler_->Pause(!video_control.enable()); |
88 } | |
89 } | 95 } |
90 } | 96 } |
91 | 97 |
92 void ClientSession::ControlAudio(const protocol::AudioControl& audio_control) { | 98 void ClientSession::ControlAudio(const protocol::AudioControl& audio_control) { |
93 if (audio_control.has_enable()) { | 99 if (audio_control.has_enable()) { |
94 VLOG(1) << "Received AudioControl (enable=" | 100 VLOG(1) << "Received AudioControl (enable=" |
95 << audio_control.enable() << ")"; | 101 << audio_control.enable() << ")"; |
96 if (audio_scheduler_.get()) { | 102 if (audio_scheduler_.get()) |
97 audio_scheduler_->SetEnabled(audio_control.enable()); | 103 audio_scheduler_->Pause(!audio_control.enable()); |
98 } | |
99 } | 104 } |
100 } | 105 } |
101 | 106 |
102 void ClientSession::OnConnectionAuthenticated( | 107 void ClientSession::OnConnectionAuthenticated( |
103 protocol::ConnectionToClient* connection) { | 108 protocol::ConnectionToClient* connection) { |
104 DCHECK(CalledOnValidThread()); | 109 DCHECK(CalledOnValidThread()); |
105 DCHECK_EQ(connection_.get(), connection); | 110 DCHECK_EQ(connection_.get(), connection); |
106 | 111 |
107 auth_input_filter_.set_enabled(true); | 112 auth_input_filter_.set_enabled(true); |
108 auth_clipboard_filter_.set_enabled(true); | 113 auth_clipboard_filter_.set_enabled(true); |
109 | 114 |
110 clipboard_echo_filter_.set_client_stub(connection_->client_stub()); | 115 clipboard_echo_filter_.set_client_stub(connection_->client_stub()); |
111 | 116 |
112 if (max_duration_ > base::TimeDelta()) { | 117 if (max_duration_ > base::TimeDelta()) { |
113 // TODO(simonmorris): Let Disconnect() tell the client that the | 118 // TODO(simonmorris): Let Disconnect() tell the client that the |
114 // disconnection was caused by the session exceeding its maximum duration. | 119 // disconnection was caused by the session exceeding its maximum duration. |
115 max_duration_timer_.Start(FROM_HERE, max_duration_, | 120 max_duration_timer_.Start(FROM_HERE, max_duration_, |
116 this, &ClientSession::Disconnect); | 121 this, &ClientSession::Disconnect); |
117 } | 122 } |
118 | 123 |
119 event_handler_->OnSessionAuthenticated(this); | 124 event_handler_->OnSessionAuthenticated(this); |
120 } | 125 } |
121 | 126 |
122 void ClientSession::OnConnectionChannelsConnected( | 127 void ClientSession::OnConnectionChannelsConnected( |
123 protocol::ConnectionToClient* connection) { | 128 protocol::ConnectionToClient* connection) { |
124 DCHECK(CalledOnValidThread()); | 129 DCHECK(CalledOnValidThread()); |
125 DCHECK_EQ(connection_.get(), connection); | 130 DCHECK_EQ(connection_.get(), connection); |
| 131 DCHECK(!audio_scheduler_.get()); |
| 132 DCHECK(!event_executor_); |
| 133 DCHECK(!video_scheduler_.get()); |
| 134 |
| 135 // Create and start the event executor. |
| 136 event_executor_ = desktop_environment_->CreateEventExecutor( |
| 137 input_task_runner_, ui_task_runner_); |
| 138 event_executor_->Start(CreateClipboardProxy()); |
126 | 139 |
127 // Connect the host clipboard and input stubs. | 140 // Connect the host clipboard and input stubs. |
128 host_input_filter_.set_input_stub(desktop_environment_->event_executor()); | 141 host_input_filter_.set_input_stub(event_executor_.get()); |
129 clipboard_echo_filter_.set_host_stub(desktop_environment_->event_executor()); | 142 clipboard_echo_filter_.set_host_stub(event_executor_.get()); |
130 | 143 |
131 SetDisableInputs(false); | 144 SetDisableInputs(false); |
132 | 145 |
133 // Let the desktop environment notify us of local clipboard changes. | |
134 desktop_environment_->Start( | |
135 CreateClipboardProxy(), | |
136 client_jid(), | |
137 base::Bind(&protocol::ConnectionToClient::Disconnect, | |
138 connection_factory_.GetWeakPtr())); | |
139 | |
140 // Create a VideoEncoder based on the session's video channel configuration. | 146 // Create a VideoEncoder based on the session's video channel configuration. |
141 scoped_ptr<VideoEncoder> video_encoder = | 147 scoped_ptr<VideoEncoder> video_encoder = |
142 CreateVideoEncoder(connection_->session()->config()); | 148 CreateVideoEncoder(connection_->session()->config()); |
143 | 149 |
144 // Create a VideoScheduler to pump frames from the capturer to the client. | 150 // Create a VideoScheduler to pump frames from the capturer to the client. |
145 video_scheduler_ = VideoScheduler::Create( | 151 video_scheduler_ = VideoScheduler::Create( |
146 video_capture_task_runner_, | 152 video_capture_task_runner_, |
147 video_encode_task_runner_, | 153 video_encode_task_runner_, |
148 network_task_runner_, | 154 network_task_runner_, |
149 desktop_environment_->video_capturer(), | 155 desktop_environment_->CreateVideoCapturer(video_capture_task_runner_, |
| 156 video_encode_task_runner_), |
150 video_encoder.Pass(), | 157 video_encoder.Pass(), |
151 connection_->client_stub(), | 158 connection_->client_stub(), |
152 &mouse_clamping_filter_); | 159 &mouse_clamping_filter_); |
153 ++active_recorders_; | |
154 | 160 |
155 // Create an AudioScheduler if audio is enabled, to pump audio samples. | 161 // Create an AudioScheduler if audio is enabled, to pump audio samples. |
156 if (connection_->session()->config().is_audio_enabled()) { | 162 if (connection_->session()->config().is_audio_enabled()) { |
157 scoped_ptr<AudioEncoder> audio_encoder = | 163 scoped_ptr<AudioEncoder> audio_encoder = |
158 CreateAudioEncoder(connection_->session()->config()); | 164 CreateAudioEncoder(connection_->session()->config()); |
159 audio_scheduler_ = AudioScheduler::Create( | 165 audio_scheduler_ = AudioScheduler::Create( |
160 audio_task_runner_, | 166 audio_task_runner_, |
161 network_task_runner_, | 167 network_task_runner_, |
162 desktop_environment_->audio_capturer(), | 168 desktop_environment_->CreateAudioCapturer(audio_task_runner_), |
163 audio_encoder.Pass(), | 169 audio_encoder.Pass(), |
164 connection_->audio_stub()); | 170 connection_->audio_stub()); |
165 ++active_recorders_; | |
166 } | 171 } |
167 | 172 |
168 // Notify the event handler that all our channels are now connected. | 173 // Notify the event handler that all our channels are now connected. |
169 event_handler_->OnSessionChannelsConnected(this); | 174 event_handler_->OnSessionChannelsConnected(this); |
170 } | 175 } |
171 | 176 |
172 void ClientSession::OnConnectionClosed( | 177 void ClientSession::OnConnectionClosed( |
173 protocol::ConnectionToClient* connection, | 178 protocol::ConnectionToClient* connection, |
174 protocol::ErrorCode error) { | 179 protocol::ErrorCode error) { |
175 DCHECK(CalledOnValidThread()); | 180 DCHECK(CalledOnValidThread()); |
(...skipping 11 matching lines...) Expand all Loading... |
187 // is_authenticated(), so that we can disable |auth_*_filter_| here. | 192 // is_authenticated(), so that we can disable |auth_*_filter_| here. |
188 disable_input_filter_.set_enabled(false); | 193 disable_input_filter_.set_enabled(false); |
189 disable_clipboard_filter_.set_enabled(false); | 194 disable_clipboard_filter_.set_enabled(false); |
190 | 195 |
191 // Ensure that any pressed keys or buttons are released. | 196 // Ensure that any pressed keys or buttons are released. |
192 input_tracker_.ReleaseAll(); | 197 input_tracker_.ReleaseAll(); |
193 | 198 |
194 // Stop components access the client, audio or video stubs, which are no | 199 // Stop components access the client, audio or video stubs, which are no |
195 // longer valid once ConnectionToClient calls OnConnectionClosed(). | 200 // longer valid once ConnectionToClient calls OnConnectionClosed(). |
196 if (audio_scheduler_.get()) { | 201 if (audio_scheduler_.get()) { |
197 audio_scheduler_->Stop(base::Bind(&ClientSession::OnRecorderStopped, this)); | 202 audio_scheduler_->Stop(); |
198 audio_scheduler_ = NULL; | 203 audio_scheduler_ = NULL; |
199 } | 204 } |
200 if (video_scheduler_.get()) { | 205 if (video_scheduler_.get()) { |
201 video_scheduler_->Stop(base::Bind(&ClientSession::OnRecorderStopped, this)); | 206 video_scheduler_->Stop(); |
202 video_scheduler_ = NULL; | 207 video_scheduler_ = NULL; |
203 } | 208 } |
| 209 |
204 client_clipboard_factory_.InvalidateWeakPtrs(); | 210 client_clipboard_factory_.InvalidateWeakPtrs(); |
| 211 event_executor_.reset(); |
| 212 desktop_environment_.reset(); |
205 | 213 |
206 // Notify the ChromotingHost that this client is disconnected. | 214 // Notify the ChromotingHost that this client is disconnected. |
207 // TODO(sergeyu): Log failure reason? | 215 // TODO(sergeyu): Log failure reason? |
208 event_handler_->OnSessionClosed(this); | 216 event_handler_->OnSessionClosed(this); |
209 } | 217 } |
210 | 218 |
211 void ClientSession::OnSequenceNumberUpdated( | 219 void ClientSession::OnSequenceNumberUpdated( |
212 protocol::ConnectionToClient* connection, int64 sequence_number) { | 220 protocol::ConnectionToClient* connection, int64 sequence_number) { |
213 DCHECK(CalledOnValidThread()); | 221 DCHECK(CalledOnValidThread()); |
214 DCHECK_EQ(connection_.get(), connection); | 222 DCHECK_EQ(connection_.get(), connection); |
(...skipping 17 matching lines...) Expand all Loading... |
232 DCHECK(CalledOnValidThread()); | 240 DCHECK(CalledOnValidThread()); |
233 DCHECK(connection_.get()); | 241 DCHECK(connection_.get()); |
234 | 242 |
235 max_duration_timer_.Stop(); | 243 max_duration_timer_.Stop(); |
236 | 244 |
237 // This triggers OnConnectionClosed(), and the session may be destroyed | 245 // This triggers OnConnectionClosed(), and the session may be destroyed |
238 // as the result, so this call must be the last in this method. | 246 // as the result, so this call must be the last in this method. |
239 connection_->Disconnect(); | 247 connection_->Disconnect(); |
240 } | 248 } |
241 | 249 |
242 void ClientSession::Stop(const base::Closure& stopped_task) { | 250 void ClientSession::Stop() { |
243 DCHECK(CalledOnValidThread()); | 251 DCHECK(CalledOnValidThread()); |
244 DCHECK(stopped_task_.is_null()); | |
245 DCHECK(!stopped_task.is_null()); | |
246 DCHECK(audio_scheduler_.get() == NULL); | 252 DCHECK(audio_scheduler_.get() == NULL); |
| 253 DCHECK(!desktop_environment_); |
| 254 DCHECK(!event_executor_); |
247 DCHECK(video_scheduler_.get() == NULL); | 255 DCHECK(video_scheduler_.get() == NULL); |
248 | 256 |
249 stopped_task_ = stopped_task; | 257 connection_.reset(); |
250 | |
251 if (active_recorders_ == 0) { | |
252 // |stopped_task_| may tear down the signalling layer, so tear-down | |
253 // |connection_| before invoking it. | |
254 connection_.reset(); | |
255 stopped_task_.Run(); | |
256 } | |
257 } | 258 } |
258 | 259 |
259 void ClientSession::LocalMouseMoved(const SkIPoint& mouse_pos) { | 260 void ClientSession::LocalMouseMoved(const SkIPoint& mouse_pos) { |
260 DCHECK(CalledOnValidThread()); | 261 DCHECK(CalledOnValidThread()); |
261 remote_input_filter_.LocalMouseMoved(mouse_pos); | 262 remote_input_filter_.LocalMouseMoved(mouse_pos); |
262 } | 263 } |
263 | 264 |
264 void ClientSession::SetDisableInputs(bool disable_inputs) { | 265 void ClientSession::SetDisableInputs(bool disable_inputs) { |
265 DCHECK(CalledOnValidThread()); | 266 DCHECK(CalledOnValidThread()); |
266 | 267 |
267 if (disable_inputs) | 268 if (disable_inputs) |
268 input_tracker_.ReleaseAll(); | 269 input_tracker_.ReleaseAll(); |
269 | 270 |
270 disable_input_filter_.set_enabled(!disable_inputs); | 271 disable_input_filter_.set_enabled(!disable_inputs); |
271 disable_clipboard_filter_.set_enabled(!disable_inputs); | 272 disable_clipboard_filter_.set_enabled(!disable_inputs); |
272 } | 273 } |
273 | 274 |
274 ClientSession::~ClientSession() { | 275 ClientSession::~ClientSession() { |
275 DCHECK_EQ(active_recorders_, 0); | |
276 DCHECK(audio_scheduler_.get() == NULL); | 276 DCHECK(audio_scheduler_.get() == NULL); |
| 277 DCHECK(!desktop_environment_); |
| 278 DCHECK(!event_executor_); |
277 DCHECK(video_scheduler_.get() == NULL); | 279 DCHECK(video_scheduler_.get() == NULL); |
278 } | 280 } |
279 | 281 |
280 scoped_ptr<protocol::ClipboardStub> ClientSession::CreateClipboardProxy() { | 282 scoped_ptr<protocol::ClipboardStub> ClientSession::CreateClipboardProxy() { |
281 DCHECK(CalledOnValidThread()); | 283 DCHECK(CalledOnValidThread()); |
282 | 284 |
283 return scoped_ptr<protocol::ClipboardStub>( | 285 return scoped_ptr<protocol::ClipboardStub>( |
284 new protocol::ClipboardThreadProxy( | 286 new protocol::ClipboardThreadProxy( |
285 client_clipboard_factory_.GetWeakPtr(), | 287 client_clipboard_factory_.GetWeakPtr(), |
286 base::MessageLoopProxy::current())); | 288 base::MessageLoopProxy::current())); |
287 } | 289 } |
288 | 290 |
289 void ClientSession::OnRecorderStopped() { | |
290 if (!network_task_runner_->BelongsToCurrentThread()) { | |
291 network_task_runner_->PostTask( | |
292 FROM_HERE, base::Bind(&ClientSession::OnRecorderStopped, this)); | |
293 return; | |
294 } | |
295 | |
296 --active_recorders_; | |
297 DCHECK_GE(active_recorders_, 0); | |
298 | |
299 DCHECK(!stopped_task_.is_null()); | |
300 if (active_recorders_ == 0) { | |
301 // |stopped_task_| may result in the signalling layer being torn down, so | |
302 // tear down the ConnectionToClient first. | |
303 connection_.reset(); | |
304 stopped_task_.Run(); | |
305 } | |
306 } | |
307 | |
308 // TODO(sergeyu): Move this to SessionManager? | 291 // TODO(sergeyu): Move this to SessionManager? |
309 // static | 292 // static |
310 scoped_ptr<VideoEncoder> ClientSession::CreateVideoEncoder( | 293 scoped_ptr<VideoEncoder> ClientSession::CreateVideoEncoder( |
311 const protocol::SessionConfig& config) { | 294 const protocol::SessionConfig& config) { |
312 const protocol::ChannelConfig& video_config = config.video_config(); | 295 const protocol::ChannelConfig& video_config = config.video_config(); |
313 | 296 |
314 if (video_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) { | 297 if (video_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) { |
315 return scoped_ptr<VideoEncoder>(new remoting::VideoEncoderVerbatim()); | 298 return scoped_ptr<VideoEncoder>(new remoting::VideoEncoderVerbatim()); |
316 } else if (video_config.codec == protocol::ChannelConfig::CODEC_VP8) { | 299 } else if (video_config.codec == protocol::ChannelConfig::CODEC_VP8) { |
317 return scoped_ptr<VideoEncoder>(new remoting::VideoEncoderVp8()); | 300 return scoped_ptr<VideoEncoder>(new remoting::VideoEncoderVp8()); |
(...skipping 19 matching lines...) Expand all Loading... |
337 NOTIMPLEMENTED(); | 320 NOTIMPLEMENTED(); |
338 return scoped_ptr<AudioEncoder>(NULL); | 321 return scoped_ptr<AudioEncoder>(NULL); |
339 } | 322 } |
340 | 323 |
341 // static | 324 // static |
342 void ClientSessionTraits::Destruct(const ClientSession* client) { | 325 void ClientSessionTraits::Destruct(const ClientSession* client) { |
343 client->network_task_runner_->DeleteSoon(FROM_HERE, client); | 326 client->network_task_runner_->DeleteSoon(FROM_HERE, client); |
344 } | 327 } |
345 | 328 |
346 } // namespace remoting | 329 } // namespace remoting |
OLD | NEW |