| 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/codec/audio_encoder.h" | 10 #include "remoting/codec/audio_encoder.h" |
| 11 #include "remoting/codec/audio_encoder_speex.h" | 11 #include "remoting/codec/audio_encoder_speex.h" |
| 12 #include "remoting/codec/audio_encoder_verbatim.h" | 12 #include "remoting/codec/audio_encoder_verbatim.h" |
| 13 #include "remoting/codec/video_encoder.h" | 13 #include "remoting/codec/video_encoder.h" |
| 14 #include "remoting/codec/video_encoder_row_based.h" | 14 #include "remoting/codec/video_encoder_verbatim.h" |
| 15 #include "remoting/codec/video_encoder_vp8.h" | 15 #include "remoting/codec/video_encoder_vp8.h" |
| 16 #include "remoting/host/audio_scheduler.h" | 16 #include "remoting/host/audio_scheduler.h" |
| 17 #include "remoting/host/desktop_environment.h" | 17 #include "remoting/host/desktop_environment.h" |
| 18 #include "remoting/host/event_executor.h" | 18 #include "remoting/host/event_executor.h" |
| 19 #include "remoting/host/screen_recorder.h" | 19 #include "remoting/host/screen_recorder.h" |
| 20 #include "remoting/host/video_frame_capturer.h" | 20 #include "remoting/host/video_frame_capturer.h" |
| 21 #include "remoting/proto/control.pb.h" | 21 #include "remoting/proto/control.pb.h" |
| 22 #include "remoting/proto/event.pb.h" | 22 #include "remoting/proto/event.pb.h" |
| 23 #include "remoting/protocol/client_stub.h" | 23 #include "remoting/protocol/client_stub.h" |
| 24 #include "remoting/protocol/clipboard_thread_proxy.h" | 24 #include "remoting/protocol/clipboard_thread_proxy.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 } | 266 } |
| 267 } | 267 } |
| 268 | 268 |
| 269 // TODO(sergeyu): Move this to SessionManager? | 269 // TODO(sergeyu): Move this to SessionManager? |
| 270 // static | 270 // static |
| 271 VideoEncoder* ClientSession::CreateVideoEncoder( | 271 VideoEncoder* ClientSession::CreateVideoEncoder( |
| 272 const protocol::SessionConfig& config) { | 272 const protocol::SessionConfig& config) { |
| 273 const protocol::ChannelConfig& video_config = config.video_config(); | 273 const protocol::ChannelConfig& video_config = config.video_config(); |
| 274 | 274 |
| 275 if (video_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) { | 275 if (video_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) { |
| 276 return VideoEncoderRowBased::CreateVerbatimEncoder(); | 276 return new remoting::VideoEncoderVerbatim(); |
| 277 } else if (video_config.codec == protocol::ChannelConfig::CODEC_ZIP) { | |
| 278 return VideoEncoderRowBased::CreateZlibEncoder(); | |
| 279 } else if (video_config.codec == protocol::ChannelConfig::CODEC_VP8) { | 277 } else if (video_config.codec == protocol::ChannelConfig::CODEC_VP8) { |
| 280 return new remoting::VideoEncoderVp8(); | 278 return new remoting::VideoEncoderVp8(); |
| 281 } | 279 } |
| 282 | 280 |
| 283 NOTIMPLEMENTED(); | 281 NOTIMPLEMENTED(); |
| 284 return NULL; | 282 return NULL; |
| 285 } | 283 } |
| 286 | 284 |
| 287 // static | 285 // static |
| 288 scoped_ptr<AudioEncoder> ClientSession::CreateAudioEncoder( | 286 scoped_ptr<AudioEncoder> ClientSession::CreateAudioEncoder( |
| 289 const protocol::SessionConfig& config) { | 287 const protocol::SessionConfig& config) { |
| 290 const protocol::ChannelConfig& audio_config = config.audio_config(); | 288 const protocol::ChannelConfig& audio_config = config.audio_config(); |
| 291 | 289 |
| 292 if (audio_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) { | 290 if (audio_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) { |
| 293 return scoped_ptr<AudioEncoder>(new AudioEncoderVerbatim()); | 291 return scoped_ptr<AudioEncoder>(new AudioEncoderVerbatim()); |
| 294 } else if (audio_config.codec == protocol::ChannelConfig::CODEC_SPEEX) { | 292 } else if (audio_config.codec == protocol::ChannelConfig::CODEC_SPEEX) { |
| 295 return scoped_ptr<AudioEncoder>(new AudioEncoderSpeex()); | 293 return scoped_ptr<AudioEncoder>(new AudioEncoderSpeex()); |
| 296 } | 294 } |
| 297 | 295 |
| 298 NOTIMPLEMENTED(); | 296 NOTIMPLEMENTED(); |
| 299 return scoped_ptr<AudioEncoder>(NULL); | 297 return scoped_ptr<AudioEncoder>(NULL); |
| 300 } | 298 } |
| 301 | 299 |
| 302 // static | 300 // static |
| 303 void ClientSessionTraits::Destruct(const ClientSession* client) { | 301 void ClientSessionTraits::Destruct(const ClientSession* client) { |
| 304 client->network_task_runner_->DeleteSoon(FROM_HERE, client); | 302 client->network_task_runner_->DeleteSoon(FROM_HERE, client); |
| 305 } | 303 } |
| 306 | 304 |
| 307 } // namespace remoting | 305 } // namespace remoting |
| OLD | NEW |