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 #include "remoting/protocol/content_description.h" | 5 #include "remoting/protocol/content_description.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "remoting/base/constants.h" | 9 #include "remoting/base/constants.h" |
10 #include "remoting/protocol/authenticator.h" | 10 #include "remoting/protocol/authenticator.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 const char kDeprecatedHeightAttr[] = "height"; | 37 const char kDeprecatedHeightAttr[] = "height"; |
38 | 38 |
39 const char kStreamTransport[] = "stream"; | 39 const char kStreamTransport[] = "stream"; |
40 const char kDatagramTransport[] = "datagram"; | 40 const char kDatagramTransport[] = "datagram"; |
41 const char kNoneTransport[] = "none"; | 41 const char kNoneTransport[] = "none"; |
42 | 42 |
43 const char kVerbatimCodec[] = "verbatim"; | 43 const char kVerbatimCodec[] = "verbatim"; |
44 const char kVp8Codec[] = "vp8"; | 44 const char kVp8Codec[] = "vp8"; |
45 const char kZipCodec[] = "zip"; | 45 const char kZipCodec[] = "zip"; |
46 const char kVorbisCodec[] = "vorbis"; | 46 const char kVorbisCodec[] = "vorbis"; |
| 47 const char kSpeexCodec[] = "speex"; |
47 | 48 |
48 const char* GetTransportName(ChannelConfig::TransportType type) { | 49 const char* GetTransportName(ChannelConfig::TransportType type) { |
49 switch (type) { | 50 switch (type) { |
50 case ChannelConfig::TRANSPORT_STREAM: | 51 case ChannelConfig::TRANSPORT_STREAM: |
51 return kStreamTransport; | 52 return kStreamTransport; |
52 case ChannelConfig::TRANSPORT_DATAGRAM: | 53 case ChannelConfig::TRANSPORT_DATAGRAM: |
53 return kDatagramTransport; | 54 return kDatagramTransport; |
54 case ChannelConfig::TRANSPORT_NONE: | 55 case ChannelConfig::TRANSPORT_NONE: |
55 return kNoneTransport; | 56 return kNoneTransport; |
56 } | 57 } |
57 NOTREACHED(); | 58 NOTREACHED(); |
58 return NULL; | 59 return NULL; |
59 } | 60 } |
60 | 61 |
61 const char* GetCodecName(ChannelConfig::Codec type) { | 62 const char* GetCodecName(ChannelConfig::Codec type) { |
62 switch (type) { | 63 switch (type) { |
63 case ChannelConfig::CODEC_VERBATIM: | 64 case ChannelConfig::CODEC_VERBATIM: |
64 return kVerbatimCodec; | 65 return kVerbatimCodec; |
65 case ChannelConfig::CODEC_VP8: | 66 case ChannelConfig::CODEC_VP8: |
66 return kVp8Codec; | 67 return kVp8Codec; |
67 case ChannelConfig::CODEC_ZIP: | 68 case ChannelConfig::CODEC_ZIP: |
68 return kZipCodec; | 69 return kZipCodec; |
69 case ChannelConfig::CODEC_VORBIS: | 70 case ChannelConfig::CODEC_VORBIS: |
70 return kVorbisCodec; | 71 return kVorbisCodec; |
| 72 case ChannelConfig::CODEC_SPEEX: |
| 73 return kSpeexCodec; |
71 default: | 74 default: |
72 break; | 75 break; |
73 } | 76 } |
74 NOTREACHED(); | 77 NOTREACHED(); |
75 return NULL; | 78 return NULL; |
76 } | 79 } |
77 | 80 |
78 | 81 |
79 // Format a channel configuration tag for chromotocol session description, | 82 // Format a channel configuration tag for chromotocol session description, |
80 // e.g. for video channel: | 83 // e.g. for video channel: |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 117 |
115 bool ParseCodecName(const std::string& value, ChannelConfig::Codec* codec) { | 118 bool ParseCodecName(const std::string& value, ChannelConfig::Codec* codec) { |
116 if (value == kVerbatimCodec) { | 119 if (value == kVerbatimCodec) { |
117 *codec = ChannelConfig::CODEC_VERBATIM; | 120 *codec = ChannelConfig::CODEC_VERBATIM; |
118 } else if (value == kVp8Codec) { | 121 } else if (value == kVp8Codec) { |
119 *codec = ChannelConfig::CODEC_VP8; | 122 *codec = ChannelConfig::CODEC_VP8; |
120 } else if (value == kZipCodec) { | 123 } else if (value == kZipCodec) { |
121 *codec = ChannelConfig::CODEC_ZIP; | 124 *codec = ChannelConfig::CODEC_ZIP; |
122 } else if (value == kVorbisCodec) { | 125 } else if (value == kVorbisCodec) { |
123 *codec = ChannelConfig::CODEC_VORBIS; | 126 *codec = ChannelConfig::CODEC_VORBIS; |
| 127 } else if (value == kSpeexCodec) { |
| 128 *codec = ChannelConfig::CODEC_SPEEX; |
124 } else { | 129 } else { |
125 return false; | 130 return false; |
126 } | 131 } |
127 return true; | 132 return true; |
128 } | 133 } |
129 | 134 |
130 // Returns false if the element is invalid. | 135 // Returns false if the element is invalid. |
131 bool ParseChannelConfig(const XmlElement* element, bool codec_required, | 136 bool ParseChannelConfig(const XmlElement* element, bool codec_required, |
132 ChannelConfig* config) { | 137 ChannelConfig* config) { |
133 if (!ParseTransportName(element->Attr(QName(kDefaultNs, kTransportAttr)), | 138 if (!ParseTransportName(element->Attr(QName(kDefaultNs, kTransportAttr)), |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 const XmlElement* child = Authenticator::FindAuthenticatorMessage(element); | 279 const XmlElement* child = Authenticator::FindAuthenticatorMessage(element); |
275 if (child) | 280 if (child) |
276 authenticator_message.reset(new XmlElement(*child)); | 281 authenticator_message.reset(new XmlElement(*child)); |
277 | 282 |
278 return scoped_ptr<ContentDescription>( | 283 return scoped_ptr<ContentDescription>( |
279 new ContentDescription(config.Pass(), authenticator_message.Pass())); | 284 new ContentDescription(config.Pass(), authenticator_message.Pass())); |
280 } | 285 } |
281 | 286 |
282 } // namespace protocol | 287 } // namespace protocol |
283 } // namespace remoting | 288 } // namespace remoting |
OLD | NEW |