OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
Wez
2012/02/07 01:56:31
These look like changes from an earlier CL?
| |
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" |
11 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" | 11 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" |
(...skipping 21 matching lines...) Expand all Loading... | |
33 const char kVersionAttr[] = "version"; | 33 const char kVersionAttr[] = "version"; |
34 const char kCodecAttr[] = "codec"; | 34 const char kCodecAttr[] = "codec"; |
35 const char kDeprecatedWidthAttr[] = "width"; | 35 const char kDeprecatedWidthAttr[] = "width"; |
36 const char kDeprecatedHeightAttr[] = "height"; | 36 const char kDeprecatedHeightAttr[] = "height"; |
37 | 37 |
38 const char kStreamTransport[] = "stream"; | 38 const char kStreamTransport[] = "stream"; |
39 const char kDatagramTransport[] = "datagram"; | 39 const char kDatagramTransport[] = "datagram"; |
40 const char kSrtpTransport[] = "srtp"; | 40 const char kSrtpTransport[] = "srtp"; |
41 const char kRtpDtlsTransport[] = "rtp-dtls"; | 41 const char kRtpDtlsTransport[] = "rtp-dtls"; |
42 | 42 |
43 const char kVerbatimCodec[] = "verbatim"; | |
43 const char kVp8Codec[] = "vp8"; | 44 const char kVp8Codec[] = "vp8"; |
44 const char kZipCodec[] = "zip"; | 45 const char kZipCodec[] = "zip"; |
45 | 46 |
46 const char* GetTransportName(ChannelConfig::TransportType type) { | 47 const char* GetTransportName(ChannelConfig::TransportType type) { |
47 switch (type) { | 48 switch (type) { |
48 case ChannelConfig::TRANSPORT_STREAM: | 49 case ChannelConfig::TRANSPORT_STREAM: |
49 return kStreamTransport; | 50 return kStreamTransport; |
50 case ChannelConfig::TRANSPORT_DATAGRAM: | 51 case ChannelConfig::TRANSPORT_DATAGRAM: |
51 return kDatagramTransport; | 52 return kDatagramTransport; |
52 case ChannelConfig::TRANSPORT_SRTP: | 53 case ChannelConfig::TRANSPORT_SRTP: |
53 return kSrtpTransport; | 54 return kSrtpTransport; |
54 case ChannelConfig::TRANSPORT_RTP_DTLS: | 55 case ChannelConfig::TRANSPORT_RTP_DTLS: |
55 return kRtpDtlsTransport; | 56 return kRtpDtlsTransport; |
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) { |
64 case ChannelConfig::CODEC_VERBATIM: | |
65 return kVerbatimCodec; | |
63 case ChannelConfig::CODEC_VP8: | 66 case ChannelConfig::CODEC_VP8: |
64 return kVp8Codec; | 67 return kVp8Codec; |
65 case ChannelConfig::CODEC_ZIP: | 68 case ChannelConfig::CODEC_ZIP: |
66 return kZipCodec; | 69 return kZipCodec; |
67 default: | 70 default: |
68 break; | 71 break; |
69 } | 72 } |
70 NOTREACHED(); | 73 NOTREACHED(); |
71 return NULL; | 74 return NULL; |
72 } | 75 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 *transport = ChannelConfig::TRANSPORT_SRTP; | 107 *transport = ChannelConfig::TRANSPORT_SRTP; |
105 } else if (value == kRtpDtlsTransport) { | 108 } else if (value == kRtpDtlsTransport) { |
106 *transport = ChannelConfig::TRANSPORT_RTP_DTLS; | 109 *transport = ChannelConfig::TRANSPORT_RTP_DTLS; |
107 } else { | 110 } else { |
108 return false; | 111 return false; |
109 } | 112 } |
110 return true; | 113 return true; |
111 } | 114 } |
112 | 115 |
113 bool ParseCodecName(const std::string& value, ChannelConfig::Codec* codec) { | 116 bool ParseCodecName(const std::string& value, ChannelConfig::Codec* codec) { |
114 if (value == kVp8Codec) { | 117 if (value == kVerbatimCodec) { |
118 *codec = ChannelConfig::CODEC_VERBATIM; | |
119 } else if (value == kVp8Codec) { | |
115 *codec = ChannelConfig::CODEC_VP8; | 120 *codec = ChannelConfig::CODEC_VP8; |
116 } else if (value == kZipCodec) { | 121 } else if (value == kZipCodec) { |
117 *codec = ChannelConfig::CODEC_ZIP; | 122 *codec = ChannelConfig::CODEC_ZIP; |
118 } else { | 123 } else { |
119 return false; | 124 return false; |
120 } | 125 } |
121 return true; | 126 return true; |
122 } | 127 } |
123 | 128 |
124 // Returns false if the element is invalid. | 129 // Returns false if the element is invalid. |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
248 authenticator_message.reset(new XmlElement(*child)); | 253 authenticator_message.reset(new XmlElement(*child)); |
249 | 254 |
250 return new ContentDescription(config.Pass(), authenticator_message.Pass()); | 255 return new ContentDescription(config.Pass(), authenticator_message.Pass()); |
251 } | 256 } |
252 LOG(ERROR) << "Invalid description: " << element->Str(); | 257 LOG(ERROR) << "Invalid description: " << element->Str(); |
253 return NULL; | 258 return NULL; |
254 } | 259 } |
255 | 260 |
256 } // namespace protocol | 261 } // namespace protocol |
257 } // namespace remoting | 262 } // namespace remoting |
OLD | NEW |