| 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/message_loop_proxy.h" |    9 #include "base/message_loop/message_loop_proxy.h" | 
|   10 #include "remoting/base/capabilities.h" |   10 #include "remoting/base/capabilities.h" | 
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  126 } |  126 } | 
|  127  |  127  | 
|  128 void ClientSession::ControlVideo(const protocol::VideoControl& video_control) { |  128 void ClientSession::ControlVideo(const protocol::VideoControl& video_control) { | 
|  129   DCHECK(CalledOnValidThread()); |  129   DCHECK(CalledOnValidThread()); | 
|  130  |  130  | 
|  131   if (video_control.has_enable()) { |  131   if (video_control.has_enable()) { | 
|  132     VLOG(1) << "Received VideoControl (enable=" |  132     VLOG(1) << "Received VideoControl (enable=" | 
|  133             << video_control.enable() << ")"; |  133             << video_control.enable() << ")"; | 
|  134     video_scheduler_->Pause(!video_control.enable()); |  134     video_scheduler_->Pause(!video_control.enable()); | 
|  135   } |  135   } | 
 |  136   if (video_control.has_lossless_encode()) { | 
 |  137     VLOG(1) << "Received VideoControl (lossless_encode=" | 
 |  138             << video_control.lossless_encode() << ")"; | 
 |  139     video_scheduler_->SetLosslessEncode(video_control.lossless_encode()); | 
 |  140   } | 
 |  141   if (video_control.has_lossless_color()) { | 
 |  142     VLOG(1) << "Received VideoControl (lossless_color=" | 
 |  143             << video_control.lossless_color() << ")"; | 
 |  144     video_scheduler_->SetLosslessColor(video_control.lossless_color()); | 
 |  145   } | 
|  136 } |  146 } | 
|  137  |  147  | 
|  138 void ClientSession::ControlAudio(const protocol::AudioControl& audio_control) { |  148 void ClientSession::ControlAudio(const protocol::AudioControl& audio_control) { | 
|  139   DCHECK(CalledOnValidThread()); |  149   DCHECK(CalledOnValidThread()); | 
|  140  |  150  | 
|  141   if (audio_control.has_enable()) { |  151   if (audio_control.has_enable()) { | 
|  142     VLOG(1) << "Received AudioControl (enable=" |  152     VLOG(1) << "Received AudioControl (enable=" | 
|  143             << audio_control.enable() << ")"; |  153             << audio_control.enable() << ")"; | 
|  144     if (audio_scheduler_.get()) |  154     if (audio_scheduler_.get()) | 
|  145       audio_scheduler_->Pause(!audio_control.enable()); |  155       audio_scheduler_->Pause(!audio_control.enable()); | 
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  443  |  453  | 
|  444 // TODO(sergeyu): Move this to SessionManager? |  454 // TODO(sergeyu): Move this to SessionManager? | 
|  445 // static |  455 // static | 
|  446 scoped_ptr<VideoEncoder> ClientSession::CreateVideoEncoder( |  456 scoped_ptr<VideoEncoder> ClientSession::CreateVideoEncoder( | 
|  447     const protocol::SessionConfig& config) { |  457     const protocol::SessionConfig& config) { | 
|  448   const protocol::ChannelConfig& video_config = config.video_config(); |  458   const protocol::ChannelConfig& video_config = config.video_config(); | 
|  449  |  459  | 
|  450   if (video_config.codec == protocol::ChannelConfig::CODEC_VP8) { |  460   if (video_config.codec == protocol::ChannelConfig::CODEC_VP8) { | 
|  451     return remoting::VideoEncoderVpx::CreateForVP8().PassAs<VideoEncoder>(); |  461     return remoting::VideoEncoderVpx::CreateForVP8().PassAs<VideoEncoder>(); | 
|  452   } else if (video_config.codec == protocol::ChannelConfig::CODEC_VP9) { |  462   } else if (video_config.codec == protocol::ChannelConfig::CODEC_VP9) { | 
|  453     return remoting::VideoEncoderVpx::CreateForVP9I420().PassAs<VideoEncoder>(); |  463     return remoting::VideoEncoderVpx::CreateForVP9().PassAs<VideoEncoder>(); | 
|  454   } |  464   } | 
|  455  |  465  | 
|  456   NOTREACHED(); |  466   NOTREACHED(); | 
|  457   return scoped_ptr<VideoEncoder>(); |  467   return scoped_ptr<VideoEncoder>(); | 
|  458 } |  468 } | 
|  459  |  469  | 
|  460 // static |  470 // static | 
|  461 scoped_ptr<AudioEncoder> ClientSession::CreateAudioEncoder( |  471 scoped_ptr<AudioEncoder> ClientSession::CreateAudioEncoder( | 
|  462     const protocol::SessionConfig& config) { |  472     const protocol::SessionConfig& config) { | 
|  463   const protocol::ChannelConfig& audio_config = config.audio_config(); |  473   const protocol::ChannelConfig& audio_config = config.audio_config(); | 
|  464  |  474  | 
|  465   if (audio_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) { |  475   if (audio_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) { | 
|  466     return scoped_ptr<AudioEncoder>(new AudioEncoderVerbatim()); |  476     return scoped_ptr<AudioEncoder>(new AudioEncoderVerbatim()); | 
|  467   } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) { |  477   } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) { | 
|  468     return scoped_ptr<AudioEncoder>(new AudioEncoderOpus()); |  478     return scoped_ptr<AudioEncoder>(new AudioEncoderOpus()); | 
|  469   } |  479   } | 
|  470  |  480  | 
|  471   NOTREACHED(); |  481   NOTREACHED(); | 
|  472   return scoped_ptr<AudioEncoder>(); |  482   return scoped_ptr<AudioEncoder>(); | 
|  473 } |  483 } | 
|  474  |  484  | 
|  475 }  // namespace remoting |  485 }  // namespace remoting | 
| OLD | NEW |