blob: 112508e5a4ac2a65e92846d34e58e02d6630ec5e [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
Steve Anton10542f22019-01-11 09:11:00 -080013#ifndef PC_MEDIA_SESSION_H_
14#define PC_MEDIA_SESSION_H_
henrike@webrtc.org28e20752013-07-10 00:45:36 +000015
deadbeef0ed85b22016-02-23 17:24:52 -080016#include <map>
Steve Anton1a9d3c32018-12-10 17:18:54 -080017#include <memory>
henrike@webrtc.org28e20752013-07-10 00:45:36 +000018#include <string>
19#include <vector>
henrike@webrtc.org28e20752013-07-10 00:45:36 +000020
Steve Anton10542f22019-01-11 09:11:00 -080021#include "api/media_types.h"
22#include "media/base/media_constants.h"
23#include "media/base/media_engine.h" // For DataChannelType
24#include "p2p/base/ice_credentials_iterator.h"
25#include "p2p/base/transport_description_factory.h"
26#include "pc/jsep_transport.h"
Harald Alvestrand26bf7c42019-04-23 05:20:17 +000027#include "pc/media_protocol_names.h"
Steve Anton10542f22019-01-11 09:11:00 -080028#include "pc/session_description.h"
Amit Hilbuchbcd39d42019-01-25 17:13:56 -080029#include "rtc_base/unique_id_generator.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000030
31namespace cricket {
32
33class ChannelManager;
henrike@webrtc.org28e20752013-07-10 00:45:36 +000034
zhihuang8f65cdf2016-05-06 18:40:30 -070035// Default RTCP CNAME for unit tests.
36const char kDefaultRtcpCname[] = "DefaultRtcpCname";
37
zhihuang1c378ed2017-08-17 14:10:50 -070038// Options for an RtpSender contained with an media description/"m=" section.
Amit Hilbuchc63ddb22019-01-02 10:13:58 -080039// Note: Spec-compliant Simulcast and legacy simulcast are mutually exclusive.
zhihuang1c378ed2017-08-17 14:10:50 -070040struct SenderOptions {
41 std::string track_id;
Steve Anton8ffb9c32017-08-31 15:45:38 -070042 std::vector<std::string> stream_ids;
Amit Hilbuchc63ddb22019-01-02 10:13:58 -080043 // Use RIDs and Simulcast Layers to indicate spec-compliant Simulcast.
44 std::vector<RidDescription> rids;
45 SimulcastLayerList simulcast_layers;
46 // Use |num_sim_layers| to indicate legacy simulcast.
zhihuang1c378ed2017-08-17 14:10:50 -070047 int num_sim_layers;
48};
jiayl@webrtc.org742922b2014-10-07 21:32:43 +000049
zhihuang1c378ed2017-08-17 14:10:50 -070050// Options for an individual media description/"m=" section.
51struct MediaDescriptionOptions {
52 MediaDescriptionOptions(MediaType type,
53 const std::string& mid,
Steve Anton1d03a752017-11-27 14:30:09 -080054 webrtc::RtpTransceiverDirection direction,
zhihuang1c378ed2017-08-17 14:10:50 -070055 bool stopped)
56 : type(type), mid(mid), direction(direction), stopped(stopped) {}
zhihuanga77e6bb2017-08-14 18:17:48 -070057
zhihuang1c378ed2017-08-17 14:10:50 -070058 // TODO(deadbeef): When we don't support Plan B, there will only be one
59 // sender per media description and this can be simplified.
60 void AddAudioSender(const std::string& track_id,
Steve Anton8ffb9c32017-08-31 15:45:38 -070061 const std::vector<std::string>& stream_ids);
zhihuang1c378ed2017-08-17 14:10:50 -070062 void AddVideoSender(const std::string& track_id,
Steve Anton8ffb9c32017-08-31 15:45:38 -070063 const std::vector<std::string>& stream_ids,
Amit Hilbuchc63ddb22019-01-02 10:13:58 -080064 const std::vector<RidDescription>& rids,
65 const SimulcastLayerList& simulcast_layers,
olka3c747662017-08-17 06:50:32 -070066 int num_sim_layers);
zhihuanga77e6bb2017-08-14 18:17:48 -070067
zhihuang1c378ed2017-08-17 14:10:50 -070068 // Internally just uses sender_options.
69 void AddRtpDataChannel(const std::string& track_id,
70 const std::string& stream_id);
olka3c747662017-08-17 06:50:32 -070071
zhihuang1c378ed2017-08-17 14:10:50 -070072 MediaType type;
73 std::string mid;
Steve Anton1d03a752017-11-27 14:30:09 -080074 webrtc::RtpTransceiverDirection direction;
zhihuang1c378ed2017-08-17 14:10:50 -070075 bool stopped;
76 TransportOptions transport_options;
77 // Note: There's no equivalent "RtpReceiverOptions" because only send
78 // stream information goes in the local descriptions.
79 std::vector<SenderOptions> sender_options;
80
81 private:
82 // Doesn't DCHECK on |type|.
83 void AddSenderInternal(const std::string& track_id,
Steve Anton8ffb9c32017-08-31 15:45:38 -070084 const std::vector<std::string>& stream_ids,
Amit Hilbuchc63ddb22019-01-02 10:13:58 -080085 const std::vector<RidDescription>& rids,
86 const SimulcastLayerList& simulcast_layers,
olka3c747662017-08-17 06:50:32 -070087 int num_sim_layers);
zhihuang1c378ed2017-08-17 14:10:50 -070088};
olka3c747662017-08-17 06:50:32 -070089
zhihuang1c378ed2017-08-17 14:10:50 -070090// Provides a mechanism for describing how m= sections should be generated.
91// The m= section with index X will use media_description_options[X]. There
92// must be an option for each existing section if creating an answer, or a
93// subsequent offer.
94struct MediaSessionOptions {
95 MediaSessionOptions() {}
olka3c747662017-08-17 06:50:32 -070096
zhihuang1c378ed2017-08-17 14:10:50 -070097 bool has_audio() const { return HasMediaDescription(MEDIA_TYPE_AUDIO); }
98 bool has_video() const { return HasMediaDescription(MEDIA_TYPE_VIDEO); }
99 bool has_data() const { return HasMediaDescription(MEDIA_TYPE_DATA); }
100
101 bool HasMediaDescription(MediaType type) const;
102
103 DataChannelType data_channel_type = DCT_NONE;
zhihuang1c378ed2017-08-17 14:10:50 -0700104 bool vad_enabled = true; // When disabled, removes all CN codecs from SDP.
105 bool rtcp_mux_enabled = true;
106 bool bundle_enabled = false;
Johannes Kron89f874e2018-11-12 10:25:48 +0100107 bool offer_extmap_allow_mixed = false;
zhihuang1c378ed2017-08-17 14:10:50 -0700108 std::string rtcp_cname = kDefaultRtcpCname;
Benjamin Wrighta54daf12018-10-11 15:33:17 -0700109 webrtc::CryptoOptions crypto_options;
zhihuang1c378ed2017-08-17 14:10:50 -0700110 // List of media description options in the same order that the media
111 // descriptions will be generated.
112 std::vector<MediaDescriptionOptions> media_description_options;
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200113 std::vector<IceParameters> pooled_ice_credentials;
Piotr (Peter) Slatalab1ae10b2019-03-01 11:14:05 -0800114
115 // An optional media transport settings.
116 // In the future we may consider using a vector here, to indicate multiple
117 // supported transports.
118 absl::optional<cricket::SessionDescription::MediaTransportSetting>
119 media_transport_settings;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000120};
121
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000122// Creates media session descriptions according to the supplied codecs and
123// other fields, as well as the supplied per-call options.
124// When creating answers, performs the appropriate negotiation
125// of the various fields to determine the proper result.
126class MediaSessionDescriptionFactory {
127 public:
Amit Hilbuchbcd39d42019-01-25 17:13:56 -0800128 // Simple constructor that does not set any configuration for the factory.
129 // When using this constructor, the methods below can be used to set the
130 // configuration.
131 // The TransportDescriptionFactory and the UniqueRandomIdGenerator are not
132 // owned by MediaSessionDescriptionFactory, so they must be kept alive by the
133 // user of this class.
134 MediaSessionDescriptionFactory(const TransportDescriptionFactory* factory,
135 rtc::UniqueRandomIdGenerator* ssrc_generator);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000136 // This helper automatically sets up the factory to get its configuration
137 // from the specified ChannelManager.
138 MediaSessionDescriptionFactory(ChannelManager* cmanager,
Amit Hilbuchbcd39d42019-01-25 17:13:56 -0800139 const TransportDescriptionFactory* factory,
140 rtc::UniqueRandomIdGenerator* ssrc_generator);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000141
ossudedfd282016-06-14 07:12:39 -0700142 const AudioCodecs& audio_sendrecv_codecs() const;
ossu075af922016-06-14 03:29:38 -0700143 const AudioCodecs& audio_send_codecs() const;
144 const AudioCodecs& audio_recv_codecs() const;
145 void set_audio_codecs(const AudioCodecs& send_codecs,
146 const AudioCodecs& recv_codecs);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000147 void set_audio_rtp_header_extensions(const RtpHeaderExtensions& extensions) {
148 audio_rtp_extensions_ = extensions;
149 }
Amit Hilbuch77938e62018-12-21 09:23:38 -0800150 RtpHeaderExtensions audio_rtp_header_extensions() const;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000151 const VideoCodecs& video_codecs() const { return video_codecs_; }
152 void set_video_codecs(const VideoCodecs& codecs) { video_codecs_ = codecs; }
153 void set_video_rtp_header_extensions(const RtpHeaderExtensions& extensions) {
154 video_rtp_extensions_ = extensions;
155 }
Amit Hilbuch77938e62018-12-21 09:23:38 -0800156 RtpHeaderExtensions video_rtp_header_extensions() const;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000157 const DataCodecs& data_codecs() const { return data_codecs_; }
158 void set_data_codecs(const DataCodecs& codecs) { data_codecs_ = codecs; }
159 SecurePolicy secure() const { return secure_; }
160 void set_secure(SecurePolicy s) { secure_ = s; }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000161
jbauch5869f502017-06-29 12:31:36 -0700162 void set_enable_encrypted_rtp_header_extensions(bool enable) {
163 enable_encrypted_rtp_header_extensions_ = enable;
164 }
165
Steve Anton8f66ddb2018-12-10 16:08:05 -0800166 void set_is_unified_plan(bool is_unified_plan) {
167 is_unified_plan_ = is_unified_plan;
168 }
169
Steve Anton6fe1fba2018-12-11 10:15:23 -0800170 std::unique_ptr<SessionDescription> CreateOffer(
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000171 const MediaSessionOptions& options,
172 const SessionDescription* current_description) const;
Steve Anton6fe1fba2018-12-11 10:15:23 -0800173 std::unique_ptr<SessionDescription> CreateAnswer(
zstein4b2e0822017-02-17 19:48:38 -0800174 const SessionDescription* offer,
175 const MediaSessionOptions& options,
176 const SessionDescription* current_description) const;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000177
178 private:
ossu075af922016-06-14 03:29:38 -0700179 const AudioCodecs& GetAudioCodecsForOffer(
Steve Anton1d03a752017-11-27 14:30:09 -0800180 const webrtc::RtpTransceiverDirection& direction) const;
ossu075af922016-06-14 03:29:38 -0700181 const AudioCodecs& GetAudioCodecsForAnswer(
Steve Anton1d03a752017-11-27 14:30:09 -0800182 const webrtc::RtpTransceiverDirection& offer,
183 const webrtc::RtpTransceiverDirection& answer) const;
Steve Anton5c72e712018-12-10 14:25:30 -0800184 void GetCodecsForOffer(
185 const std::vector<const ContentInfo*>& current_active_contents,
186 AudioCodecs* audio_codecs,
187 VideoCodecs* video_codecs,
188 DataCodecs* data_codecs) const;
189 void GetCodecsForAnswer(
190 const std::vector<const ContentInfo*>& current_active_contents,
191 const SessionDescription& remote_offer,
192 AudioCodecs* audio_codecs,
193 VideoCodecs* video_codecs,
194 DataCodecs* data_codecs) const;
195 void GetRtpHdrExtsToOffer(
196 const std::vector<const ContentInfo*>& current_active_contents,
Steve Anton5c72e712018-12-10 14:25:30 -0800197 RtpHeaderExtensions* audio_extensions,
198 RtpHeaderExtensions* video_extensions) const;
Yves Gerey665174f2018-06-19 15:03:05 +0200199 bool AddTransportOffer(const std::string& content_name,
200 const TransportOptions& transport_options,
201 const SessionDescription* current_desc,
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200202 SessionDescription* offer,
203 IceCredentialsIterator* ice_credentials) const;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000204
Steve Anton1a9d3c32018-12-10 17:18:54 -0800205 std::unique_ptr<TransportDescription> CreateTransportAnswer(
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000206 const std::string& content_name,
207 const SessionDescription* offer_desc,
208 const TransportOptions& transport_options,
deadbeefb7892532017-02-22 19:35:18 -0800209 const SessionDescription* current_desc,
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200210 bool require_transport_attributes,
211 IceCredentialsIterator* ice_credentials) const;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000212
Yves Gerey665174f2018-06-19 15:03:05 +0200213 bool AddTransportAnswer(const std::string& content_name,
214 const TransportDescription& transport_desc,
215 SessionDescription* answer_desc) const;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000216
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000217 // Helpers for adding media contents to the SessionDescription. Returns true
218 // it succeeds or the media content is not needed, or false if there is any
219 // error.
220
221 bool AddAudioContentForOffer(
zhihuang1c378ed2017-08-17 14:10:50 -0700222 const MediaDescriptionOptions& media_description_options,
223 const MediaSessionOptions& session_options,
224 const ContentInfo* current_content,
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000225 const SessionDescription* current_description,
226 const RtpHeaderExtensions& audio_rtp_extensions,
227 const AudioCodecs& audio_codecs,
228 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200229 SessionDescription* desc,
230 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000231
232 bool AddVideoContentForOffer(
zhihuang1c378ed2017-08-17 14:10:50 -0700233 const MediaDescriptionOptions& media_description_options,
234 const MediaSessionOptions& session_options,
235 const ContentInfo* current_content,
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000236 const SessionDescription* current_description,
237 const RtpHeaderExtensions& video_rtp_extensions,
238 const VideoCodecs& video_codecs,
239 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200240 SessionDescription* desc,
241 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000242
Harald Alvestrand26bf7c42019-04-23 05:20:17 +0000243 bool AddSctpDataContentForOffer(
244 const MediaDescriptionOptions& media_description_options,
245 const MediaSessionOptions& session_options,
246 const ContentInfo* current_content,
247 const SessionDescription* current_description,
248 StreamParamsVec* current_streams,
249 SessionDescription* desc,
250 IceCredentialsIterator* ice_credentials) const;
251 bool AddRtpDataContentForOffer(
252 const MediaDescriptionOptions& media_description_options,
253 const MediaSessionOptions& session_options,
254 const ContentInfo* current_content,
255 const SessionDescription* current_description,
256 const DataCodecs& data_codecs,
257 StreamParamsVec* current_streams,
258 SessionDescription* desc,
259 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000260 bool AddDataContentForOffer(
zhihuang1c378ed2017-08-17 14:10:50 -0700261 const MediaDescriptionOptions& media_description_options,
262 const MediaSessionOptions& session_options,
263 const ContentInfo* current_content,
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000264 const SessionDescription* current_description,
zhihuang1c378ed2017-08-17 14:10:50 -0700265 const DataCodecs& data_codecs,
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000266 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200267 SessionDescription* desc,
268 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000269
zhihuang1c378ed2017-08-17 14:10:50 -0700270 bool AddAudioContentForAnswer(
271 const MediaDescriptionOptions& media_description_options,
272 const MediaSessionOptions& session_options,
273 const ContentInfo* offer_content,
274 const SessionDescription* offer_description,
275 const ContentInfo* current_content,
276 const SessionDescription* current_description,
277 const TransportInfo* bundle_transport,
278 const AudioCodecs& audio_codecs,
279 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200280 SessionDescription* answer,
281 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000282
zhihuang1c378ed2017-08-17 14:10:50 -0700283 bool AddVideoContentForAnswer(
284 const MediaDescriptionOptions& media_description_options,
285 const MediaSessionOptions& session_options,
286 const ContentInfo* offer_content,
287 const SessionDescription* offer_description,
288 const ContentInfo* current_content,
289 const SessionDescription* current_description,
290 const TransportInfo* bundle_transport,
291 const VideoCodecs& video_codecs,
292 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200293 SessionDescription* answer,
294 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000295
zhihuang1c378ed2017-08-17 14:10:50 -0700296 bool AddDataContentForAnswer(
297 const MediaDescriptionOptions& media_description_options,
298 const MediaSessionOptions& session_options,
299 const ContentInfo* offer_content,
300 const SessionDescription* offer_description,
301 const ContentInfo* current_content,
302 const SessionDescription* current_description,
303 const TransportInfo* bundle_transport,
304 const DataCodecs& data_codecs,
305 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200306 SessionDescription* answer,
307 IceCredentialsIterator* ice_credentials) const;
zhihuang1c378ed2017-08-17 14:10:50 -0700308
309 void ComputeAudioCodecsIntersectionAndUnion();
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000310
Steve Anton8f66ddb2018-12-10 16:08:05 -0800311 bool is_unified_plan_ = false;
ossu075af922016-06-14 03:29:38 -0700312 AudioCodecs audio_send_codecs_;
313 AudioCodecs audio_recv_codecs_;
zhihuang1c378ed2017-08-17 14:10:50 -0700314 // Intersection of send and recv.
ossu075af922016-06-14 03:29:38 -0700315 AudioCodecs audio_sendrecv_codecs_;
zhihuang1c378ed2017-08-17 14:10:50 -0700316 // Union of send and recv.
317 AudioCodecs all_audio_codecs_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000318 RtpHeaderExtensions audio_rtp_extensions_;
319 VideoCodecs video_codecs_;
320 RtpHeaderExtensions video_rtp_extensions_;
321 DataCodecs data_codecs_;
Amit Hilbuchbcd39d42019-01-25 17:13:56 -0800322 // This object is not owned by the channel so it must outlive it.
323 rtc::UniqueRandomIdGenerator* const ssrc_generator_;
jbauch5869f502017-06-29 12:31:36 -0700324 bool enable_encrypted_rtp_header_extensions_ = false;
zhihuang1c378ed2017-08-17 14:10:50 -0700325 // TODO(zhihuang): Rename secure_ to sdec_policy_; rename the related getter
326 // and setter.
327 SecurePolicy secure_ = SEC_DISABLED;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000328 const TransportDescriptionFactory* transport_desc_factory_;
329};
330
331// Convenience functions.
332bool IsMediaContent(const ContentInfo* content);
333bool IsAudioContent(const ContentInfo* content);
334bool IsVideoContent(const ContentInfo* content);
335bool IsDataContent(const ContentInfo* content);
deadbeef0ed85b22016-02-23 17:24:52 -0800336const ContentInfo* GetFirstMediaContent(const ContentInfos& contents,
337 MediaType media_type);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000338const ContentInfo* GetFirstAudioContent(const ContentInfos& contents);
339const ContentInfo* GetFirstVideoContent(const ContentInfos& contents);
340const ContentInfo* GetFirstDataContent(const ContentInfos& contents);
Steve Antonad7bffc2018-01-22 10:21:56 -0800341const ContentInfo* GetFirstMediaContent(const SessionDescription* sdesc,
342 MediaType media_type);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000343const ContentInfo* GetFirstAudioContent(const SessionDescription* sdesc);
344const ContentInfo* GetFirstVideoContent(const SessionDescription* sdesc);
345const ContentInfo* GetFirstDataContent(const SessionDescription* sdesc);
346const AudioContentDescription* GetFirstAudioContentDescription(
347 const SessionDescription* sdesc);
348const VideoContentDescription* GetFirstVideoContentDescription(
349 const SessionDescription* sdesc);
350const DataContentDescription* GetFirstDataContentDescription(
351 const SessionDescription* sdesc);
Harald Alvestrand26bf7c42019-04-23 05:20:17 +0000352const SctpDataContentDescription* GetFirstSctpDataContentDescription(
353 const SessionDescription* sdesc);
Taylor Brandstetterdc4eb8c2016-05-12 08:14:50 -0700354// Non-const versions of the above functions.
355// Useful when modifying an existing description.
Steve Anton36b29d12017-10-30 09:57:42 -0700356ContentInfo* GetFirstMediaContent(ContentInfos* contents, MediaType media_type);
357ContentInfo* GetFirstAudioContent(ContentInfos* contents);
358ContentInfo* GetFirstVideoContent(ContentInfos* contents);
359ContentInfo* GetFirstDataContent(ContentInfos* contents);
Steve Antonad7bffc2018-01-22 10:21:56 -0800360ContentInfo* GetFirstMediaContent(SessionDescription* sdesc,
361 MediaType media_type);
Taylor Brandstetterdc4eb8c2016-05-12 08:14:50 -0700362ContentInfo* GetFirstAudioContent(SessionDescription* sdesc);
363ContentInfo* GetFirstVideoContent(SessionDescription* sdesc);
364ContentInfo* GetFirstDataContent(SessionDescription* sdesc);
365AudioContentDescription* GetFirstAudioContentDescription(
366 SessionDescription* sdesc);
367VideoContentDescription* GetFirstVideoContentDescription(
368 SessionDescription* sdesc);
369DataContentDescription* GetFirstDataContentDescription(
370 SessionDescription* sdesc);
Harald Alvestrand26bf7c42019-04-23 05:20:17 +0000371SctpDataContentDescription* GetFirstSctpDataContentDescription(
372 SessionDescription* sdesc);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000373
deadbeef7914b8c2017-04-21 03:23:33 -0700374// Helper functions to return crypto suites used for SDES.
Benjamin Wrighta54daf12018-10-11 15:33:17 -0700375void GetSupportedAudioSdesCryptoSuites(
376 const webrtc::CryptoOptions& crypto_options,
377 std::vector<int>* crypto_suites);
378void GetSupportedVideoSdesCryptoSuites(
379 const webrtc::CryptoOptions& crypto_options,
380 std::vector<int>* crypto_suites);
381void GetSupportedDataSdesCryptoSuites(
382 const webrtc::CryptoOptions& crypto_options,
383 std::vector<int>* crypto_suites);
deadbeef7914b8c2017-04-21 03:23:33 -0700384void GetSupportedAudioSdesCryptoSuiteNames(
Benjamin Wrighta54daf12018-10-11 15:33:17 -0700385 const webrtc::CryptoOptions& crypto_options,
Guo-wei Shieh521ed7b2015-11-18 19:41:53 -0800386 std::vector<std::string>* crypto_suite_names);
deadbeef7914b8c2017-04-21 03:23:33 -0700387void GetSupportedVideoSdesCryptoSuiteNames(
Benjamin Wrighta54daf12018-10-11 15:33:17 -0700388 const webrtc::CryptoOptions& crypto_options,
Guo-wei Shieh521ed7b2015-11-18 19:41:53 -0800389 std::vector<std::string>* crypto_suite_names);
deadbeef7914b8c2017-04-21 03:23:33 -0700390void GetSupportedDataSdesCryptoSuiteNames(
Benjamin Wrighta54daf12018-10-11 15:33:17 -0700391 const webrtc::CryptoOptions& crypto_options,
Guo-wei Shieh521ed7b2015-11-18 19:41:53 -0800392 std::vector<std::string>* crypto_suite_names);
393
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000394} // namespace cricket
395
Steve Anton10542f22019-01-11 09:11:00 -0800396#endif // PC_MEDIA_SESSION_H_