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

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

Issue 1099203005: Revert of Use standard ICE in Chromoting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « remoting/protocol/session.h ('k') | remoting/protocol/session_config.cc » ('j') | 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 #ifndef REMOTING_PROTOCOL_SESSION_CONFIG_H_ 5 #ifndef REMOTING_PROTOCOL_SESSION_CONFIG_H_
6 #define REMOTING_PROTOCOL_SESSION_CONFIG_H_ 6 #define REMOTING_PROTOCOL_SESSION_CONFIG_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 10
(...skipping 24 matching lines...) Expand all
35 CODEC_VP9, 35 CODEC_VP9,
36 CODEC_OPUS, 36 CODEC_OPUS,
37 CODEC_SPEEX, 37 CODEC_SPEEX,
38 }; 38 };
39 39
40 // Creates a config with transport field set to TRANSPORT_NONE which indicates 40 // Creates a config with transport field set to TRANSPORT_NONE which indicates
41 // that corresponding channel is disabled. 41 // that corresponding channel is disabled.
42 static ChannelConfig None(); 42 static ChannelConfig None();
43 43
44 // Default constructor. Equivalent to None(). 44 // Default constructor. Equivalent to None().
45 ChannelConfig() = default; 45 ChannelConfig();
46 46
47 // Creates a channel config with the specified parameters. 47 // Creates a channel config with the specified parameters.
48 ChannelConfig(TransportType transport, int version, Codec codec); 48 ChannelConfig(TransportType transport, int version, Codec codec);
49 49
50 // operator== is overloaded so that std::find() works with 50 // operator== is overloaded so that std::find() works with
51 // std::list<ChannelConfig>. 51 // std::list<ChannelConfig>.
52 bool operator==(const ChannelConfig& b) const; 52 bool operator==(const ChannelConfig& b) const;
53 53
54 TransportType transport = TRANSPORT_NONE; 54 TransportType transport;
55 int version = 0; 55 int version;
56 Codec codec = CODEC_UNDEFINED; 56 Codec codec;
57 }; 57 };
58 58
59 class CandidateSessionConfig;
60
61 // SessionConfig is used by the chromoting Session to store negotiated 59 // SessionConfig is used by the chromoting Session to store negotiated
62 // chromotocol configuration. 60 // chromotocol configuration.
63 class SessionConfig { 61 class SessionConfig {
64 public: 62 public:
65 // Selects session configuration that is supported by both participants. 63 SessionConfig();
66 // nullptr is returned if such configuration doesn't exist. When selecting
67 // channel configuration priority is given to the configs listed first
68 // in |client_config|.
69 static scoped_ptr<SessionConfig> SelectCommon(
70 const CandidateSessionConfig* client_config,
71 const CandidateSessionConfig* host_config);
72 64
73 // Extracts final protocol configuration. Must be used for the description 65 void set_control_config(const ChannelConfig& control_config) {
74 // received in the session-accept stanza. If the selection is ambiguous 66 control_config_ = control_config;
75 // (e.g. there is more than one configuration for one of the channel) 67 }
76 // or undefined (e.g. no configurations for a channel) then nullptr is
77 // returned.
78 static scoped_ptr<SessionConfig> GetFinalConfig(
79 const CandidateSessionConfig* candidate_config);
80
81 // Returns a suitable session configuration for use in tests.
82 static scoped_ptr<SessionConfig> ForTest();
83 static scoped_ptr<SessionConfig> WithLegacyIceForTest();
84
85 bool standard_ice() const { return standard_ice_; }
86
87 const ChannelConfig& control_config() const { return control_config_; } 68 const ChannelConfig& control_config() const { return control_config_; }
69 void set_event_config(const ChannelConfig& event_config) {
70 event_config_ = event_config;
71 }
88 const ChannelConfig& event_config() const { return event_config_; } 72 const ChannelConfig& event_config() const { return event_config_; }
73 void set_video_config(const ChannelConfig& video_config) {
74 video_config_ = video_config;
75 }
89 const ChannelConfig& video_config() const { return video_config_; } 76 const ChannelConfig& video_config() const { return video_config_; }
77 void set_audio_config(const ChannelConfig& audio_config) {
78 audio_config_ = audio_config;
79 }
90 const ChannelConfig& audio_config() const { return audio_config_; } 80 const ChannelConfig& audio_config() const { return audio_config_; }
91 81
92 bool is_audio_enabled() const { 82 bool is_audio_enabled() const {
93 return audio_config_.transport != ChannelConfig::TRANSPORT_NONE; 83 return audio_config_.transport != ChannelConfig::TRANSPORT_NONE;
94 } 84 }
95 85
86 // Returns a suitable session configuration for use in tests.
87 static SessionConfig ForTest();
88
96 private: 89 private:
97 SessionConfig();
98
99 bool standard_ice_ = true;
100
101 ChannelConfig control_config_; 90 ChannelConfig control_config_;
102 ChannelConfig event_config_; 91 ChannelConfig event_config_;
103 ChannelConfig video_config_; 92 ChannelConfig video_config_;
104 ChannelConfig audio_config_; 93 ChannelConfig audio_config_;
105 }; 94 };
106 95
107 // Defines session description that is sent from client to the host in the 96 // Defines session description that is sent from client to the host in the
108 // session-initiate message. It is different from the regular Config 97 // session-initiate message. It is different from the regular Config
109 // because it allows one to specify multiple configurations for each channel. 98 // because it allows one to specify multiple configurations for each channel.
110 class CandidateSessionConfig { 99 class CandidateSessionConfig {
111 public: 100 public:
112 static scoped_ptr<CandidateSessionConfig> CreateEmpty(); 101 static scoped_ptr<CandidateSessionConfig> CreateEmpty();
113 static scoped_ptr<CandidateSessionConfig> CreateFrom( 102 static scoped_ptr<CandidateSessionConfig> CreateFrom(
114 const SessionConfig& config); 103 const SessionConfig& config);
115 static scoped_ptr<CandidateSessionConfig> CreateDefault(); 104 static scoped_ptr<CandidateSessionConfig> CreateDefault();
116 105
117 ~CandidateSessionConfig(); 106 ~CandidateSessionConfig();
118 107
119 bool standard_ice() const { return standard_ice_; }
120 void set_standard_ice(bool standard_ice) { standard_ice_ = standard_ice; }
121
122 const std::list<ChannelConfig>& control_configs() const { 108 const std::list<ChannelConfig>& control_configs() const {
123 return control_configs_; 109 return control_configs_;
124 } 110 }
125 111
126 std::list<ChannelConfig>* mutable_control_configs() { 112 std::list<ChannelConfig>* mutable_control_configs() {
127 return &control_configs_; 113 return &control_configs_;
128 } 114 }
129 115
130 const std::list<ChannelConfig>& event_configs() const { 116 const std::list<ChannelConfig>& event_configs() const {
131 return event_configs_; 117 return event_configs_;
(...skipping 12 matching lines...) Expand all
144 } 130 }
145 131
146 const std::list<ChannelConfig>& audio_configs() const { 132 const std::list<ChannelConfig>& audio_configs() const {
147 return audio_configs_; 133 return audio_configs_;
148 } 134 }
149 135
150 std::list<ChannelConfig>* mutable_audio_configs() { 136 std::list<ChannelConfig>* mutable_audio_configs() {
151 return &audio_configs_; 137 return &audio_configs_;
152 } 138 }
153 139
140 // Selects session configuration that is supported by both participants.
141 // nullptr is returned if such configuration doesn't exist. When selecting
142 // channel configuration priority is given to the configs listed first
143 // in |client_config|.
144 bool Select(const CandidateSessionConfig* client_config,
145 SessionConfig* result);
146
154 // Returns true if |config| is supported. 147 // Returns true if |config| is supported.
155 bool IsSupported(const SessionConfig& config) const; 148 bool IsSupported(const SessionConfig& config) const;
156 149
150 // Extracts final protocol configuration. Must be used for the description
151 // received in the session-accept stanza. If the selection is ambiguous
152 // (e.g. there is more than one configuration for one of the channel)
153 // or undefined (e.g. no configurations for a channel) then nullptr is
154 // returned.
155 bool GetFinalConfig(SessionConfig* result) const;
156
157 scoped_ptr<CandidateSessionConfig> Clone() const; 157 scoped_ptr<CandidateSessionConfig> Clone() const;
158 158
159 // Helpers for enabling/disabling specific features. 159 // Helpers for enabling/disabling specific features.
160 void DisableAudioChannel(); 160 void DisableAudioChannel();
161 void EnableVideoCodec(ChannelConfig::Codec codec); 161 void EnableVideoCodec(ChannelConfig::Codec codec);
162 162
163 private: 163 private:
164 CandidateSessionConfig(); 164 CandidateSessionConfig();
165 explicit CandidateSessionConfig(const CandidateSessionConfig& config); 165 explicit CandidateSessionConfig(const CandidateSessionConfig& config);
166 CandidateSessionConfig& operator=(const CandidateSessionConfig& b); 166 CandidateSessionConfig& operator=(const CandidateSessionConfig& b);
167 167
168 bool standard_ice_ = true; 168 static bool SelectCommonChannelConfig(
169 const std::list<ChannelConfig>& host_configs_,
170 const std::list<ChannelConfig>& client_configs_,
171 ChannelConfig* config);
172 static bool IsChannelConfigSupported(const std::list<ChannelConfig>& list,
173 const ChannelConfig& value);
169 174
170 std::list<ChannelConfig> control_configs_; 175 std::list<ChannelConfig> control_configs_;
171 std::list<ChannelConfig> event_configs_; 176 std::list<ChannelConfig> event_configs_;
172 std::list<ChannelConfig> video_configs_; 177 std::list<ChannelConfig> video_configs_;
173 std::list<ChannelConfig> audio_configs_; 178 std::list<ChannelConfig> audio_configs_;
174 }; 179 };
175 180
176 } // namespace protocol 181 } // namespace protocol
177 } // namespace remoting 182 } // namespace remoting
178 183
179 #endif // REMOTING_PROTOCOL_SESSION_CONFIG_H_ 184 #endif // REMOTING_PROTOCOL_SESSION_CONFIG_H_
OLDNEW
« no previous file with comments | « remoting/protocol/session.h ('k') | remoting/protocol/session_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698