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/chromoting_host.h" | 5 #include "remoting/host/chromoting_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
216 if (reject_authenticating_client_) { | 216 if (reject_authenticating_client_) { |
217 client->Disconnect(); | 217 client->Disconnect(); |
218 } | 218 } |
219 } | 219 } |
220 | 220 |
221 void ChromotingHost::OnSessionChannelsConnected(ClientSession* client) { | 221 void ChromotingHost::OnSessionChannelsConnected(ClientSession* client) { |
222 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); | 222 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); |
223 | 223 |
224 // Then we create a ScreenRecorder passing the message loops that | 224 // Then we create a ScreenRecorder passing the message loops that |
225 // it should run on. | 225 // it should run on. |
226 Encoder* encoder = CreateEncoder(client->connection()->session()->config()); | 226 VideoEncoder* encoder = |
simonmorris
2012/08/24 16:19:29
encoder -> video_encoder?
kxing
2012/08/24 16:28:04
Done.
| |
227 CreateEncoder(client->connection()->session()->config()); | |
227 | 228 |
228 recorder_ = new ScreenRecorder(context_->capture_task_runner(), | 229 recorder_ = new ScreenRecorder(context_->capture_task_runner(), |
229 context_->encode_task_runner(), | 230 context_->encode_task_runner(), |
230 context_->network_task_runner(), | 231 context_->network_task_runner(), |
231 desktop_environment_->capturer(), | 232 desktop_environment_->capturer(), |
232 encoder); | 233 encoder); |
233 if (client->connection()->session()->config().is_audio_enabled()) { | 234 if (client->connection()->session()->config().is_audio_enabled()) { |
234 scoped_ptr<AudioEncoder> audio_encoder = | 235 scoped_ptr<AudioEncoder> audio_encoder = |
235 CreateAudioEncoder(client->connection()->session()->config()); | 236 CreateAudioEncoder(client->connection()->session()->config()); |
236 audio_scheduler_ = new AudioScheduler( | 237 audio_scheduler_ = new AudioScheduler( |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
414 | 415 |
415 void ChromotingHost::SetUiStrings(const UiStrings& ui_strings) { | 416 void ChromotingHost::SetUiStrings(const UiStrings& ui_strings) { |
416 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); | 417 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); |
417 DCHECK_EQ(state_, kInitial); | 418 DCHECK_EQ(state_, kInitial); |
418 | 419 |
419 ui_strings_ = ui_strings; | 420 ui_strings_ = ui_strings; |
420 } | 421 } |
421 | 422 |
422 // TODO(sergeyu): Move this to SessionManager? | 423 // TODO(sergeyu): Move this to SessionManager? |
423 // static | 424 // static |
424 Encoder* ChromotingHost::CreateEncoder(const protocol::SessionConfig& config) { | 425 VideoEncoder* ChromotingHost::CreateEncoder( |
426 const protocol::SessionConfig& config) { | |
425 const protocol::ChannelConfig& video_config = config.video_config(); | 427 const protocol::ChannelConfig& video_config = config.video_config(); |
426 | 428 |
427 if (video_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) { | 429 if (video_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) { |
428 return EncoderRowBased::CreateVerbatimEncoder(); | 430 return VideoEncoderRowBased::CreateVerbatimEncoder(); |
429 } else if (video_config.codec == protocol::ChannelConfig::CODEC_ZIP) { | 431 } else if (video_config.codec == protocol::ChannelConfig::CODEC_ZIP) { |
430 return EncoderRowBased::CreateZlibEncoder(); | 432 return VideoEncoderRowBased::CreateZlibEncoder(); |
431 } else if (video_config.codec == protocol::ChannelConfig::CODEC_VP8) { | 433 } else if (video_config.codec == protocol::ChannelConfig::CODEC_VP8) { |
432 return new remoting::EncoderVp8(); | 434 return new remoting::VideoEncoderVp8(); |
433 } | 435 } |
434 | 436 |
435 return NULL; | 437 return NULL; |
436 } | 438 } |
437 | 439 |
438 // static | 440 // static |
439 scoped_ptr<AudioEncoder> ChromotingHost::CreateAudioEncoder( | 441 scoped_ptr<AudioEncoder> ChromotingHost::CreateAudioEncoder( |
440 const protocol::SessionConfig& config) { | 442 const protocol::SessionConfig& config) { |
441 const protocol::ChannelConfig& audio_config = config.audio_config(); | 443 const protocol::ChannelConfig& audio_config = config.audio_config(); |
442 | 444 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
499 OnShutdown()); | 501 OnShutdown()); |
500 | 502 |
501 for (std::vector<base::Closure>::iterator it = shutdown_tasks_.begin(); | 503 for (std::vector<base::Closure>::iterator it = shutdown_tasks_.begin(); |
502 it != shutdown_tasks_.end(); ++it) { | 504 it != shutdown_tasks_.end(); ++it) { |
503 it->Run(); | 505 it->Run(); |
504 } | 506 } |
505 shutdown_tasks_.clear(); | 507 shutdown_tasks_.clear(); |
506 } | 508 } |
507 | 509 |
508 } // namespace remoting | 510 } // namespace remoting |
OLD | NEW |