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

Side by Side Diff: remoting/protocol/content_description.cc

Issue 10831246: Speex encoding/decoding. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 #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 25 matching lines...) Expand all
36 const char kDeprecatedWidthAttr[] = "width"; 36 const char kDeprecatedWidthAttr[] = "width";
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 kSpeexCodec[] = "speex";
Sergey Ulanov 2012/08/10 20:41:37 No need to remove vorbis - we will still plug it i
kxing 2012/08/13 21:39:45 Done.
47 47
48 const char* GetTransportName(ChannelConfig::TransportType type) { 48 const char* GetTransportName(ChannelConfig::TransportType type) {
49 switch (type) { 49 switch (type) {
50 case ChannelConfig::TRANSPORT_STREAM: 50 case ChannelConfig::TRANSPORT_STREAM:
51 return kStreamTransport; 51 return kStreamTransport;
52 case ChannelConfig::TRANSPORT_DATAGRAM: 52 case ChannelConfig::TRANSPORT_DATAGRAM:
53 return kDatagramTransport; 53 return kDatagramTransport;
54 case ChannelConfig::TRANSPORT_NONE: 54 case ChannelConfig::TRANSPORT_NONE:
55 return kNoneTransport; 55 return kNoneTransport;
56 } 56 }
57 NOTREACHED(); 57 NOTREACHED();
58 return NULL; 58 return NULL;
59 } 59 }
60 60
61 const char* GetCodecName(ChannelConfig::Codec type) { 61 const char* GetCodecName(ChannelConfig::Codec type) {
62 switch (type) { 62 switch (type) {
63 case ChannelConfig::CODEC_VERBATIM: 63 case ChannelConfig::CODEC_VERBATIM:
64 return kVerbatimCodec; 64 return kVerbatimCodec;
65 case ChannelConfig::CODEC_VP8: 65 case ChannelConfig::CODEC_VP8:
66 return kVp8Codec; 66 return kVp8Codec;
67 case ChannelConfig::CODEC_ZIP: 67 case ChannelConfig::CODEC_ZIP:
68 return kZipCodec; 68 return kZipCodec;
69 case ChannelConfig::CODEC_VORBIS: 69 case ChannelConfig::CODEC_SPEEX:
70 return kVorbisCodec; 70 return kSpeexCodec;
71 default: 71 default:
72 break; 72 break;
73 } 73 }
74 NOTREACHED(); 74 NOTREACHED();
75 return NULL; 75 return NULL;
76 } 76 }
77 77
78 78
79 // Format a channel configuration tag for chromotocol session description, 79 // Format a channel configuration tag for chromotocol session description,
80 // e.g. for video channel: 80 // e.g. for video channel:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 return true; 112 return true;
113 } 113 }
114 114
115 bool ParseCodecName(const std::string& value, ChannelConfig::Codec* codec) { 115 bool ParseCodecName(const std::string& value, ChannelConfig::Codec* codec) {
116 if (value == kVerbatimCodec) { 116 if (value == kVerbatimCodec) {
117 *codec = ChannelConfig::CODEC_VERBATIM; 117 *codec = ChannelConfig::CODEC_VERBATIM;
118 } else if (value == kVp8Codec) { 118 } else if (value == kVp8Codec) {
119 *codec = ChannelConfig::CODEC_VP8; 119 *codec = ChannelConfig::CODEC_VP8;
120 } else if (value == kZipCodec) { 120 } else if (value == kZipCodec) {
121 *codec = ChannelConfig::CODEC_ZIP; 121 *codec = ChannelConfig::CODEC_ZIP;
122 } else if (value == kVorbisCodec) { 122 } else if (value == kSpeexCodec) {
123 *codec = ChannelConfig::CODEC_VORBIS; 123 *codec = ChannelConfig::CODEC_SPEEX;
124 } else { 124 } else {
125 return false; 125 return false;
126 } 126 }
127 return true; 127 return true;
128 } 128 }
129 129
130 // Returns false if the element is invalid. 130 // Returns false if the element is invalid.
131 bool ParseChannelConfig(const XmlElement* element, bool codec_required, 131 bool ParseChannelConfig(const XmlElement* element, bool codec_required,
132 ChannelConfig* config) { 132 ChannelConfig* config) {
133 if (!ParseTransportName(element->Attr(QName(kDefaultNs, kTransportAttr)), 133 if (!ParseTransportName(element->Attr(QName(kDefaultNs, kTransportAttr)),
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 scoped_ptr<XmlElement> message(new XmlElement(*authenticator_message_)); 167 scoped_ptr<XmlElement> message(new XmlElement(*authenticator_message_));
168 return new ContentDescription(candidate_config_->Clone(), message.Pass()); 168 return new ContentDescription(candidate_config_->Clone(), message.Pass());
169 } 169 }
170 170
171 // ToXml() creates content description for chromoting session. The 171 // ToXml() creates content description for chromoting session. The
172 // description looks as follows: 172 // description looks as follows:
173 // <description xmlns="google:remoting"> 173 // <description xmlns="google:remoting">
174 // <control transport="stream" version="1" /> 174 // <control transport="stream" version="1" />
175 // <event transport="datagram" version="1" /> 175 // <event transport="datagram" version="1" />
176 // <video transport="stream" codec="vp8" version="1" /> 176 // <video transport="stream" codec="vp8" version="1" />
177 // <audio transport="stream" codec="vorbis" version="1" /> 177 // <audio transport="stream" codec="speex" version="1" />
178 // <authentication> 178 // <authentication>
179 // Message created by Authenticator implementation. 179 // Message created by Authenticator implementation.
180 // </authentication> 180 // </authentication>
181 // </description> 181 // </description>
182 // 182 //
183 XmlElement* ContentDescription::ToXml() const { 183 XmlElement* ContentDescription::ToXml() const {
184 XmlElement* root = new XmlElement( 184 XmlElement* root = new XmlElement(
185 QName(kChromotingXmlNamespace, kDescriptionTag), true); 185 QName(kChromotingXmlNamespace, kDescriptionTag), true);
186 186
187 std::vector<ChannelConfig>::const_iterator it; 187 std::vector<ChannelConfig>::const_iterator it;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 const XmlElement* child = Authenticator::FindAuthenticatorMessage(element); 274 const XmlElement* child = Authenticator::FindAuthenticatorMessage(element);
275 if (child) 275 if (child)
276 authenticator_message.reset(new XmlElement(*child)); 276 authenticator_message.reset(new XmlElement(*child));
277 277
278 return scoped_ptr<ContentDescription>( 278 return scoped_ptr<ContentDescription>(
279 new ContentDescription(config.Pass(), authenticator_message.Pass())); 279 new ContentDescription(config.Pass(), authenticator_message.Pass()));
280 } 280 }
281 281
282 } // namespace protocol 282 } // namespace protocol
283 } // namespace remoting 283 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698