blob: bb973aaed43d81c7f763bf29d3a93276f5d6e737 [file] [log] [blame]
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001/*
2 * libjingle
3 * Copyright 2004 Google Inc.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28// Types and classes used in media session descriptions.
29
30#ifndef TALK_SESSION_MEDIA_MEDIASESSION_H_
31#define TALK_SESSION_MEDIA_MEDIASESSION_H_
32
buildbot@webrtc.orga09a9992014-08-13 17:26:08 +000033#include <algorithm>
henrike@webrtc.org28e20752013-07-10 00:45:36 +000034#include <string>
35#include <vector>
henrike@webrtc.org28e20752013-07-10 00:45:36 +000036
henrike@webrtc.org28e20752013-07-10 00:45:36 +000037#include "talk/media/base/codec.h"
38#include "talk/media/base/constants.h"
39#include "talk/media/base/cryptoparams.h"
40#include "talk/media/base/mediachannel.h"
41#include "talk/media/base/mediaengine.h" // For DataChannelType
42#include "talk/media/base/streamparams.h"
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000043#include "webrtc/p2p/base/sessiondescription.h"
44#include "webrtc/p2p/base/transport.h"
45#include "webrtc/p2p/base/transportdescriptionfactory.h"
buildbot@webrtc.orga09a9992014-08-13 17:26:08 +000046#include "webrtc/base/scoped_ptr.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000047
48namespace cricket {
49
50class ChannelManager;
51typedef std::vector<AudioCodec> AudioCodecs;
52typedef std::vector<VideoCodec> VideoCodecs;
53typedef std::vector<DataCodec> DataCodecs;
54typedef std::vector<CryptoParams> CryptoParamsVec;
55typedef std::vector<RtpHeaderExtension> RtpHeaderExtensions;
56
henrike@webrtc.org28e20752013-07-10 00:45:36 +000057enum MediaType {
58 MEDIA_TYPE_AUDIO,
59 MEDIA_TYPE_VIDEO,
60 MEDIA_TYPE_DATA
61};
62
sergeyu@chromium.org4b26e2e2014-01-15 23:15:54 +000063std::string MediaTypeToString(MediaType type);
64
henrike@webrtc.org28e20752013-07-10 00:45:36 +000065enum MediaContentDirection {
66 MD_INACTIVE,
67 MD_SENDONLY,
68 MD_RECVONLY,
69 MD_SENDRECV
70};
71
henrike@webrtc.orgb90991d2014-03-04 19:54:57 +000072enum CryptoType {
73 CT_NONE,
74 CT_SDES,
75 CT_DTLS
76};
77
henrike@webrtc.org28e20752013-07-10 00:45:36 +000078// RTC4585 RTP/AVPF
79extern const char kMediaProtocolAvpf[];
80// RFC5124 RTP/SAVPF
81extern const char kMediaProtocolSavpf[];
82
jiayl@webrtc.org8dcd43c2014-05-29 22:07:59 +000083extern const char kMediaProtocolDtlsSavpf[];
84
henrike@webrtc.org28e20752013-07-10 00:45:36 +000085extern const char kMediaProtocolRtpPrefix[];
86
87extern const char kMediaProtocolSctp[];
88extern const char kMediaProtocolDtlsSctp[];
lally@webrtc.orgec97c652015-02-24 20:18:48 +000089extern const char kMediaProtocolUdpDtlsSctp[];
henrike@webrtc.org28e20752013-07-10 00:45:36 +000090
91// Options to control how session descriptions are generated.
92const int kAutoBandwidth = -1;
93const int kBufferedModeDisabled = 0;
henrike@webrtc.org28e20752013-07-10 00:45:36 +000094
95struct MediaSessionOptions {
96 MediaSessionOptions() :
jiayl@webrtc.org742922b2014-10-07 21:32:43 +000097 recv_audio(true),
98 recv_video(false),
henrike@webrtc.org28e20752013-07-10 00:45:36 +000099 data_channel_type(DCT_NONE),
100 is_muc(false),
101 vad_enabled(true), // When disabled, removes all CN codecs from SDP.
102 rtcp_mux_enabled(true),
103 bundle_enabled(false),
104 video_bandwidth(kAutoBandwidth),
105 data_bandwidth(kDataMaxBandwidth) {
106 }
107
jiayl@webrtc.org742922b2014-10-07 21:32:43 +0000108 bool has_audio() const {
109 return recv_audio || HasSendMediaStream(MEDIA_TYPE_AUDIO);
110 }
111 bool has_video() const {
112 return recv_video || HasSendMediaStream(MEDIA_TYPE_VIDEO);
113 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000114 bool has_data() const { return data_channel_type != DCT_NONE; }
115
116 // Add a stream with MediaType type and id.
117 // All streams with the same sync_label will get the same CNAME.
118 // All ids must be unique.
jiayl@webrtc.org742922b2014-10-07 21:32:43 +0000119 void AddSendStream(MediaType type,
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000120 const std::string& id,
121 const std::string& sync_label);
jiayl@webrtc.org742922b2014-10-07 21:32:43 +0000122 void AddSendVideoStream(const std::string& id,
wu@webrtc.orgcecfd182013-10-30 05:18:12 +0000123 const std::string& sync_label,
124 int num_sim_layers);
jiayl@webrtc.org742922b2014-10-07 21:32:43 +0000125 void RemoveSendStream(MediaType type, const std::string& id);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000126
wu@webrtc.orgcecfd182013-10-30 05:18:12 +0000127
128 // Helper function.
jiayl@webrtc.org742922b2014-10-07 21:32:43 +0000129 void AddSendStreamInternal(MediaType type,
wu@webrtc.orgcecfd182013-10-30 05:18:12 +0000130 const std::string& id,
131 const std::string& sync_label,
132 int num_sim_layers);
133
jiayl@webrtc.org742922b2014-10-07 21:32:43 +0000134 bool HasSendMediaStream(MediaType type) const;
135
136 bool recv_audio;
137 bool recv_video;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000138 DataChannelType data_channel_type;
139 bool is_muc;
140 bool vad_enabled;
141 bool rtcp_mux_enabled;
142 bool bundle_enabled;
143 // bps. -1 == auto.
144 int video_bandwidth;
145 int data_bandwidth;
146 TransportOptions transport_options;
147
148 struct Stream {
149 Stream(MediaType type,
150 const std::string& id,
wu@webrtc.orgcecfd182013-10-30 05:18:12 +0000151 const std::string& sync_label,
152 int num_sim_layers)
153 : type(type), id(id), sync_label(sync_label),
154 num_sim_layers(num_sim_layers) {
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000155 }
156 MediaType type;
157 std::string id;
158 std::string sync_label;
wu@webrtc.orgcecfd182013-10-30 05:18:12 +0000159 int num_sim_layers;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000160 };
161
162 typedef std::vector<Stream> Streams;
163 Streams streams;
164};
165
166// "content" (as used in XEP-0166) descriptions for voice and video.
167class MediaContentDescription : public ContentDescription {
168 public:
169 MediaContentDescription()
170 : rtcp_mux_(false),
171 bandwidth_(kAutoBandwidth),
henrike@webrtc.orgb90991d2014-03-04 19:54:57 +0000172 crypto_required_(CT_NONE),
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000173 rtp_header_extensions_set_(false),
174 multistream_(false),
175 conference_mode_(false),
176 partial_(false),
177 buffered_mode_latency_(kBufferedModeDisabled),
178 direction_(MD_SENDRECV) {
179 }
180
181 virtual MediaType type() const = 0;
182 virtual bool has_codecs() const = 0;
183
184 // |protocol| is the expected media transport protocol, such as RTP/AVPF,
185 // RTP/SAVPF or SCTP/DTLS.
186 std::string protocol() const { return protocol_; }
187 void set_protocol(const std::string& protocol) { protocol_ = protocol; }
188
189 MediaContentDirection direction() const { return direction_; }
190 void set_direction(MediaContentDirection direction) {
191 direction_ = direction;
192 }
193
194 bool rtcp_mux() const { return rtcp_mux_; }
195 void set_rtcp_mux(bool mux) { rtcp_mux_ = mux; }
196
197 int bandwidth() const { return bandwidth_; }
198 void set_bandwidth(int bandwidth) { bandwidth_ = bandwidth; }
199
200 const std::vector<CryptoParams>& cryptos() const { return cryptos_; }
201 void AddCrypto(const CryptoParams& params) {
202 cryptos_.push_back(params);
203 }
204 void set_cryptos(const std::vector<CryptoParams>& cryptos) {
205 cryptos_ = cryptos;
206 }
henrike@webrtc.orgb90991d2014-03-04 19:54:57 +0000207
208 CryptoType crypto_required() const { return crypto_required_; }
209 void set_crypto_required(CryptoType type) {
210 crypto_required_ = type;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000211 }
212
213 const RtpHeaderExtensions& rtp_header_extensions() const {
214 return rtp_header_extensions_;
215 }
216 void set_rtp_header_extensions(const RtpHeaderExtensions& extensions) {
217 rtp_header_extensions_ = extensions;
218 rtp_header_extensions_set_ = true;
219 }
220 void AddRtpHeaderExtension(const RtpHeaderExtension& ext) {
221 rtp_header_extensions_.push_back(ext);
222 rtp_header_extensions_set_ = true;
223 }
224 void ClearRtpHeaderExtensions() {
225 rtp_header_extensions_.clear();
226 rtp_header_extensions_set_ = true;
227 }
228 // We can't always tell if an empty list of header extensions is
229 // because the other side doesn't support them, or just isn't hooked up to
230 // signal them. For now we assume an empty list means no signaling, but
231 // provide the ClearRtpHeaderExtensions method to allow "no support" to be
232 // clearly indicated (i.e. when derived from other information).
233 bool rtp_header_extensions_set() const {
234 return rtp_header_extensions_set_;
235 }
236 // True iff the client supports multiple streams.
237 void set_multistream(bool multistream) { multistream_ = multistream; }
238 bool multistream() const { return multistream_; }
239 const StreamParamsVec& streams() const {
240 return streams_;
241 }
242 // TODO(pthatcher): Remove this by giving mediamessage.cc access
243 // to MediaContentDescription
244 StreamParamsVec& mutable_streams() {
245 return streams_;
246 }
247 void AddStream(const StreamParams& stream) {
248 streams_.push_back(stream);
249 }
250 // Legacy streams have an ssrc, but nothing else.
251 void AddLegacyStream(uint32 ssrc) {
252 streams_.push_back(StreamParams::CreateLegacy(ssrc));
253 }
254 void AddLegacyStream(uint32 ssrc, uint32 fid_ssrc) {
255 StreamParams sp = StreamParams::CreateLegacy(ssrc);
256 sp.AddFidSsrc(ssrc, fid_ssrc);
257 streams_.push_back(sp);
258 }
259 // Sets the CNAME of all StreamParams if it have not been set.
260 // This can be used to set the CNAME of legacy streams.
261 void SetCnameIfEmpty(const std::string& cname) {
262 for (cricket::StreamParamsVec::iterator it = streams_.begin();
263 it != streams_.end(); ++it) {
264 if (it->cname.empty())
265 it->cname = cname;
266 }
267 }
268 uint32 first_ssrc() const {
269 if (streams_.empty()) {
270 return 0;
271 }
272 return streams_[0].first_ssrc();
273 }
274 bool has_ssrcs() const {
275 if (streams_.empty()) {
276 return false;
277 }
278 return streams_[0].has_ssrcs();
279 }
280
281 void set_conference_mode(bool enable) { conference_mode_ = enable; }
282 bool conference_mode() const { return conference_mode_; }
283
284 void set_partial(bool partial) { partial_ = partial; }
285 bool partial() const { return partial_; }
286
287 void set_buffered_mode_latency(int latency) {
288 buffered_mode_latency_ = latency;
289 }
290 int buffered_mode_latency() const { return buffered_mode_latency_; }
291
292 protected:
293 bool rtcp_mux_;
294 int bandwidth_;
295 std::string protocol_;
296 std::vector<CryptoParams> cryptos_;
henrike@webrtc.orgb90991d2014-03-04 19:54:57 +0000297 CryptoType crypto_required_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000298 std::vector<RtpHeaderExtension> rtp_header_extensions_;
299 bool rtp_header_extensions_set_;
300 bool multistream_;
301 StreamParamsVec streams_;
302 bool conference_mode_;
303 bool partial_;
304 int buffered_mode_latency_;
305 MediaContentDirection direction_;
306};
307
308template <class C>
309class MediaContentDescriptionImpl : public MediaContentDescription {
310 public:
311 struct PreferenceSort {
312 bool operator()(C a, C b) { return a.preference > b.preference; }
313 };
314
315 const std::vector<C>& codecs() const { return codecs_; }
316 void set_codecs(const std::vector<C>& codecs) { codecs_ = codecs; }
317 virtual bool has_codecs() const { return !codecs_.empty(); }
318 bool HasCodec(int id) {
319 bool found = false;
320 for (typename std::vector<C>::iterator iter = codecs_.begin();
321 iter != codecs_.end(); ++iter) {
322 if (iter->id == id) {
323 found = true;
324 break;
325 }
326 }
327 return found;
328 }
329 void AddCodec(const C& codec) {
330 codecs_.push_back(codec);
331 }
jiayl@webrtc.org9c16c392014-05-01 18:30:30 +0000332 void AddOrReplaceCodec(const C& codec) {
333 for (typename std::vector<C>::iterator iter = codecs_.begin();
334 iter != codecs_.end(); ++iter) {
335 if (iter->id == codec.id) {
336 *iter = codec;
337 return;
338 }
339 }
340 AddCodec(codec);
341 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000342 void AddCodecs(const std::vector<C>& codecs) {
343 typename std::vector<C>::const_iterator codec;
344 for (codec = codecs.begin(); codec != codecs.end(); ++codec) {
345 AddCodec(*codec);
346 }
347 }
348 void SortCodecs() {
349 std::sort(codecs_.begin(), codecs_.end(), PreferenceSort());
350 }
351
352 private:
353 std::vector<C> codecs_;
354};
355
356class AudioContentDescription : public MediaContentDescriptionImpl<AudioCodec> {
357 public:
358 AudioContentDescription() :
359 agc_minus_10db_(false) {}
360
361 virtual ContentDescription* Copy() const {
362 return new AudioContentDescription(*this);
363 }
364 virtual MediaType type() const { return MEDIA_TYPE_AUDIO; }
365
366 const std::string &lang() const { return lang_; }
367 void set_lang(const std::string &lang) { lang_ = lang; }
368
369 bool agc_minus_10db() const { return agc_minus_10db_; }
370 void set_agc_minus_10db(bool enable) {
371 agc_minus_10db_ = enable;
372 }
373
374 private:
375 bool agc_minus_10db_;
376
377 private:
378 std::string lang_;
379};
380
381class VideoContentDescription : public MediaContentDescriptionImpl<VideoCodec> {
382 public:
383 virtual ContentDescription* Copy() const {
384 return new VideoContentDescription(*this);
385 }
386 virtual MediaType type() const { return MEDIA_TYPE_VIDEO; }
387};
388
389class DataContentDescription : public MediaContentDescriptionImpl<DataCodec> {
390 public:
391 virtual ContentDescription* Copy() const {
392 return new DataContentDescription(*this);
393 }
394 virtual MediaType type() const { return MEDIA_TYPE_DATA; }
395};
396
397// Creates media session descriptions according to the supplied codecs and
398// other fields, as well as the supplied per-call options.
399// When creating answers, performs the appropriate negotiation
400// of the various fields to determine the proper result.
401class MediaSessionDescriptionFactory {
402 public:
403 // Default ctor; use methods below to set configuration.
404 // The TransportDescriptionFactory is not owned by MediaSessionDescFactory,
405 // so it must be kept alive by the user of this class.
406 explicit MediaSessionDescriptionFactory(
407 const TransportDescriptionFactory* factory);
408 // This helper automatically sets up the factory to get its configuration
409 // from the specified ChannelManager.
410 MediaSessionDescriptionFactory(ChannelManager* cmanager,
411 const TransportDescriptionFactory* factory);
412
413 const AudioCodecs& audio_codecs() const { return audio_codecs_; }
414 void set_audio_codecs(const AudioCodecs& codecs) { audio_codecs_ = codecs; }
415 void set_audio_rtp_header_extensions(const RtpHeaderExtensions& extensions) {
416 audio_rtp_extensions_ = extensions;
417 }
418 const RtpHeaderExtensions& audio_rtp_header_extensions() const {
419 return audio_rtp_extensions_;
420 }
421 const VideoCodecs& video_codecs() const { return video_codecs_; }
422 void set_video_codecs(const VideoCodecs& codecs) { video_codecs_ = codecs; }
423 void set_video_rtp_header_extensions(const RtpHeaderExtensions& extensions) {
424 video_rtp_extensions_ = extensions;
425 }
426 const RtpHeaderExtensions& video_rtp_header_extensions() const {
427 return video_rtp_extensions_;
428 }
429 const DataCodecs& data_codecs() const { return data_codecs_; }
430 void set_data_codecs(const DataCodecs& codecs) { data_codecs_ = codecs; }
431 SecurePolicy secure() const { return secure_; }
432 void set_secure(SecurePolicy s) { secure_ = s; }
433 // Decides if a StreamParams shall be added to the audio and video media
434 // content in SessionDescription when CreateOffer and CreateAnswer is called
435 // even if |options| don't include a Stream. This is needed to support legacy
436 // applications. |add_legacy_| is true per default.
437 void set_add_legacy_streams(bool add_legacy) { add_legacy_ = add_legacy; }
438
439 SessionDescription* CreateOffer(
440 const MediaSessionOptions& options,
441 const SessionDescription* current_description) const;
442 SessionDescription* CreateAnswer(
443 const SessionDescription* offer,
444 const MediaSessionOptions& options,
445 const SessionDescription* current_description) const;
446
447 private:
448 void GetCodecsToOffer(const SessionDescription* current_description,
449 AudioCodecs* audio_codecs,
450 VideoCodecs* video_codecs,
451 DataCodecs* data_codecs) const;
452 void GetRtpHdrExtsToOffer(const SessionDescription* current_description,
453 RtpHeaderExtensions* audio_extensions,
454 RtpHeaderExtensions* video_extensions) const;
455 bool AddTransportOffer(
456 const std::string& content_name,
457 const TransportOptions& transport_options,
458 const SessionDescription* current_desc,
459 SessionDescription* offer) const;
460
461 TransportDescription* CreateTransportAnswer(
462 const std::string& content_name,
463 const SessionDescription* offer_desc,
464 const TransportOptions& transport_options,
465 const SessionDescription* current_desc) const;
466
467 bool AddTransportAnswer(
468 const std::string& content_name,
469 const TransportDescription& transport_desc,
470 SessionDescription* answer_desc) const;
471
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000472 // Helpers for adding media contents to the SessionDescription. Returns true
473 // it succeeds or the media content is not needed, or false if there is any
474 // error.
475
476 bool AddAudioContentForOffer(
477 const MediaSessionOptions& options,
478 const SessionDescription* current_description,
479 const RtpHeaderExtensions& audio_rtp_extensions,
480 const AudioCodecs& audio_codecs,
481 StreamParamsVec* current_streams,
482 SessionDescription* desc) const;
483
484 bool AddVideoContentForOffer(
485 const MediaSessionOptions& options,
486 const SessionDescription* current_description,
487 const RtpHeaderExtensions& video_rtp_extensions,
488 const VideoCodecs& video_codecs,
489 StreamParamsVec* current_streams,
490 SessionDescription* desc) const;
491
492 bool AddDataContentForOffer(
493 const MediaSessionOptions& options,
494 const SessionDescription* current_description,
495 DataCodecs* data_codecs,
496 StreamParamsVec* current_streams,
497 SessionDescription* desc) const;
498
499 bool AddAudioContentForAnswer(
500 const SessionDescription* offer,
501 const MediaSessionOptions& options,
502 const SessionDescription* current_description,
503 StreamParamsVec* current_streams,
504 SessionDescription* answer) const;
505
506 bool AddVideoContentForAnswer(
507 const SessionDescription* offer,
508 const MediaSessionOptions& options,
509 const SessionDescription* current_description,
510 StreamParamsVec* current_streams,
511 SessionDescription* answer) const;
512
513 bool AddDataContentForAnswer(
514 const SessionDescription* offer,
515 const MediaSessionOptions& options,
516 const SessionDescription* current_description,
517 StreamParamsVec* current_streams,
518 SessionDescription* answer) const;
519
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000520 AudioCodecs audio_codecs_;
521 RtpHeaderExtensions audio_rtp_extensions_;
522 VideoCodecs video_codecs_;
523 RtpHeaderExtensions video_rtp_extensions_;
524 DataCodecs data_codecs_;
525 SecurePolicy secure_;
526 bool add_legacy_;
527 std::string lang_;
528 const TransportDescriptionFactory* transport_desc_factory_;
529};
530
531// Convenience functions.
532bool IsMediaContent(const ContentInfo* content);
533bool IsAudioContent(const ContentInfo* content);
534bool IsVideoContent(const ContentInfo* content);
535bool IsDataContent(const ContentInfo* content);
536const ContentInfo* GetFirstAudioContent(const ContentInfos& contents);
537const ContentInfo* GetFirstVideoContent(const ContentInfos& contents);
538const ContentInfo* GetFirstDataContent(const ContentInfos& contents);
539const ContentInfo* GetFirstAudioContent(const SessionDescription* sdesc);
540const ContentInfo* GetFirstVideoContent(const SessionDescription* sdesc);
541const ContentInfo* GetFirstDataContent(const SessionDescription* sdesc);
542const AudioContentDescription* GetFirstAudioContentDescription(
543 const SessionDescription* sdesc);
544const VideoContentDescription* GetFirstVideoContentDescription(
545 const SessionDescription* sdesc);
546const DataContentDescription* GetFirstDataContentDescription(
547 const SessionDescription* sdesc);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000548
549// Functions for translating media candidate names.
550
551// For converting between media ICE component and G-ICE channel
552// names. For example:
553// "rtp" <=> 1
554// "rtcp" <=> 2
555// "video_rtp" <=> 1
556// "video_rtcp" <=> 2
557// Will not convert in the general case of arbitrary channel names,
558// but is useful for cases where we have candidates for media
559// channels.
560// returns false if there is no mapping.
561bool GetMediaChannelNameFromComponent(
562 int component, cricket::MediaType media_type, std::string* channel_name);
563bool GetMediaComponentFromChannelName(
564 const std::string& channel_name, int* component);
565bool GetMediaTypeFromChannelName(
566 const std::string& channel_name, cricket::MediaType* media_type);
567
568void GetSupportedAudioCryptoSuites(std::vector<std::string>* crypto_suites);
569void GetSupportedVideoCryptoSuites(std::vector<std::string>* crypto_suites);
570void GetSupportedDataCryptoSuites(std::vector<std::string>* crypto_suites);
571void GetSupportedDefaultCryptoSuites(std::vector<std::string>* crypto_suites);
572} // namespace cricket
573
574#endif // TALK_SESSION_MEDIA_MEDIASESSION_H_