| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 8 |
| 9 namespace remoting { | 9 namespace remoting { |
| 10 namespace protocol { | 10 namespace protocol { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 CandidateSessionConfig::CandidateSessionConfig( | 98 CandidateSessionConfig::CandidateSessionConfig( |
| 99 const CandidateSessionConfig& config) | 99 const CandidateSessionConfig& config) |
| 100 : control_configs_(config.control_configs_), | 100 : control_configs_(config.control_configs_), |
| 101 event_configs_(config.event_configs_), | 101 event_configs_(config.event_configs_), |
| 102 video_configs_(config.video_configs_), | 102 video_configs_(config.video_configs_), |
| 103 initial_resolution_(config.initial_resolution_) { | 103 initial_resolution_(config.initial_resolution_) { |
| 104 } | 104 } |
| 105 | 105 |
| 106 CandidateSessionConfig::~CandidateSessionConfig() { } | 106 CandidateSessionConfig::~CandidateSessionConfig() { } |
| 107 | 107 |
| 108 void CandidateSessionConfig::AddControlConfig( | |
| 109 const ChannelConfig& control_config) { | |
| 110 control_configs_.push_back(control_config); | |
| 111 } | |
| 112 | |
| 113 void CandidateSessionConfig::AddEventConfig( | |
| 114 const ChannelConfig& event_config) { | |
| 115 event_configs_.push_back(event_config); | |
| 116 } | |
| 117 | |
| 118 void CandidateSessionConfig::AddVideoConfig( | |
| 119 const ChannelConfig& video_config) { | |
| 120 video_configs_.push_back(video_config); | |
| 121 } | |
| 122 | |
| 123 void CandidateSessionConfig::SetInitialResolution( | |
| 124 const ScreenResolution& resolution) { | |
| 125 initial_resolution_ = resolution; | |
| 126 } | |
| 127 | |
| 128 SessionConfig* CandidateSessionConfig::Select( | 108 SessionConfig* CandidateSessionConfig::Select( |
| 129 const CandidateSessionConfig* client_config, | 109 const CandidateSessionConfig* client_config, |
| 130 bool force_host_resolution) { | 110 bool force_host_resolution) { |
| 131 ChannelConfig control_config; | 111 ChannelConfig control_config; |
| 132 ChannelConfig event_config; | 112 ChannelConfig event_config; |
| 133 ChannelConfig video_config; | 113 ChannelConfig video_config; |
| 134 if (!SelectCommonChannelConfig( | 114 if (!SelectCommonChannelConfig( |
| 135 control_configs_, client_config->control_configs_, &control_config) || | 115 control_configs_, client_config->control_configs_, &control_config) || |
| 136 !SelectCommonChannelConfig( | 116 !SelectCommonChannelConfig( |
| 137 event_configs_, client_config->event_configs_, &event_config) || | 117 event_configs_, client_config->event_configs_, &event_config) || |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 | 188 |
| 209 // static | 189 // static |
| 210 CandidateSessionConfig* CandidateSessionConfig::CreateEmpty() { | 190 CandidateSessionConfig* CandidateSessionConfig::CreateEmpty() { |
| 211 return new CandidateSessionConfig(); | 191 return new CandidateSessionConfig(); |
| 212 } | 192 } |
| 213 | 193 |
| 214 // static | 194 // static |
| 215 CandidateSessionConfig* CandidateSessionConfig::CreateFrom( | 195 CandidateSessionConfig* CandidateSessionConfig::CreateFrom( |
| 216 const SessionConfig* config) { | 196 const SessionConfig* config) { |
| 217 CandidateSessionConfig* result = CreateEmpty(); | 197 CandidateSessionConfig* result = CreateEmpty(); |
| 218 result->AddControlConfig(config->control_config()); | 198 result->mutable_control_configs()->push_back(config->control_config()); |
| 219 result->AddEventConfig(config->event_config()); | 199 result->mutable_event_configs()->push_back(config->event_config()); |
| 220 result->AddVideoConfig(config->video_config()); | 200 result->mutable_video_configs()->push_back(config->video_config()); |
| 221 result->SetInitialResolution(config->initial_resolution()); | 201 *result->mutable_initial_resolution() = (config->initial_resolution()); |
| 222 return result; | 202 return result; |
| 223 } | 203 } |
| 224 | 204 |
| 225 // static | 205 // static |
| 226 CandidateSessionConfig* CandidateSessionConfig::CreateDefault() { | 206 CandidateSessionConfig* CandidateSessionConfig::CreateDefault() { |
| 227 CandidateSessionConfig* result = CreateEmpty(); | 207 CandidateSessionConfig* result = CreateEmpty(); |
| 228 result->AddControlConfig(ChannelConfig(ChannelConfig::TRANSPORT_STREAM, | 208 result->mutable_control_configs()->push_back( |
| 229 kDefaultStreamVersion, | 209 ChannelConfig(ChannelConfig::TRANSPORT_STREAM, |
| 230 ChannelConfig::CODEC_UNDEFINED)); | 210 kDefaultStreamVersion, |
| 231 result->AddEventConfig(ChannelConfig(ChannelConfig::TRANSPORT_STREAM, | 211 ChannelConfig::CODEC_UNDEFINED)); |
| 232 kDefaultStreamVersion, | 212 result->mutable_event_configs()->push_back( |
| 233 ChannelConfig::CODEC_UNDEFINED)); | 213 ChannelConfig(ChannelConfig::TRANSPORT_STREAM, |
| 214 kDefaultStreamVersion, |
| 215 ChannelConfig::CODEC_UNDEFINED)); |
| 234 | 216 |
| 235 result->AddVideoConfig(ChannelConfig(ChannelConfig::TRANSPORT_STREAM, | 217 result->mutable_video_configs()->push_back( |
| 236 kDefaultStreamVersion, | 218 ChannelConfig(ChannelConfig::TRANSPORT_STREAM, |
| 237 ChannelConfig::CODEC_ZIP)); | 219 kDefaultStreamVersion, |
| 238 result->AddVideoConfig(ChannelConfig(ChannelConfig::TRANSPORT_SRTP, | 220 ChannelConfig::CODEC_VP8)); |
| 239 kDefaultStreamVersion, | 221 result->mutable_video_configs()->push_back( |
| 240 ChannelConfig::CODEC_VP8)); | 222 ChannelConfig(ChannelConfig::TRANSPORT_STREAM, |
| 223 kDefaultStreamVersion, |
| 224 ChannelConfig::CODEC_ZIP)); |
| 225 result->mutable_video_configs()->push_back( |
| 226 ChannelConfig(ChannelConfig::TRANSPORT_SRTP, |
| 227 kDefaultStreamVersion, |
| 228 ChannelConfig::CODEC_VP8)); |
| 241 return result; | 229 return result; |
| 242 } | 230 } |
| 243 | 231 |
| 244 } // namespace protocol | 232 } // namespace protocol |
| 245 } // namespace remoting | 233 } // namespace remoting |
| OLD | NEW |