| 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 30 matching lines...) Expand all Loading... |
| 41 { ChannelConfig::TRANSPORT_STREAM, "stream" }, | 41 { ChannelConfig::TRANSPORT_STREAM, "stream" }, |
| 42 { ChannelConfig::TRANSPORT_MUX_STREAM, "mux-stream" }, | 42 { ChannelConfig::TRANSPORT_MUX_STREAM, "mux-stream" }, |
| 43 { ChannelConfig::TRANSPORT_DATAGRAM, "datagram" }, | 43 { ChannelConfig::TRANSPORT_DATAGRAM, "datagram" }, |
| 44 { ChannelConfig::TRANSPORT_NONE, "none" }, | 44 { ChannelConfig::TRANSPORT_NONE, "none" }, |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 const NameMapElement<ChannelConfig::Codec> kCodecs[] = { | 47 const NameMapElement<ChannelConfig::Codec> kCodecs[] = { |
| 48 { ChannelConfig::CODEC_VERBATIM, "verbatim" }, | 48 { ChannelConfig::CODEC_VERBATIM, "verbatim" }, |
| 49 { ChannelConfig::CODEC_VP8, "vp8" }, | 49 { ChannelConfig::CODEC_VP8, "vp8" }, |
| 50 { ChannelConfig::CODEC_ZIP, "zip" }, | 50 { ChannelConfig::CODEC_ZIP, "zip" }, |
| 51 { ChannelConfig::CODEC_VORBIS, "vorbis" }, | 51 { ChannelConfig::CODEC_OPUS, "opus" }, |
| 52 { ChannelConfig::CODEC_SPEEX, "speex" }, | 52 { ChannelConfig::CODEC_SPEEX, "speex" }, |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 // Format a channel configuration tag for chromotocol session description, | 55 // Format a channel configuration tag for chromotocol session description, |
| 56 // e.g. for video channel: | 56 // e.g. for video channel: |
| 57 // <video transport="stream" version="1" codec="vp8" /> | 57 // <video transport="stream" version="1" codec="vp8" /> |
| 58 XmlElement* FormatChannelConfig(const ChannelConfig& config, | 58 XmlElement* FormatChannelConfig(const ChannelConfig& config, |
| 59 const std::string& tag_name) { | 59 const std::string& tag_name) { |
| 60 XmlElement* result = new XmlElement( | 60 XmlElement* result = new XmlElement( |
| 61 QName(kChromotingXmlNamespace, tag_name)); | 61 QName(kChromotingXmlNamespace, tag_name)); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 scoped_ptr<XmlElement> message(new XmlElement(*authenticator_message_)); | 127 scoped_ptr<XmlElement> message(new XmlElement(*authenticator_message_)); |
| 128 return new ContentDescription(candidate_config_->Clone(), message.Pass()); | 128 return new ContentDescription(candidate_config_->Clone(), message.Pass()); |
| 129 } | 129 } |
| 130 | 130 |
| 131 // ToXml() creates content description for chromoting session. The | 131 // ToXml() creates content description for chromoting session. The |
| 132 // description looks as follows: | 132 // description looks as follows: |
| 133 // <description xmlns="google:remoting"> | 133 // <description xmlns="google:remoting"> |
| 134 // <control transport="stream" version="1" /> | 134 // <control transport="stream" version="1" /> |
| 135 // <event transport="datagram" version="1" /> | 135 // <event transport="datagram" version="1" /> |
| 136 // <video transport="stream" codec="vp8" version="1" /> | 136 // <video transport="stream" codec="vp8" version="1" /> |
| 137 // <audio transport="stream" codec="vorbis" version="1" /> | 137 // <audio transport="stream" codec="opus" version="1" /> |
| 138 // <authentication> | 138 // <authentication> |
| 139 // Message created by Authenticator implementation. | 139 // Message created by Authenticator implementation. |
| 140 // </authentication> | 140 // </authentication> |
| 141 // </description> | 141 // </description> |
| 142 // | 142 // |
| 143 XmlElement* ContentDescription::ToXml() const { | 143 XmlElement* ContentDescription::ToXml() const { |
| 144 XmlElement* root = new XmlElement( | 144 XmlElement* root = new XmlElement( |
| 145 QName(kChromotingXmlNamespace, kDescriptionTag), true); | 145 QName(kChromotingXmlNamespace, kDescriptionTag), true); |
| 146 | 146 |
| 147 std::vector<ChannelConfig>::const_iterator it; | 147 std::vector<ChannelConfig>::const_iterator it; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 const XmlElement* child = Authenticator::FindAuthenticatorMessage(element); | 232 const XmlElement* child = Authenticator::FindAuthenticatorMessage(element); |
| 233 if (child) | 233 if (child) |
| 234 authenticator_message.reset(new XmlElement(*child)); | 234 authenticator_message.reset(new XmlElement(*child)); |
| 235 | 235 |
| 236 return scoped_ptr<ContentDescription>( | 236 return scoped_ptr<ContentDescription>( |
| 237 new ContentDescription(config.Pass(), authenticator_message.Pass())); | 237 new ContentDescription(config.Pass(), authenticator_message.Pass())); |
| 238 } | 238 } |
| 239 | 239 |
| 240 } // namespace protocol | 240 } // namespace protocol |
| 241 } // namespace remoting | 241 } // namespace remoting |
| OLD | NEW |