| 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/protocol/session_config.h" | 5 #include "remoting/protocol/session_config.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 ChannelConfig::CODEC_UNDEFINED); | 154 ChannelConfig::CODEC_UNDEFINED); |
| 155 result->event_config_ = ChannelConfig(ChannelConfig::TRANSPORT_MUX_STREAM, | 155 result->event_config_ = ChannelConfig(ChannelConfig::TRANSPORT_MUX_STREAM, |
| 156 kDefaultStreamVersion, | 156 kDefaultStreamVersion, |
| 157 ChannelConfig::CODEC_UNDEFINED); | 157 ChannelConfig::CODEC_UNDEFINED); |
| 158 result->video_config_ = ChannelConfig(ChannelConfig::TRANSPORT_STREAM, | 158 result->video_config_ = ChannelConfig(ChannelConfig::TRANSPORT_STREAM, |
| 159 kDefaultStreamVersion, | 159 kDefaultStreamVersion, |
| 160 ChannelConfig::CODEC_VP8); | 160 ChannelConfig::CODEC_VP8); |
| 161 result->audio_config_ = ChannelConfig(ChannelConfig::TRANSPORT_NONE, | 161 result->audio_config_ = ChannelConfig(ChannelConfig::TRANSPORT_NONE, |
| 162 kDefaultStreamVersion, | 162 kDefaultStreamVersion, |
| 163 ChannelConfig::CODEC_UNDEFINED); | 163 ChannelConfig::CODEC_UNDEFINED); |
| 164 return result.Pass(); | 164 return result; |
| 165 } | 165 } |
| 166 | 166 |
| 167 scoped_ptr<SessionConfig> SessionConfig::ForTestWithVerbatimVideo() { | 167 scoped_ptr<SessionConfig> SessionConfig::ForTestWithVerbatimVideo() { |
| 168 scoped_ptr<SessionConfig> result = ForTest(); | 168 scoped_ptr<SessionConfig> result = ForTest(); |
| 169 result->video_config_ = ChannelConfig(ChannelConfig::TRANSPORT_STREAM, | 169 result->video_config_ = ChannelConfig(ChannelConfig::TRANSPORT_STREAM, |
| 170 kDefaultStreamVersion, | 170 kDefaultStreamVersion, |
| 171 ChannelConfig::CODEC_VERBATIM); | 171 ChannelConfig::CODEC_VERBATIM); |
| 172 return result.Pass(); | 172 return result; |
| 173 } | 173 } |
| 174 | 174 |
| 175 scoped_ptr<SessionConfig> SessionConfig::ForTestWithWebrtc() { | 175 scoped_ptr<SessionConfig> SessionConfig::ForTestWithWebrtc() { |
| 176 return make_scoped_ptr(new SessionConfig(Protocol::WEBRTC)); | 176 return make_scoped_ptr(new SessionConfig(Protocol::WEBRTC)); |
| 177 } | 177 } |
| 178 | 178 |
| 179 const ChannelConfig& SessionConfig::control_config() const { | 179 const ChannelConfig& SessionConfig::control_config() const { |
| 180 DCHECK(protocol_ == Protocol::ICE); | 180 DCHECK(protocol_ == Protocol::ICE); |
| 181 return control_config_; | 181 return control_config_; |
| 182 } | 182 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 case SessionConfig::Protocol::ICE: | 241 case SessionConfig::Protocol::ICE: |
| 242 result->set_webrtc_supported(false); | 242 result->set_webrtc_supported(false); |
| 243 result->set_ice_supported(true); | 243 result->set_ice_supported(true); |
| 244 result->mutable_control_configs()->push_back(config.control_config()); | 244 result->mutable_control_configs()->push_back(config.control_config()); |
| 245 result->mutable_event_configs()->push_back(config.event_config()); | 245 result->mutable_event_configs()->push_back(config.event_config()); |
| 246 result->mutable_video_configs()->push_back(config.video_config()); | 246 result->mutable_video_configs()->push_back(config.video_config()); |
| 247 result->mutable_audio_configs()->push_back(config.audio_config()); | 247 result->mutable_audio_configs()->push_back(config.audio_config()); |
| 248 break; | 248 break; |
| 249 } | 249 } |
| 250 | 250 |
| 251 return result.Pass(); | 251 return result; |
| 252 } | 252 } |
| 253 | 253 |
| 254 // static | 254 // static |
| 255 scoped_ptr<CandidateSessionConfig> CandidateSessionConfig::CreateDefault() { | 255 scoped_ptr<CandidateSessionConfig> CandidateSessionConfig::CreateDefault() { |
| 256 scoped_ptr<CandidateSessionConfig> result = CreateEmpty(); | 256 scoped_ptr<CandidateSessionConfig> result = CreateEmpty(); |
| 257 | 257 |
| 258 result->set_ice_supported(true); | 258 result->set_ice_supported(true); |
| 259 | 259 |
| 260 // Control channel. | 260 // Control channel. |
| 261 result->mutable_control_configs()->push_back( | 261 result->mutable_control_configs()->push_back( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 279 kDefaultStreamVersion, | 279 kDefaultStreamVersion, |
| 280 ChannelConfig::CODEC_VP8)); | 280 ChannelConfig::CODEC_VP8)); |
| 281 | 281 |
| 282 // Audio channel. | 282 // Audio channel. |
| 283 result->mutable_audio_configs()->push_back( | 283 result->mutable_audio_configs()->push_back( |
| 284 ChannelConfig(ChannelConfig::TRANSPORT_MUX_STREAM, | 284 ChannelConfig(ChannelConfig::TRANSPORT_MUX_STREAM, |
| 285 kDefaultStreamVersion, | 285 kDefaultStreamVersion, |
| 286 ChannelConfig::CODEC_OPUS)); | 286 ChannelConfig::CODEC_OPUS)); |
| 287 result->mutable_audio_configs()->push_back(ChannelConfig::None()); | 287 result->mutable_audio_configs()->push_back(ChannelConfig::None()); |
| 288 | 288 |
| 289 return result.Pass(); | 289 return result; |
| 290 } | 290 } |
| 291 | 291 |
| 292 void CandidateSessionConfig::DisableAudioChannel() { | 292 void CandidateSessionConfig::DisableAudioChannel() { |
| 293 mutable_audio_configs()->clear(); | 293 mutable_audio_configs()->clear(); |
| 294 mutable_audio_configs()->push_back(ChannelConfig()); | 294 mutable_audio_configs()->push_back(ChannelConfig()); |
| 295 } | 295 } |
| 296 | 296 |
| 297 void CandidateSessionConfig::PreferTransport( | 297 void CandidateSessionConfig::PreferTransport( |
| 298 ChannelConfig::TransportType transport) { | 298 ChannelConfig::TransportType transport) { |
| 299 UpdateConfigListToPreferTransport(&control_configs_, transport); | 299 UpdateConfigListToPreferTransport(&control_configs_, transport); |
| 300 UpdateConfigListToPreferTransport(&event_configs_, transport); | 300 UpdateConfigListToPreferTransport(&event_configs_, transport); |
| 301 UpdateConfigListToPreferTransport(&video_configs_, transport); | 301 UpdateConfigListToPreferTransport(&video_configs_, transport); |
| 302 UpdateConfigListToPreferTransport(&audio_configs_, transport); | 302 UpdateConfigListToPreferTransport(&audio_configs_, transport); |
| 303 } | 303 } |
| 304 | 304 |
| 305 } // namespace protocol | 305 } // namespace protocol |
| 306 } // namespace remoting | 306 } // namespace remoting |
| OLD | NEW |