Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Side by Side Diff: remoting/protocol/session_config.cc

Issue 10834446: Improve handling of NONE transport in channel configuration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/protocol/session_config.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 kDefaultStreamVersion = 2;
13 13
14 ChannelConfig::ChannelConfig() { 14 ChannelConfig::ChannelConfig()
15 Reset(); 15 : transport(TRANSPORT_NONE),
16 version(0),
17 codec(CODEC_UNDEFINED) {
16 } 18 }
17 19
18 ChannelConfig::ChannelConfig(TransportType transport, int version, Codec codec) 20 ChannelConfig::ChannelConfig(TransportType transport, int version, Codec codec)
19 : transport(transport), 21 : transport(transport),
20 version(version), 22 version(version),
21 codec(codec) { 23 codec(codec) {
22 } 24 }
23 25
24 bool ChannelConfig::operator==(const ChannelConfig& b) const { 26 bool ChannelConfig::operator==(const ChannelConfig& b) const {
27 // If the transport field is set to NONE then all other fields are irrelevant.
28 if (transport == ChannelConfig::TRANSPORT_NONE)
29 return transport == b.transport;
25 return transport == b.transport && version == b.version && codec == b.codec; 30 return transport == b.transport && version == b.version && codec == b.codec;
26 } 31 }
27 32
28 void ChannelConfig::Reset() {
29 transport = TRANSPORT_STREAM;
30 version = kDefaultStreamVersion;
31 codec = CODEC_UNDEFINED;
32 }
33
34 SessionConfig::SessionConfig() { 33 SessionConfig::SessionConfig() {
35 } 34 }
36 35
37 // static 36 // static
38 SessionConfig SessionConfig::GetDefault() { 37 SessionConfig SessionConfig::GetDefault() {
39 SessionConfig result; 38 SessionConfig result;
40 result.set_control_config(ChannelConfig(ChannelConfig::TRANSPORT_STREAM, 39 result.set_control_config(ChannelConfig(ChannelConfig::TRANSPORT_STREAM,
41 kDefaultStreamVersion, 40 kDefaultStreamVersion,
42 ChannelConfig::CODEC_UNDEFINED)); 41 ChannelConfig::CODEC_UNDEFINED));
43 result.set_event_config(ChannelConfig(ChannelConfig::TRANSPORT_STREAM, 42 result.set_event_config(ChannelConfig(ChannelConfig::TRANSPORT_STREAM,
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 ChannelConfig::CODEC_VERBATIM)); 197 ChannelConfig::CODEC_VERBATIM));
199 result->mutable_audio_configs()->push_back( 198 result->mutable_audio_configs()->push_back(
200 ChannelConfig(ChannelConfig::TRANSPORT_STREAM, 199 ChannelConfig(ChannelConfig::TRANSPORT_STREAM,
201 kDefaultStreamVersion, 200 kDefaultStreamVersion,
202 ChannelConfig::CODEC_SPEEX)); 201 ChannelConfig::CODEC_SPEEX));
203 result->mutable_audio_configs()->push_back( 202 result->mutable_audio_configs()->push_back(
204 ChannelConfig(ChannelConfig::TRANSPORT_STREAM, 203 ChannelConfig(ChannelConfig::TRANSPORT_STREAM,
205 kDefaultStreamVersion, 204 kDefaultStreamVersion,
206 ChannelConfig::CODEC_VERBATIM)); 205 ChannelConfig::CODEC_VERBATIM));
207 #endif // defined(ENABLE_REMOTING_AUDIO) 206 #endif // defined(ENABLE_REMOTING_AUDIO)
208 result->mutable_audio_configs()->push_back( 207 result->mutable_audio_configs()->push_back(ChannelConfig());
209 ChannelConfig(ChannelConfig::TRANSPORT_NONE,
210 kDefaultStreamVersion,
211 ChannelConfig::CODEC_VERBATIM));
212 return result.Pass(); 208 return result.Pass();
213 } 209 }
214 210
215 } // namespace protocol 211 } // namespace protocol
216 } // namespace remoting 212 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/session_config.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698