| 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 | 8 |
| 9 namespace remoting { | 9 namespace remoting { |
| 10 namespace protocol { | 10 namespace protocol { |
| 11 | 11 |
| 12 const int kDefaultStreamVersion = 2; | 12 const int kEventStreamVersion = 2; |
| 13 const int kAudioStreamVersion = 2; |
| 13 const int kControlStreamVersion = 3; | 14 const int kControlStreamVersion = 3; |
| 15 const int kVideoStreamVersion = 3; |
| 16 const int kVideoStreamVersionNoAck = 2; |
| 14 | 17 |
| 15 ChannelConfig ChannelConfig::None() { | 18 ChannelConfig ChannelConfig::None() { |
| 16 return ChannelConfig(); | 19 return ChannelConfig(); |
| 17 } | 20 } |
| 18 | 21 |
| 19 ChannelConfig::ChannelConfig() | 22 ChannelConfig::ChannelConfig() |
| 20 : transport(TRANSPORT_NONE), | 23 : transport(TRANSPORT_NONE), |
| 21 version(0), | 24 version(0), |
| 22 codec(CODEC_UNDEFINED) { | 25 codec(CODEC_UNDEFINED) { |
| 23 } | 26 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 38 SessionConfig::SessionConfig() { | 41 SessionConfig::SessionConfig() { |
| 39 } | 42 } |
| 40 | 43 |
| 41 // static | 44 // static |
| 42 SessionConfig SessionConfig::ForTest() { | 45 SessionConfig SessionConfig::ForTest() { |
| 43 SessionConfig result; | 46 SessionConfig result; |
| 44 result.set_control_config(ChannelConfig(ChannelConfig::TRANSPORT_MUX_STREAM, | 47 result.set_control_config(ChannelConfig(ChannelConfig::TRANSPORT_MUX_STREAM, |
| 45 kControlStreamVersion, | 48 kControlStreamVersion, |
| 46 ChannelConfig::CODEC_UNDEFINED)); | 49 ChannelConfig::CODEC_UNDEFINED)); |
| 47 result.set_event_config(ChannelConfig(ChannelConfig::TRANSPORT_MUX_STREAM, | 50 result.set_event_config(ChannelConfig(ChannelConfig::TRANSPORT_MUX_STREAM, |
| 48 kDefaultStreamVersion, | 51 kEventStreamVersion, |
| 49 ChannelConfig::CODEC_UNDEFINED)); | 52 ChannelConfig::CODEC_UNDEFINED)); |
| 50 result.set_video_config(ChannelConfig(ChannelConfig::TRANSPORT_STREAM, | 53 result.set_video_config(ChannelConfig(ChannelConfig::TRANSPORT_STREAM, |
| 51 kDefaultStreamVersion, | 54 kVideoStreamVersion, |
| 52 ChannelConfig::CODEC_VP8)); | 55 ChannelConfig::CODEC_VP8)); |
| 53 result.set_audio_config(ChannelConfig(ChannelConfig::TRANSPORT_NONE, | 56 result.set_audio_config(ChannelConfig(ChannelConfig::TRANSPORT_NONE, |
| 54 kDefaultStreamVersion, | 57 kAudioStreamVersion, |
| 55 ChannelConfig::CODEC_UNDEFINED)); | 58 ChannelConfig::CODEC_UNDEFINED)); |
| 56 return result; | 59 return result; |
| 57 } | 60 } |
| 58 | 61 |
| 59 CandidateSessionConfig::CandidateSessionConfig() { } | 62 CandidateSessionConfig::CandidateSessionConfig() { } |
| 60 | 63 |
| 61 CandidateSessionConfig::CandidateSessionConfig( | 64 CandidateSessionConfig::CandidateSessionConfig( |
| 62 const CandidateSessionConfig& config) | 65 const CandidateSessionConfig& config) |
| 63 : control_configs_(config.control_configs_), | 66 : control_configs_(config.control_configs_), |
| 64 event_configs_(config.event_configs_), | 67 event_configs_(config.event_configs_), |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 173 |
| 171 // Control channel. | 174 // Control channel. |
| 172 result->mutable_control_configs()->push_back( | 175 result->mutable_control_configs()->push_back( |
| 173 ChannelConfig(ChannelConfig::TRANSPORT_MUX_STREAM, | 176 ChannelConfig(ChannelConfig::TRANSPORT_MUX_STREAM, |
| 174 kControlStreamVersion, | 177 kControlStreamVersion, |
| 175 ChannelConfig::CODEC_UNDEFINED)); | 178 ChannelConfig::CODEC_UNDEFINED)); |
| 176 | 179 |
| 177 // Event channel. | 180 // Event channel. |
| 178 result->mutable_event_configs()->push_back( | 181 result->mutable_event_configs()->push_back( |
| 179 ChannelConfig(ChannelConfig::TRANSPORT_MUX_STREAM, | 182 ChannelConfig(ChannelConfig::TRANSPORT_MUX_STREAM, |
| 180 kDefaultStreamVersion, | 183 kEventStreamVersion, |
| 181 ChannelConfig::CODEC_UNDEFINED)); | 184 ChannelConfig::CODEC_UNDEFINED)); |
| 182 | 185 |
| 183 // Video channel. | 186 // Video channel. |
| 184 result->mutable_video_configs()->push_back( | 187 result->mutable_video_configs()->push_back( |
| 185 ChannelConfig(ChannelConfig::TRANSPORT_STREAM, | 188 ChannelConfig(ChannelConfig::TRANSPORT_STREAM, kVideoStreamVersion, |
| 186 kDefaultStreamVersion, | 189 ChannelConfig::CODEC_VP8)); |
| 190 result->mutable_video_configs()->push_back( |
| 191 ChannelConfig(ChannelConfig::TRANSPORT_STREAM, kVideoStreamVersionNoAck, |
| 187 ChannelConfig::CODEC_VP8)); | 192 ChannelConfig::CODEC_VP8)); |
| 188 | 193 |
| 189 // Audio channel. | 194 // Audio channel. |
| 190 result->mutable_audio_configs()->push_back( | 195 result->mutable_audio_configs()->push_back( |
| 191 ChannelConfig(ChannelConfig::TRANSPORT_MUX_STREAM, | 196 ChannelConfig(ChannelConfig::TRANSPORT_MUX_STREAM, |
| 192 kDefaultStreamVersion, | 197 kAudioStreamVersion, |
| 193 ChannelConfig::CODEC_OPUS)); | 198 ChannelConfig::CODEC_OPUS)); |
| 194 result->mutable_audio_configs()->push_back(ChannelConfig::None()); | 199 result->mutable_audio_configs()->push_back(ChannelConfig::None()); |
| 195 | 200 |
| 196 return result.Pass(); | 201 return result.Pass(); |
| 197 } | 202 } |
| 198 | 203 |
| 199 void CandidateSessionConfig::DisableAudioChannel() { | 204 void CandidateSessionConfig::DisableAudioChannel() { |
| 200 mutable_audio_configs()->clear(); | 205 mutable_audio_configs()->clear(); |
| 201 mutable_audio_configs()->push_back(ChannelConfig()); | 206 mutable_audio_configs()->push_back(ChannelConfig()); |
| 202 } | 207 } |
| 203 | 208 |
| 204 void CandidateSessionConfig::EnableVideoCodec(ChannelConfig::Codec codec) { | 209 void CandidateSessionConfig::EnableVideoCodec(ChannelConfig::Codec codec) { |
| 205 mutable_video_configs()->push_front( | 210 mutable_video_configs()->push_front(ChannelConfig( |
| 206 ChannelConfig(ChannelConfig::TRANSPORT_STREAM, | 211 ChannelConfig::TRANSPORT_STREAM, kVideoStreamVersion, codec)); |
| 207 kDefaultStreamVersion, | 212 mutable_video_configs()->push_front(ChannelConfig( |
| 208 codec)); | 213 ChannelConfig::TRANSPORT_STREAM, kVideoStreamVersionNoAck, codec)); |
| 209 } | 214 } |
| 210 | 215 |
| 211 } // namespace protocol | 216 } // namespace protocol |
| 212 } // namespace remoting | 217 } // namespace remoting |
| OLD | NEW |