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

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

Issue 10532211: Added piping for sending audio packets from host to client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed unittests Created 8 years, 5 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/jingle_messages_unittest.cc ('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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
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_DATAGRAM, 25 TRANSPORT_DATAGRAM,
26 TRANSPORT_NONE,
26 }; 27 };
27 28
28 enum Codec { 29 enum Codec {
29 CODEC_UNDEFINED, // Used for event and control channels. 30 CODEC_UNDEFINED, // Used for event and control channels.
30 CODEC_VERBATIM, 31 CODEC_VERBATIM,
31 CODEC_ZIP, 32 CODEC_ZIP,
32 CODEC_VP8, 33 CODEC_VP8,
34 CODEC_VORBIS,
33 }; 35 };
34 36
35 ChannelConfig(); 37 ChannelConfig();
36 ChannelConfig(TransportType transport, int version, Codec codec); 38 ChannelConfig(TransportType transport, int version, Codec codec);
37 39
38 // operator== is overloaded so that std::find() works with 40 // operator== is overloaded so that std::find() works with
39 // std::vector<ChannelConfig>. 41 // std::vector<ChannelConfig>.
40 bool operator==(const ChannelConfig& b) const; 42 bool operator==(const ChannelConfig& b) const;
41 43
42 void Reset(); 44 void Reset();
43 45
44 TransportType transport; 46 TransportType transport;
45 int version; 47 int version;
46 Codec codec; 48 Codec codec;
47 }; 49 };
48 50
49 // SessionConfig is used by the chromoting Session to store negotiated 51 // SessionConfig is used by the chromoting Session to store negotiated
50 // chromotocol configuration. 52 // chromotocol configuration.
51 class SessionConfig { 53 class SessionConfig {
52 public: 54 public:
55 SessionConfig();
56
53 void set_control_config(const ChannelConfig& control_config) { 57 void set_control_config(const ChannelConfig& control_config) {
54 control_config_ = control_config; 58 control_config_ = control_config;
55 } 59 }
56 const ChannelConfig& control_config() const { return control_config_; } 60 const ChannelConfig& control_config() const { return control_config_; }
57 void set_event_config(const ChannelConfig& event_config) { 61 void set_event_config(const ChannelConfig& event_config) {
58 event_config_ = event_config; 62 event_config_ = event_config;
59 } 63 }
60 const ChannelConfig& event_config() const { return event_config_; } 64 const ChannelConfig& event_config() const { return event_config_; }
61 void set_video_config(const ChannelConfig& video_config) { 65 void set_video_config(const ChannelConfig& video_config) {
62 video_config_ = video_config; 66 video_config_ = video_config;
63 } 67 }
64 const ChannelConfig& video_config() const { return video_config_; } 68 const ChannelConfig& video_config() const { return video_config_; }
69 void set_audio_config(const ChannelConfig& audio_config) {
70 audio_config_ = audio_config;
71 }
72 const ChannelConfig& audio_config() const { return audio_config_; }
73
74 bool is_audio_enabled() const {
75 return audio_config_.transport != ChannelConfig::TRANSPORT_NONE;
76 }
65 77
66 static SessionConfig GetDefault(); 78 static SessionConfig GetDefault();
67 79
68 private: 80 private:
69 ChannelConfig control_config_; 81 ChannelConfig control_config_;
70 ChannelConfig event_config_; 82 ChannelConfig event_config_;
71 ChannelConfig video_config_; 83 ChannelConfig video_config_;
84 ChannelConfig audio_config_;
72 }; 85 };
73 86
74 // Defines session description that is sent from client to the host in the 87 // Defines session description that is sent from client to the host in the
75 // session-initiate message. It is different from the regular Config 88 // session-initiate message. It is different from the regular Config
76 // because it allows one to specify multiple configurations for each channel. 89 // because it allows one to specify multiple configurations for each channel.
77 class CandidateSessionConfig { 90 class CandidateSessionConfig {
78 public: 91 public:
79 ~CandidateSessionConfig(); 92 ~CandidateSessionConfig();
80 93
81 const std::vector<ChannelConfig>& control_configs() const { 94 const std::vector<ChannelConfig>& control_configs() const {
(...skipping 13 matching lines...) Expand all
95 } 108 }
96 109
97 const std::vector<ChannelConfig>& video_configs() const { 110 const std::vector<ChannelConfig>& video_configs() const {
98 return video_configs_; 111 return video_configs_;
99 } 112 }
100 113
101 std::vector<ChannelConfig>* mutable_video_configs() { 114 std::vector<ChannelConfig>* mutable_video_configs() {
102 return &video_configs_; 115 return &video_configs_;
103 } 116 }
104 117
118 const std::vector<ChannelConfig>& audio_configs() const {
119 return audio_configs_;
120 }
121
122 std::vector<ChannelConfig>* mutable_audio_configs() {
123 return &audio_configs_;
124 }
125
105 // Selects session configuration that is supported by both participants. 126 // Selects session configuration that is supported by both participants.
106 // NULL is returned if such configuration doesn't exist. When selecting 127 // NULL is returned if such configuration doesn't exist. When selecting
107 // channel configuration priority is given to the configs listed first 128 // channel configuration priority is given to the configs listed first
108 // in |client_config|. 129 // in |client_config|.
109 bool Select(const CandidateSessionConfig* client_config, 130 bool Select(const CandidateSessionConfig* client_config,
110 SessionConfig* result); 131 SessionConfig* result);
111 132
112 // Returns true if |config| is supported. 133 // Returns true if |config| is supported.
113 bool IsSupported(const SessionConfig& config) const; 134 bool IsSupported(const SessionConfig& config) const;
114 135
(...skipping 18 matching lines...) Expand all
133 static bool SelectCommonChannelConfig( 154 static bool SelectCommonChannelConfig(
134 const std::vector<ChannelConfig>& host_configs_, 155 const std::vector<ChannelConfig>& host_configs_,
135 const std::vector<ChannelConfig>& client_configs_, 156 const std::vector<ChannelConfig>& client_configs_,
136 ChannelConfig* config); 157 ChannelConfig* config);
137 static bool IsChannelConfigSupported(const std::vector<ChannelConfig>& vector, 158 static bool IsChannelConfigSupported(const std::vector<ChannelConfig>& vector,
138 const ChannelConfig& value); 159 const ChannelConfig& value);
139 160
140 std::vector<ChannelConfig> control_configs_; 161 std::vector<ChannelConfig> control_configs_;
141 std::vector<ChannelConfig> event_configs_; 162 std::vector<ChannelConfig> event_configs_;
142 std::vector<ChannelConfig> video_configs_; 163 std::vector<ChannelConfig> video_configs_;
164 std::vector<ChannelConfig> audio_configs_;
143 }; 165 };
144 166
145 } // namespace protocol 167 } // namespace protocol
146 } // namespace remoting 168 } // namespace remoting
147 169
148 #endif // REMOTING_PROTOCOL_SESSION_CONFIG_H_ 170 #endif // REMOTING_PROTOCOL_SESSION_CONFIG_H_
OLDNEW
« no previous file with comments | « remoting/protocol/jingle_messages_unittest.cc ('k') | remoting/protocol/session_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698