| 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 #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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 | 13 |
| 14 namespace remoting { | 14 namespace remoting { |
| 15 namespace protocol { | 15 namespace protocol { |
| 16 | 16 |
| 17 extern const int kDefaultStreamVersion; | 17 extern const int kDefaultStreamVersion; |
| 18 | 18 |
| 19 // Struct for configuration parameters of a single channel. | 19 // Struct for configuration parameters of a single channel. |
| 20 // Some channels (like video) may have multiple underlying sockets that need | 20 // Some channels (like video) may have multiple underlying sockets that need |
| 21 // to be configured simultaneously. | 21 // to be configured simultaneously. |
| 22 struct ChannelConfig { | 22 struct ChannelConfig { |
| 23 enum TransportType { | 23 enum TransportType { |
| 24 TRANSPORT_STREAM, | 24 TRANSPORT_STREAM, |
| 25 TRANSPORT_MUX_STREAM, | 25 TRANSPORT_MUX_STREAM, |
| 26 TRANSPORT_QUIC_STREAM, |
| 26 TRANSPORT_DATAGRAM, | 27 TRANSPORT_DATAGRAM, |
| 27 TRANSPORT_NONE, | 28 TRANSPORT_NONE, |
| 28 }; | 29 }; |
| 29 | 30 |
| 30 enum Codec { | 31 enum Codec { |
| 31 CODEC_UNDEFINED, // Used for event and control channels. | 32 CODEC_UNDEFINED, // Used for event and control channels. |
| 32 CODEC_VERBATIM, | 33 CODEC_VERBATIM, |
| 33 CODEC_ZIP, | 34 CODEC_ZIP, |
| 34 CODEC_VP8, | 35 CODEC_VP8, |
| 35 CODEC_VP9, | 36 CODEC_VP9, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 86 |
| 86 const ChannelConfig& control_config() const { return control_config_; } | 87 const ChannelConfig& control_config() const { return control_config_; } |
| 87 const ChannelConfig& event_config() const { return event_config_; } | 88 const ChannelConfig& event_config() const { return event_config_; } |
| 88 const ChannelConfig& video_config() const { return video_config_; } | 89 const ChannelConfig& video_config() const { return video_config_; } |
| 89 const ChannelConfig& audio_config() const { return audio_config_; } | 90 const ChannelConfig& audio_config() const { return audio_config_; } |
| 90 | 91 |
| 91 bool is_audio_enabled() const { | 92 bool is_audio_enabled() const { |
| 92 return audio_config_.transport != ChannelConfig::TRANSPORT_NONE; | 93 return audio_config_.transport != ChannelConfig::TRANSPORT_NONE; |
| 93 } | 94 } |
| 94 | 95 |
| 96 // Returns true if any of the channels is using QUIC. |
| 97 bool is_using_quic() const { |
| 98 return control_config_.transport == ChannelConfig::TRANSPORT_QUIC_STREAM || |
| 99 event_config_.transport == ChannelConfig::TRANSPORT_QUIC_STREAM || |
| 100 video_config_.transport == ChannelConfig::TRANSPORT_QUIC_STREAM || |
| 101 audio_config_.transport == ChannelConfig::TRANSPORT_QUIC_STREAM; |
| 102 } |
| 103 |
| 95 private: | 104 private: |
| 96 SessionConfig(); | 105 SessionConfig(); |
| 97 | 106 |
| 98 bool standard_ice_ = true; | 107 bool standard_ice_ = true; |
| 99 | 108 |
| 100 ChannelConfig control_config_; | 109 ChannelConfig control_config_; |
| 101 ChannelConfig event_config_; | 110 ChannelConfig event_config_; |
| 102 ChannelConfig video_config_; | 111 ChannelConfig video_config_; |
| 103 ChannelConfig audio_config_; | 112 ChannelConfig audio_config_; |
| 104 }; | 113 }; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 vp9_experiment_enabled_ = value; | 171 vp9_experiment_enabled_ = value; |
| 163 } | 172 } |
| 164 | 173 |
| 165 // Returns true if |config| is supported. | 174 // Returns true if |config| is supported. |
| 166 bool IsSupported(const SessionConfig& config) const; | 175 bool IsSupported(const SessionConfig& config) const; |
| 167 | 176 |
| 168 scoped_ptr<CandidateSessionConfig> Clone() const; | 177 scoped_ptr<CandidateSessionConfig> Clone() const; |
| 169 | 178 |
| 170 // Helpers for enabling/disabling specific features. | 179 // Helpers for enabling/disabling specific features. |
| 171 void DisableAudioChannel(); | 180 void DisableAudioChannel(); |
| 181 void PreferTransport(ChannelConfig::TransportType transport); |
| 172 | 182 |
| 173 private: | 183 private: |
| 174 CandidateSessionConfig(); | 184 CandidateSessionConfig(); |
| 175 explicit CandidateSessionConfig(const CandidateSessionConfig& config); | 185 explicit CandidateSessionConfig(const CandidateSessionConfig& config); |
| 176 CandidateSessionConfig& operator=(const CandidateSessionConfig& b); | 186 CandidateSessionConfig& operator=(const CandidateSessionConfig& b); |
| 177 | 187 |
| 178 bool standard_ice_ = true; | 188 bool standard_ice_ = true; |
| 179 | 189 |
| 180 std::list<ChannelConfig> control_configs_; | 190 std::list<ChannelConfig> control_configs_; |
| 181 std::list<ChannelConfig> event_configs_; | 191 std::list<ChannelConfig> event_configs_; |
| 182 std::list<ChannelConfig> video_configs_; | 192 std::list<ChannelConfig> video_configs_; |
| 183 std::list<ChannelConfig> audio_configs_; | 193 std::list<ChannelConfig> audio_configs_; |
| 184 | 194 |
| 185 bool vp9_experiment_enabled_ = false; | 195 bool vp9_experiment_enabled_ = false; |
| 186 }; | 196 }; |
| 187 | 197 |
| 188 } // namespace protocol | 198 } // namespace protocol |
| 189 } // namespace remoting | 199 } // namespace remoting |
| 190 | 200 |
| 191 #endif // REMOTING_PROTOCOL_SESSION_CONFIG_H_ | 201 #endif // REMOTING_PROTOCOL_SESSION_CONFIG_H_ |
| OLD | NEW |