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

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: Addressed comments Created 8 years, 6 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
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,
Sergey Ulanov 2012/06/21 18:36:04 add CODEC_VORBIS here for the audio?
kxing 2012/06/21 18:53:28 Done.
33 }; 34 };
34 35
35 ChannelConfig(); 36 ChannelConfig();
36 ChannelConfig(TransportType transport, int version, Codec codec); 37 ChannelConfig(TransportType transport, int version, Codec codec);
37 38
38 // operator== is overloaded so that std::find() works with 39 // operator== is overloaded so that std::find() works with
39 // std::vector<ChannelConfig>. 40 // std::vector<ChannelConfig>.
40 bool operator==(const ChannelConfig& b) const; 41 bool operator==(const ChannelConfig& b) const;
41 42
42 void Reset(); 43 void Reset();
(...skipping 12 matching lines...) Expand all
55 } 56 }
56 const ChannelConfig& control_config() const { return control_config_; } 57 const ChannelConfig& control_config() const { return control_config_; }
57 void set_event_config(const ChannelConfig& event_config) { 58 void set_event_config(const ChannelConfig& event_config) {
58 event_config_ = event_config; 59 event_config_ = event_config;
59 } 60 }
60 const ChannelConfig& event_config() const { return event_config_; } 61 const ChannelConfig& event_config() const { return event_config_; }
61 void set_video_config(const ChannelConfig& video_config) { 62 void set_video_config(const ChannelConfig& video_config) {
62 video_config_ = video_config; 63 video_config_ = video_config;
63 } 64 }
64 const ChannelConfig& video_config() const { return video_config_; } 65 const ChannelConfig& video_config() const { return video_config_; }
66 void set_audio_config(const ChannelConfig& audio_config) {
67 audio_config_ = audio_config;
68 }
69 const ChannelConfig& audio_config() const { return audio_config_; }
65 70
66 static SessionConfig GetDefault(); 71 static SessionConfig GetDefault();
67 72
68 private: 73 private:
69 ChannelConfig control_config_; 74 ChannelConfig control_config_;
70 ChannelConfig event_config_; 75 ChannelConfig event_config_;
71 ChannelConfig video_config_; 76 ChannelConfig video_config_;
77 ChannelConfig audio_config_;
72 }; 78 };
73 79
74 // Defines session description that is sent from client to the host in the 80 // Defines session description that is sent from client to the host in the
75 // session-initiate message. It is different from the regular Config 81 // session-initiate message. It is different from the regular Config
76 // because it allows one to specify multiple configurations for each channel. 82 // because it allows one to specify multiple configurations for each channel.
77 class CandidateSessionConfig { 83 class CandidateSessionConfig {
78 public: 84 public:
79 ~CandidateSessionConfig(); 85 ~CandidateSessionConfig();
80 86
81 const std::vector<ChannelConfig>& control_configs() const { 87 const std::vector<ChannelConfig>& control_configs() const {
(...skipping 13 matching lines...) Expand all
95 } 101 }
96 102
97 const std::vector<ChannelConfig>& video_configs() const { 103 const std::vector<ChannelConfig>& video_configs() const {
98 return video_configs_; 104 return video_configs_;
99 } 105 }
100 106
101 std::vector<ChannelConfig>* mutable_video_configs() { 107 std::vector<ChannelConfig>* mutable_video_configs() {
102 return &video_configs_; 108 return &video_configs_;
103 } 109 }
104 110
111 const std::vector<ChannelConfig>& audio_configs() const {
112 return audio_configs_;
113 }
114
115 std::vector<ChannelConfig>* mutable_audio_configs() {
116 return &audio_configs_;
117 }
118
105 // Selects session configuration that is supported by both participants. 119 // Selects session configuration that is supported by both participants.
106 // NULL is returned if such configuration doesn't exist. When selecting 120 // NULL is returned if such configuration doesn't exist. When selecting
107 // channel configuration priority is given to the configs listed first 121 // channel configuration priority is given to the configs listed first
108 // in |client_config|. 122 // in |client_config|.
109 bool Select(const CandidateSessionConfig* client_config, 123 bool Select(const CandidateSessionConfig* client_config,
110 SessionConfig* result); 124 SessionConfig* result);
111 125
112 // Returns true if |config| is supported. 126 // Returns true if |config| is supported.
113 bool IsSupported(const SessionConfig& config) const; 127 bool IsSupported(const SessionConfig& config) const;
114 128
(...skipping 18 matching lines...) Expand all
133 static bool SelectCommonChannelConfig( 147 static bool SelectCommonChannelConfig(
134 const std::vector<ChannelConfig>& host_configs_, 148 const std::vector<ChannelConfig>& host_configs_,
135 const std::vector<ChannelConfig>& client_configs_, 149 const std::vector<ChannelConfig>& client_configs_,
136 ChannelConfig* config); 150 ChannelConfig* config);
137 static bool IsChannelConfigSupported(const std::vector<ChannelConfig>& vector, 151 static bool IsChannelConfigSupported(const std::vector<ChannelConfig>& vector,
138 const ChannelConfig& value); 152 const ChannelConfig& value);
139 153
140 std::vector<ChannelConfig> control_configs_; 154 std::vector<ChannelConfig> control_configs_;
141 std::vector<ChannelConfig> event_configs_; 155 std::vector<ChannelConfig> event_configs_;
142 std::vector<ChannelConfig> video_configs_; 156 std::vector<ChannelConfig> video_configs_;
157 std::vector<ChannelConfig> audio_configs_;
143 }; 158 };
144 159
145 } // namespace protocol 160 } // namespace protocol
146 } // namespace remoting 161 } // namespace remoting
147 162
148 #endif // REMOTING_PROTOCOL_SESSION_CONFIG_H_ 163 #endif // REMOTING_PROTOCOL_SESSION_CONFIG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698