blob: 39ac26bd8dad104c5b10b0d450caf7cf67e85233 [file] [log] [blame]
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001/*
kjellander65c7f672016-02-12 00:05:01 -08002 * Copyright 2004 The WebRTC project authors. All Rights Reserved.
henrike@webrtc.org28e20752013-07-10 00:45:36 +00003 *
kjellander65c7f672016-02-12 00:05:01 -08004 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
henrike@webrtc.org28e20752013-07-10 00:45:36 +00009 */
10
11// Types and classes used in media session descriptions.
12
terelius8c011e52016-04-26 05:28:11 -070013#ifndef WEBRTC_PC_MEDIASESSION_H_
14#define WEBRTC_PC_MEDIASESSION_H_
henrike@webrtc.org28e20752013-07-10 00:45:36 +000015
buildbot@webrtc.orga09a9992014-08-13 17:26:08 +000016#include <algorithm>
deadbeef0ed85b22016-02-23 17:24:52 -080017#include <map>
henrike@webrtc.org28e20752013-07-10 00:45:36 +000018#include <string>
19#include <vector>
henrike@webrtc.org28e20752013-07-10 00:45:36 +000020
kjellandera96e2d72016-02-04 23:52:28 -080021#include "webrtc/media/base/codec.h"
kjellandera96e2d72016-02-04 23:52:28 -080022#include "webrtc/media/base/cryptoparams.h"
23#include "webrtc/media/base/mediachannel.h"
kjellanderf4752772016-03-02 05:42:30 -080024#include "webrtc/media/base/mediaconstants.h"
kjellandera96e2d72016-02-04 23:52:28 -080025#include "webrtc/media/base/mediaengine.h" // For DataChannelType
26#include "webrtc/media/base/streamparams.h"
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000027#include "webrtc/p2p/base/sessiondescription.h"
28#include "webrtc/p2p/base/transport.h"
29#include "webrtc/p2p/base/transportdescriptionfactory.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000030
31namespace cricket {
32
33class ChannelManager;
34typedef std::vector<AudioCodec> AudioCodecs;
35typedef std::vector<VideoCodec> VideoCodecs;
36typedef std::vector<DataCodec> DataCodecs;
37typedef std::vector<CryptoParams> CryptoParamsVec;
38typedef std::vector<RtpHeaderExtension> RtpHeaderExtensions;
39
henrike@webrtc.org28e20752013-07-10 00:45:36 +000040enum MediaType {
41 MEDIA_TYPE_AUDIO,
42 MEDIA_TYPE_VIDEO,
43 MEDIA_TYPE_DATA
44};
45
sergeyu@chromium.org4b26e2e2014-01-15 23:15:54 +000046std::string MediaTypeToString(MediaType type);
47
henrike@webrtc.org28e20752013-07-10 00:45:36 +000048enum MediaContentDirection {
49 MD_INACTIVE,
50 MD_SENDONLY,
51 MD_RECVONLY,
52 MD_SENDRECV
53};
54
henrike@webrtc.orgb90991d2014-03-04 19:54:57 +000055enum CryptoType {
56 CT_NONE,
57 CT_SDES,
58 CT_DTLS
59};
60
henrike@webrtc.org28e20752013-07-10 00:45:36 +000061// RTC4585 RTP/AVPF
62extern const char kMediaProtocolAvpf[];
63// RFC5124 RTP/SAVPF
64extern const char kMediaProtocolSavpf[];
65
jiayl@webrtc.org8dcd43c2014-05-29 22:07:59 +000066extern const char kMediaProtocolDtlsSavpf[];
67
henrike@webrtc.org28e20752013-07-10 00:45:36 +000068extern const char kMediaProtocolRtpPrefix[];
69
70extern const char kMediaProtocolSctp[];
71extern const char kMediaProtocolDtlsSctp[];
lally@webrtc.orgec97c652015-02-24 20:18:48 +000072extern const char kMediaProtocolUdpDtlsSctp[];
lally@webrtc.orga7470932015-02-24 20:19:21 +000073extern const char kMediaProtocolTcpDtlsSctp[];
henrike@webrtc.org28e20752013-07-10 00:45:36 +000074
75// Options to control how session descriptions are generated.
76const int kAutoBandwidth = -1;
77const int kBufferedModeDisabled = 0;
henrike@webrtc.org28e20752013-07-10 00:45:36 +000078
zhihuang8f65cdf2016-05-06 18:40:30 -070079// Default RTCP CNAME for unit tests.
80const char kDefaultRtcpCname[] = "DefaultRtcpCname";
81
henrike@webrtc.org28e20752013-07-10 00:45:36 +000082struct MediaSessionOptions {
zhihuang8f65cdf2016-05-06 18:40:30 -070083 MediaSessionOptions()
84 : recv_audio(true),
85 recv_video(false),
86 data_channel_type(DCT_NONE),
87 is_muc(false),
88 vad_enabled(true), // When disabled, removes all CN codecs from SDP.
89 rtcp_mux_enabled(true),
90 bundle_enabled(false),
91 video_bandwidth(kAutoBandwidth),
92 data_bandwidth(kDataMaxBandwidth),
93 rtcp_cname(kDefaultRtcpCname) {}
henrike@webrtc.org28e20752013-07-10 00:45:36 +000094
jiayl@webrtc.org742922b2014-10-07 21:32:43 +000095 bool has_audio() const {
96 return recv_audio || HasSendMediaStream(MEDIA_TYPE_AUDIO);
97 }
98 bool has_video() const {
99 return recv_video || HasSendMediaStream(MEDIA_TYPE_VIDEO);
100 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000101 bool has_data() const { return data_channel_type != DCT_NONE; }
102
103 // Add a stream with MediaType type and id.
104 // All streams with the same sync_label will get the same CNAME.
105 // All ids must be unique.
jiayl@webrtc.org742922b2014-10-07 21:32:43 +0000106 void AddSendStream(MediaType type,
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000107 const std::string& id,
108 const std::string& sync_label);
jiayl@webrtc.org742922b2014-10-07 21:32:43 +0000109 void AddSendVideoStream(const std::string& id,
wu@webrtc.orgcecfd182013-10-30 05:18:12 +0000110 const std::string& sync_label,
111 int num_sim_layers);
jiayl@webrtc.org742922b2014-10-07 21:32:43 +0000112 void RemoveSendStream(MediaType type, const std::string& id);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000113
wu@webrtc.orgcecfd182013-10-30 05:18:12 +0000114
115 // Helper function.
jiayl@webrtc.org742922b2014-10-07 21:32:43 +0000116 void AddSendStreamInternal(MediaType type,
wu@webrtc.orgcecfd182013-10-30 05:18:12 +0000117 const std::string& id,
118 const std::string& sync_label,
119 int num_sim_layers);
120
jiayl@webrtc.org742922b2014-10-07 21:32:43 +0000121 bool HasSendMediaStream(MediaType type) const;
122
Taylor Brandstetterf475d362016-01-08 15:35:57 -0800123 // TODO(deadbeef): Put all the audio/video/data-specific options into a map
124 // structure (content name -> options).
125 // MediaSessionDescriptionFactory assumes there will never be more than one
126 // audio/video/data content, but this will change with unified plan.
jiayl@webrtc.org742922b2014-10-07 21:32:43 +0000127 bool recv_audio;
128 bool recv_video;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000129 DataChannelType data_channel_type;
130 bool is_muc;
131 bool vad_enabled;
132 bool rtcp_mux_enabled;
133 bool bundle_enabled;
134 // bps. -1 == auto.
135 int video_bandwidth;
136 int data_bandwidth;
deadbeef0ed85b22016-02-23 17:24:52 -0800137 // content name ("mid") => options.
138 std::map<std::string, TransportOptions> transport_options;
zhihuang8f65cdf2016-05-06 18:40:30 -0700139 std::string rtcp_cname;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000140
141 struct Stream {
142 Stream(MediaType type,
143 const std::string& id,
wu@webrtc.orgcecfd182013-10-30 05:18:12 +0000144 const std::string& sync_label,
145 int num_sim_layers)
146 : type(type), id(id), sync_label(sync_label),
147 num_sim_layers(num_sim_layers) {
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000148 }
149 MediaType type;
150 std::string id;
151 std::string sync_label;
wu@webrtc.orgcecfd182013-10-30 05:18:12 +0000152 int num_sim_layers;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000153 };
154
155 typedef std::vector<Stream> Streams;
156 Streams streams;
157};
158
159// "content" (as used in XEP-0166) descriptions for voice and video.
160class MediaContentDescription : public ContentDescription {
161 public:
deadbeef13871492015-12-09 12:37:51 -0800162 MediaContentDescription() {}
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000163
164 virtual MediaType type() const = 0;
165 virtual bool has_codecs() const = 0;
166
167 // |protocol| is the expected media transport protocol, such as RTP/AVPF,
168 // RTP/SAVPF or SCTP/DTLS.
169 std::string protocol() const { return protocol_; }
170 void set_protocol(const std::string& protocol) { protocol_ = protocol; }
171
172 MediaContentDirection direction() const { return direction_; }
173 void set_direction(MediaContentDirection direction) {
174 direction_ = direction;
175 }
176
177 bool rtcp_mux() const { return rtcp_mux_; }
178 void set_rtcp_mux(bool mux) { rtcp_mux_ = mux; }
179
deadbeef13871492015-12-09 12:37:51 -0800180 bool rtcp_reduced_size() const { return rtcp_reduced_size_; }
181 void set_rtcp_reduced_size(bool reduced_size) {
182 rtcp_reduced_size_ = reduced_size;
183 }
184
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000185 int bandwidth() const { return bandwidth_; }
186 void set_bandwidth(int bandwidth) { bandwidth_ = bandwidth; }
187
188 const std::vector<CryptoParams>& cryptos() const { return cryptos_; }
189 void AddCrypto(const CryptoParams& params) {
190 cryptos_.push_back(params);
191 }
192 void set_cryptos(const std::vector<CryptoParams>& cryptos) {
193 cryptos_ = cryptos;
194 }
henrike@webrtc.orgb90991d2014-03-04 19:54:57 +0000195
196 CryptoType crypto_required() const { return crypto_required_; }
197 void set_crypto_required(CryptoType type) {
198 crypto_required_ = type;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000199 }
200
201 const RtpHeaderExtensions& rtp_header_extensions() const {
202 return rtp_header_extensions_;
203 }
204 void set_rtp_header_extensions(const RtpHeaderExtensions& extensions) {
205 rtp_header_extensions_ = extensions;
206 rtp_header_extensions_set_ = true;
207 }
208 void AddRtpHeaderExtension(const RtpHeaderExtension& ext) {
209 rtp_header_extensions_.push_back(ext);
210 rtp_header_extensions_set_ = true;
211 }
212 void ClearRtpHeaderExtensions() {
213 rtp_header_extensions_.clear();
214 rtp_header_extensions_set_ = true;
215 }
216 // We can't always tell if an empty list of header extensions is
217 // because the other side doesn't support them, or just isn't hooked up to
218 // signal them. For now we assume an empty list means no signaling, but
219 // provide the ClearRtpHeaderExtensions method to allow "no support" to be
220 // clearly indicated (i.e. when derived from other information).
221 bool rtp_header_extensions_set() const {
222 return rtp_header_extensions_set_;
223 }
224 // True iff the client supports multiple streams.
225 void set_multistream(bool multistream) { multistream_ = multistream; }
226 bool multistream() const { return multistream_; }
227 const StreamParamsVec& streams() const {
228 return streams_;
229 }
230 // TODO(pthatcher): Remove this by giving mediamessage.cc access
231 // to MediaContentDescription
232 StreamParamsVec& mutable_streams() {
233 return streams_;
234 }
235 void AddStream(const StreamParams& stream) {
236 streams_.push_back(stream);
237 }
238 // Legacy streams have an ssrc, but nothing else.
Peter Boström0c4e06b2015-10-07 12:23:21 +0200239 void AddLegacyStream(uint32_t ssrc) {
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000240 streams_.push_back(StreamParams::CreateLegacy(ssrc));
241 }
Peter Boström0c4e06b2015-10-07 12:23:21 +0200242 void AddLegacyStream(uint32_t ssrc, uint32_t fid_ssrc) {
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000243 StreamParams sp = StreamParams::CreateLegacy(ssrc);
244 sp.AddFidSsrc(ssrc, fid_ssrc);
245 streams_.push_back(sp);
246 }
247 // Sets the CNAME of all StreamParams if it have not been set.
248 // This can be used to set the CNAME of legacy streams.
249 void SetCnameIfEmpty(const std::string& cname) {
250 for (cricket::StreamParamsVec::iterator it = streams_.begin();
251 it != streams_.end(); ++it) {
252 if (it->cname.empty())
253 it->cname = cname;
254 }
255 }
Peter Boström0c4e06b2015-10-07 12:23:21 +0200256 uint32_t first_ssrc() const {
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000257 if (streams_.empty()) {
258 return 0;
259 }
260 return streams_[0].first_ssrc();
261 }
262 bool has_ssrcs() const {
263 if (streams_.empty()) {
264 return false;
265 }
266 return streams_[0].has_ssrcs();
267 }
268
269 void set_conference_mode(bool enable) { conference_mode_ = enable; }
270 bool conference_mode() const { return conference_mode_; }
271
272 void set_partial(bool partial) { partial_ = partial; }
273 bool partial() const { return partial_; }
274
275 void set_buffered_mode_latency(int latency) {
276 buffered_mode_latency_ = latency;
277 }
278 int buffered_mode_latency() const { return buffered_mode_latency_; }
279
280 protected:
deadbeef13871492015-12-09 12:37:51 -0800281 bool rtcp_mux_ = false;
282 bool rtcp_reduced_size_ = false;
283 int bandwidth_ = kAutoBandwidth;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000284 std::string protocol_;
285 std::vector<CryptoParams> cryptos_;
deadbeef13871492015-12-09 12:37:51 -0800286 CryptoType crypto_required_ = CT_NONE;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000287 std::vector<RtpHeaderExtension> rtp_header_extensions_;
deadbeef13871492015-12-09 12:37:51 -0800288 bool rtp_header_extensions_set_ = false;
289 bool multistream_ = false;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000290 StreamParamsVec streams_;
deadbeef13871492015-12-09 12:37:51 -0800291 bool conference_mode_ = false;
292 bool partial_ = false;
293 int buffered_mode_latency_ = kBufferedModeDisabled;
294 MediaContentDirection direction_ = MD_SENDRECV;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000295};
296
297template <class C>
298class MediaContentDescriptionImpl : public MediaContentDescription {
299 public:
deadbeef67cf2c12016-04-13 10:07:16 -0700300 typedef C CodecType;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000301
deadbeef67cf2c12016-04-13 10:07:16 -0700302 // Codecs should be in preference order (most preferred codec first).
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000303 const std::vector<C>& codecs() const { return codecs_; }
304 void set_codecs(const std::vector<C>& codecs) { codecs_ = codecs; }
305 virtual bool has_codecs() const { return !codecs_.empty(); }
306 bool HasCodec(int id) {
307 bool found = false;
308 for (typename std::vector<C>::iterator iter = codecs_.begin();
309 iter != codecs_.end(); ++iter) {
310 if (iter->id == id) {
311 found = true;
312 break;
313 }
314 }
315 return found;
316 }
317 void AddCodec(const C& codec) {
318 codecs_.push_back(codec);
319 }
jiayl@webrtc.org9c16c392014-05-01 18:30:30 +0000320 void AddOrReplaceCodec(const C& codec) {
321 for (typename std::vector<C>::iterator iter = codecs_.begin();
322 iter != codecs_.end(); ++iter) {
323 if (iter->id == codec.id) {
324 *iter = codec;
325 return;
326 }
327 }
328 AddCodec(codec);
329 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000330 void AddCodecs(const std::vector<C>& codecs) {
331 typename std::vector<C>::const_iterator codec;
332 for (codec = codecs.begin(); codec != codecs.end(); ++codec) {
333 AddCodec(*codec);
334 }
335 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000336
337 private:
338 std::vector<C> codecs_;
339};
340
341class AudioContentDescription : public MediaContentDescriptionImpl<AudioCodec> {
342 public:
343 AudioContentDescription() :
344 agc_minus_10db_(false) {}
345
346 virtual ContentDescription* Copy() const {
347 return new AudioContentDescription(*this);
348 }
349 virtual MediaType type() const { return MEDIA_TYPE_AUDIO; }
350
351 const std::string &lang() const { return lang_; }
352 void set_lang(const std::string &lang) { lang_ = lang; }
353
354 bool agc_minus_10db() const { return agc_minus_10db_; }
355 void set_agc_minus_10db(bool enable) {
356 agc_minus_10db_ = enable;
357 }
358
359 private:
360 bool agc_minus_10db_;
361
362 private:
363 std::string lang_;
364};
365
366class VideoContentDescription : public MediaContentDescriptionImpl<VideoCodec> {
367 public:
368 virtual ContentDescription* Copy() const {
369 return new VideoContentDescription(*this);
370 }
371 virtual MediaType type() const { return MEDIA_TYPE_VIDEO; }
372};
373
374class DataContentDescription : public MediaContentDescriptionImpl<DataCodec> {
375 public:
376 virtual ContentDescription* Copy() const {
377 return new DataContentDescription(*this);
378 }
379 virtual MediaType type() const { return MEDIA_TYPE_DATA; }
380};
381
382// Creates media session descriptions according to the supplied codecs and
383// other fields, as well as the supplied per-call options.
384// When creating answers, performs the appropriate negotiation
385// of the various fields to determine the proper result.
386class MediaSessionDescriptionFactory {
387 public:
388 // Default ctor; use methods below to set configuration.
389 // The TransportDescriptionFactory is not owned by MediaSessionDescFactory,
390 // so it must be kept alive by the user of this class.
391 explicit MediaSessionDescriptionFactory(
392 const TransportDescriptionFactory* factory);
393 // This helper automatically sets up the factory to get its configuration
394 // from the specified ChannelManager.
395 MediaSessionDescriptionFactory(ChannelManager* cmanager,
396 const TransportDescriptionFactory* factory);
397
398 const AudioCodecs& audio_codecs() const { return audio_codecs_; }
399 void set_audio_codecs(const AudioCodecs& codecs) { audio_codecs_ = codecs; }
400 void set_audio_rtp_header_extensions(const RtpHeaderExtensions& extensions) {
401 audio_rtp_extensions_ = extensions;
402 }
403 const RtpHeaderExtensions& audio_rtp_header_extensions() const {
404 return audio_rtp_extensions_;
405 }
406 const VideoCodecs& video_codecs() const { return video_codecs_; }
407 void set_video_codecs(const VideoCodecs& codecs) { video_codecs_ = codecs; }
408 void set_video_rtp_header_extensions(const RtpHeaderExtensions& extensions) {
409 video_rtp_extensions_ = extensions;
410 }
411 const RtpHeaderExtensions& video_rtp_header_extensions() const {
412 return video_rtp_extensions_;
413 }
414 const DataCodecs& data_codecs() const { return data_codecs_; }
415 void set_data_codecs(const DataCodecs& codecs) { data_codecs_ = codecs; }
416 SecurePolicy secure() const { return secure_; }
417 void set_secure(SecurePolicy s) { secure_ = s; }
418 // Decides if a StreamParams shall be added to the audio and video media
419 // content in SessionDescription when CreateOffer and CreateAnswer is called
420 // even if |options| don't include a Stream. This is needed to support legacy
421 // applications. |add_legacy_| is true per default.
422 void set_add_legacy_streams(bool add_legacy) { add_legacy_ = add_legacy; }
423
424 SessionDescription* CreateOffer(
425 const MediaSessionOptions& options,
426 const SessionDescription* current_description) const;
427 SessionDescription* CreateAnswer(
428 const SessionDescription* offer,
429 const MediaSessionOptions& options,
430 const SessionDescription* current_description) const;
431
432 private:
433 void GetCodecsToOffer(const SessionDescription* current_description,
434 AudioCodecs* audio_codecs,
435 VideoCodecs* video_codecs,
436 DataCodecs* data_codecs) const;
437 void GetRtpHdrExtsToOffer(const SessionDescription* current_description,
438 RtpHeaderExtensions* audio_extensions,
439 RtpHeaderExtensions* video_extensions) const;
440 bool AddTransportOffer(
441 const std::string& content_name,
442 const TransportOptions& transport_options,
443 const SessionDescription* current_desc,
444 SessionDescription* offer) const;
445
446 TransportDescription* CreateTransportAnswer(
447 const std::string& content_name,
448 const SessionDescription* offer_desc,
449 const TransportOptions& transport_options,
450 const SessionDescription* current_desc) const;
451
452 bool AddTransportAnswer(
453 const std::string& content_name,
454 const TransportDescription& transport_desc,
455 SessionDescription* answer_desc) const;
456
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000457 // Helpers for adding media contents to the SessionDescription. Returns true
458 // it succeeds or the media content is not needed, or false if there is any
459 // error.
460
461 bool AddAudioContentForOffer(
462 const MediaSessionOptions& options,
463 const SessionDescription* current_description,
464 const RtpHeaderExtensions& audio_rtp_extensions,
465 const AudioCodecs& audio_codecs,
466 StreamParamsVec* current_streams,
467 SessionDescription* desc) const;
468
469 bool AddVideoContentForOffer(
470 const MediaSessionOptions& options,
471 const SessionDescription* current_description,
472 const RtpHeaderExtensions& video_rtp_extensions,
473 const VideoCodecs& video_codecs,
474 StreamParamsVec* current_streams,
475 SessionDescription* desc) const;
476
477 bool AddDataContentForOffer(
478 const MediaSessionOptions& options,
479 const SessionDescription* current_description,
480 DataCodecs* data_codecs,
481 StreamParamsVec* current_streams,
482 SessionDescription* desc) const;
483
484 bool AddAudioContentForAnswer(
485 const SessionDescription* offer,
486 const MediaSessionOptions& options,
487 const SessionDescription* current_description,
488 StreamParamsVec* current_streams,
489 SessionDescription* answer) const;
490
491 bool AddVideoContentForAnswer(
492 const SessionDescription* offer,
493 const MediaSessionOptions& options,
494 const SessionDescription* current_description,
495 StreamParamsVec* current_streams,
496 SessionDescription* answer) const;
497
498 bool AddDataContentForAnswer(
499 const SessionDescription* offer,
500 const MediaSessionOptions& options,
501 const SessionDescription* current_description,
502 StreamParamsVec* current_streams,
503 SessionDescription* answer) const;
504
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000505 AudioCodecs audio_codecs_;
506 RtpHeaderExtensions audio_rtp_extensions_;
507 VideoCodecs video_codecs_;
508 RtpHeaderExtensions video_rtp_extensions_;
509 DataCodecs data_codecs_;
510 SecurePolicy secure_;
511 bool add_legacy_;
512 std::string lang_;
513 const TransportDescriptionFactory* transport_desc_factory_;
514};
515
516// Convenience functions.
517bool IsMediaContent(const ContentInfo* content);
518bool IsAudioContent(const ContentInfo* content);
519bool IsVideoContent(const ContentInfo* content);
520bool IsDataContent(const ContentInfo* content);
deadbeef0ed85b22016-02-23 17:24:52 -0800521const ContentInfo* GetFirstMediaContent(const ContentInfos& contents,
522 MediaType media_type);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000523const ContentInfo* GetFirstAudioContent(const ContentInfos& contents);
524const ContentInfo* GetFirstVideoContent(const ContentInfos& contents);
525const ContentInfo* GetFirstDataContent(const ContentInfos& contents);
526const ContentInfo* GetFirstAudioContent(const SessionDescription* sdesc);
527const ContentInfo* GetFirstVideoContent(const SessionDescription* sdesc);
528const ContentInfo* GetFirstDataContent(const SessionDescription* sdesc);
529const AudioContentDescription* GetFirstAudioContentDescription(
530 const SessionDescription* sdesc);
531const VideoContentDescription* GetFirstVideoContentDescription(
532 const SessionDescription* sdesc);
533const DataContentDescription* GetFirstDataContentDescription(
534 const SessionDescription* sdesc);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000535
Guo-wei Shieh521ed7b2015-11-18 19:41:53 -0800536void GetSupportedAudioCryptoSuites(std::vector<int>* crypto_suites);
537void GetSupportedVideoCryptoSuites(std::vector<int>* crypto_suites);
538void GetSupportedDataCryptoSuites(std::vector<int>* crypto_suites);
539void GetDefaultSrtpCryptoSuites(std::vector<int>* crypto_suites);
540void GetSupportedAudioCryptoSuiteNames(
541 std::vector<std::string>* crypto_suite_names);
542void GetSupportedVideoCryptoSuiteNames(
543 std::vector<std::string>* crypto_suite_names);
544void GetSupportedDataCryptoSuiteNames(
545 std::vector<std::string>* crypto_suite_names);
546void GetDefaultSrtpCryptoSuiteNames(
547 std::vector<std::string>* crypto_suite_names);
548
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000549} // namespace cricket
550
terelius8c011e52016-04-26 05:28:11 -0700551#endif // WEBRTC_PC_MEDIASESSION_H_