blob: 7e074cb3b4ac20f6d924723d267d728f814e8260 [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 Alvestrand5fc28b12019-05-13 13:36:16 +020027#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;
Florent Castelli2d9d82e2019-04-23 19:25:51 +020080 std::vector<webrtc::RtpCodecCapability> codec_preferences;
zhihuang1c378ed2017-08-17 14:10:50 -070081
82 private:
83 // Doesn't DCHECK on |type|.
84 void AddSenderInternal(const std::string& track_id,
Steve Anton8ffb9c32017-08-31 15:45:38 -070085 const std::vector<std::string>& stream_ids,
Amit Hilbuchc63ddb22019-01-02 10:13:58 -080086 const std::vector<RidDescription>& rids,
87 const SimulcastLayerList& simulcast_layers,
olka3c747662017-08-17 06:50:32 -070088 int num_sim_layers);
zhihuang1c378ed2017-08-17 14:10:50 -070089};
olka3c747662017-08-17 06:50:32 -070090
zhihuang1c378ed2017-08-17 14:10:50 -070091// Provides a mechanism for describing how m= sections should be generated.
92// The m= section with index X will use media_description_options[X]. There
93// must be an option for each existing section if creating an answer, or a
94// subsequent offer.
95struct MediaSessionOptions {
96 MediaSessionOptions() {}
olka3c747662017-08-17 06:50:32 -070097
zhihuang1c378ed2017-08-17 14:10:50 -070098 bool has_audio() const { return HasMediaDescription(MEDIA_TYPE_AUDIO); }
99 bool has_video() const { return HasMediaDescription(MEDIA_TYPE_VIDEO); }
100 bool has_data() const { return HasMediaDescription(MEDIA_TYPE_DATA); }
101
102 bool HasMediaDescription(MediaType type) const;
103
104 DataChannelType data_channel_type = DCT_NONE;
zhihuang1c378ed2017-08-17 14:10:50 -0700105 bool vad_enabled = true; // When disabled, removes all CN codecs from SDP.
106 bool rtcp_mux_enabled = true;
107 bool bundle_enabled = false;
Johannes Kron89f874e2018-11-12 10:25:48 +0100108 bool offer_extmap_allow_mixed = false;
Mirta Dvornicic479a3c02019-06-04 15:38:50 +0200109 bool raw_packetization_for_video = false;
zhihuang1c378ed2017-08-17 14:10:50 -0700110 std::string rtcp_cname = kDefaultRtcpCname;
Benjamin Wrighta54daf12018-10-11 15:33:17 -0700111 webrtc::CryptoOptions crypto_options;
zhihuang1c378ed2017-08-17 14:10:50 -0700112 // List of media description options in the same order that the media
113 // descriptions will be generated.
114 std::vector<MediaDescriptionOptions> media_description_options;
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200115 std::vector<IceParameters> pooled_ice_credentials;
Piotr (Peter) Slatalab1ae10b2019-03-01 11:14:05 -0800116
117 // An optional media transport settings.
118 // In the future we may consider using a vector here, to indicate multiple
119 // supported transports.
120 absl::optional<cricket::SessionDescription::MediaTransportSetting>
121 media_transport_settings;
Harald Alvestrand4aa11922019-05-14 22:00:01 +0200122 // Use the draft-ietf-mmusic-sctp-sdp-03 obsolete syntax for SCTP
123 // datachannels.
124 // Default is true for backwards compatibility with clients that use
125 // this internal interface.
126 bool use_obsolete_sctp_sdp = true;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000127};
128
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000129// Creates media session descriptions according to the supplied codecs and
130// other fields, as well as the supplied per-call options.
131// When creating answers, performs the appropriate negotiation
132// of the various fields to determine the proper result.
133class MediaSessionDescriptionFactory {
134 public:
Amit Hilbuchbcd39d42019-01-25 17:13:56 -0800135 // Simple constructor that does not set any configuration for the factory.
136 // When using this constructor, the methods below can be used to set the
137 // configuration.
138 // The TransportDescriptionFactory and the UniqueRandomIdGenerator are not
139 // owned by MediaSessionDescriptionFactory, so they must be kept alive by the
140 // user of this class.
141 MediaSessionDescriptionFactory(const TransportDescriptionFactory* factory,
142 rtc::UniqueRandomIdGenerator* ssrc_generator);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000143 // This helper automatically sets up the factory to get its configuration
144 // from the specified ChannelManager.
145 MediaSessionDescriptionFactory(ChannelManager* cmanager,
Amit Hilbuchbcd39d42019-01-25 17:13:56 -0800146 const TransportDescriptionFactory* factory,
147 rtc::UniqueRandomIdGenerator* ssrc_generator);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000148
ossudedfd282016-06-14 07:12:39 -0700149 const AudioCodecs& audio_sendrecv_codecs() const;
ossu075af922016-06-14 03:29:38 -0700150 const AudioCodecs& audio_send_codecs() const;
151 const AudioCodecs& audio_recv_codecs() const;
152 void set_audio_codecs(const AudioCodecs& send_codecs,
153 const AudioCodecs& recv_codecs);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000154 void set_audio_rtp_header_extensions(const RtpHeaderExtensions& extensions) {
155 audio_rtp_extensions_ = extensions;
156 }
Amit Hilbuch77938e62018-12-21 09:23:38 -0800157 RtpHeaderExtensions audio_rtp_header_extensions() const;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000158 const VideoCodecs& video_codecs() const { return video_codecs_; }
159 void set_video_codecs(const VideoCodecs& codecs) { video_codecs_ = codecs; }
160 void set_video_rtp_header_extensions(const RtpHeaderExtensions& extensions) {
161 video_rtp_extensions_ = extensions;
162 }
Amit Hilbuch77938e62018-12-21 09:23:38 -0800163 RtpHeaderExtensions video_rtp_header_extensions() const;
Harald Alvestrand5fc28b12019-05-13 13:36:16 +0200164 const RtpDataCodecs& rtp_data_codecs() const { return rtp_data_codecs_; }
165 void set_rtp_data_codecs(const RtpDataCodecs& codecs) {
166 rtp_data_codecs_ = codecs;
167 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000168 SecurePolicy secure() const { return secure_; }
169 void set_secure(SecurePolicy s) { secure_ = s; }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000170
jbauch5869f502017-06-29 12:31:36 -0700171 void set_enable_encrypted_rtp_header_extensions(bool enable) {
172 enable_encrypted_rtp_header_extensions_ = enable;
173 }
174
Steve Anton8f66ddb2018-12-10 16:08:05 -0800175 void set_is_unified_plan(bool is_unified_plan) {
176 is_unified_plan_ = is_unified_plan;
177 }
178
Steve Anton6fe1fba2018-12-11 10:15:23 -0800179 std::unique_ptr<SessionDescription> CreateOffer(
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000180 const MediaSessionOptions& options,
181 const SessionDescription* current_description) const;
Steve Anton6fe1fba2018-12-11 10:15:23 -0800182 std::unique_ptr<SessionDescription> CreateAnswer(
zstein4b2e0822017-02-17 19:48:38 -0800183 const SessionDescription* offer,
184 const MediaSessionOptions& options,
185 const SessionDescription* current_description) const;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000186
187 private:
ossu075af922016-06-14 03:29:38 -0700188 const AudioCodecs& GetAudioCodecsForOffer(
Steve Anton1d03a752017-11-27 14:30:09 -0800189 const webrtc::RtpTransceiverDirection& direction) const;
ossu075af922016-06-14 03:29:38 -0700190 const AudioCodecs& GetAudioCodecsForAnswer(
Steve Anton1d03a752017-11-27 14:30:09 -0800191 const webrtc::RtpTransceiverDirection& offer,
192 const webrtc::RtpTransceiverDirection& answer) const;
Steve Anton5c72e712018-12-10 14:25:30 -0800193 void GetCodecsForOffer(
194 const std::vector<const ContentInfo*>& current_active_contents,
195 AudioCodecs* audio_codecs,
196 VideoCodecs* video_codecs,
Harald Alvestrand5fc28b12019-05-13 13:36:16 +0200197 RtpDataCodecs* rtp_data_codecs) const;
Steve Anton5c72e712018-12-10 14:25:30 -0800198 void GetCodecsForAnswer(
199 const std::vector<const ContentInfo*>& current_active_contents,
200 const SessionDescription& remote_offer,
201 AudioCodecs* audio_codecs,
202 VideoCodecs* video_codecs,
Harald Alvestrand5fc28b12019-05-13 13:36:16 +0200203 RtpDataCodecs* rtp_data_codecs) const;
Steve Anton5c72e712018-12-10 14:25:30 -0800204 void GetRtpHdrExtsToOffer(
205 const std::vector<const ContentInfo*>& current_active_contents,
Steve Anton5c72e712018-12-10 14:25:30 -0800206 RtpHeaderExtensions* audio_extensions,
207 RtpHeaderExtensions* video_extensions) const;
Yves Gerey665174f2018-06-19 15:03:05 +0200208 bool AddTransportOffer(const std::string& content_name,
209 const TransportOptions& transport_options,
210 const SessionDescription* current_desc,
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200211 SessionDescription* offer,
212 IceCredentialsIterator* ice_credentials) const;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000213
Steve Anton1a9d3c32018-12-10 17:18:54 -0800214 std::unique_ptr<TransportDescription> CreateTransportAnswer(
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000215 const std::string& content_name,
216 const SessionDescription* offer_desc,
217 const TransportOptions& transport_options,
deadbeefb7892532017-02-22 19:35:18 -0800218 const SessionDescription* current_desc,
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200219 bool require_transport_attributes,
220 IceCredentialsIterator* ice_credentials) const;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000221
Yves Gerey665174f2018-06-19 15:03:05 +0200222 bool AddTransportAnswer(const std::string& content_name,
223 const TransportDescription& transport_desc,
224 SessionDescription* answer_desc) const;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000225
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000226 // Helpers for adding media contents to the SessionDescription. Returns true
227 // it succeeds or the media content is not needed, or false if there is any
228 // error.
229
230 bool AddAudioContentForOffer(
zhihuang1c378ed2017-08-17 14:10:50 -0700231 const MediaDescriptionOptions& media_description_options,
232 const MediaSessionOptions& session_options,
233 const ContentInfo* current_content,
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000234 const SessionDescription* current_description,
235 const RtpHeaderExtensions& audio_rtp_extensions,
236 const AudioCodecs& audio_codecs,
237 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200238 SessionDescription* desc,
239 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000240
241 bool AddVideoContentForOffer(
zhihuang1c378ed2017-08-17 14:10:50 -0700242 const MediaDescriptionOptions& media_description_options,
243 const MediaSessionOptions& session_options,
244 const ContentInfo* current_content,
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000245 const SessionDescription* current_description,
246 const RtpHeaderExtensions& video_rtp_extensions,
247 const VideoCodecs& video_codecs,
248 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200249 SessionDescription* desc,
250 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000251
Harald Alvestrand5fc28b12019-05-13 13:36:16 +0200252 bool AddSctpDataContentForOffer(
253 const MediaDescriptionOptions& media_description_options,
254 const MediaSessionOptions& session_options,
255 const ContentInfo* current_content,
256 const SessionDescription* current_description,
257 StreamParamsVec* current_streams,
258 SessionDescription* desc,
259 IceCredentialsIterator* ice_credentials) const;
260 bool AddRtpDataContentForOffer(
261 const MediaDescriptionOptions& media_description_options,
262 const MediaSessionOptions& session_options,
263 const ContentInfo* current_content,
264 const SessionDescription* current_description,
265 const RtpDataCodecs& rtp_data_codecs,
266 StreamParamsVec* current_streams,
267 SessionDescription* desc,
268 IceCredentialsIterator* ice_credentials) const;
269 // This function calls either AddRtpDataContentForOffer or
270 // AddSctpDataContentForOffer depending on protocol.
271 // The codecs argument is ignored for SCTP.
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000272 bool AddDataContentForOffer(
zhihuang1c378ed2017-08-17 14:10:50 -0700273 const MediaDescriptionOptions& media_description_options,
274 const MediaSessionOptions& session_options,
275 const ContentInfo* current_content,
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000276 const SessionDescription* current_description,
Harald Alvestrand5fc28b12019-05-13 13:36:16 +0200277 const RtpDataCodecs& rtp_data_codecs,
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000278 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200279 SessionDescription* desc,
280 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000281
zhihuang1c378ed2017-08-17 14:10:50 -0700282 bool AddAudioContentForAnswer(
283 const MediaDescriptionOptions& media_description_options,
284 const MediaSessionOptions& session_options,
285 const ContentInfo* offer_content,
286 const SessionDescription* offer_description,
287 const ContentInfo* current_content,
288 const SessionDescription* current_description,
289 const TransportInfo* bundle_transport,
290 const AudioCodecs& audio_codecs,
291 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200292 SessionDescription* answer,
293 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000294
zhihuang1c378ed2017-08-17 14:10:50 -0700295 bool AddVideoContentForAnswer(
296 const MediaDescriptionOptions& media_description_options,
297 const MediaSessionOptions& session_options,
298 const ContentInfo* offer_content,
299 const SessionDescription* offer_description,
300 const ContentInfo* current_content,
301 const SessionDescription* current_description,
302 const TransportInfo* bundle_transport,
303 const VideoCodecs& video_codecs,
304 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200305 SessionDescription* answer,
306 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000307
zhihuang1c378ed2017-08-17 14:10:50 -0700308 bool AddDataContentForAnswer(
309 const MediaDescriptionOptions& media_description_options,
310 const MediaSessionOptions& session_options,
311 const ContentInfo* offer_content,
312 const SessionDescription* offer_description,
313 const ContentInfo* current_content,
314 const SessionDescription* current_description,
315 const TransportInfo* bundle_transport,
Harald Alvestrand5fc28b12019-05-13 13:36:16 +0200316 const RtpDataCodecs& rtp_data_codecs,
zhihuang1c378ed2017-08-17 14:10:50 -0700317 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200318 SessionDescription* answer,
319 IceCredentialsIterator* ice_credentials) const;
zhihuang1c378ed2017-08-17 14:10:50 -0700320
321 void ComputeAudioCodecsIntersectionAndUnion();
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000322
Steve Anton8f66ddb2018-12-10 16:08:05 -0800323 bool is_unified_plan_ = false;
ossu075af922016-06-14 03:29:38 -0700324 AudioCodecs audio_send_codecs_;
325 AudioCodecs audio_recv_codecs_;
zhihuang1c378ed2017-08-17 14:10:50 -0700326 // Intersection of send and recv.
ossu075af922016-06-14 03:29:38 -0700327 AudioCodecs audio_sendrecv_codecs_;
zhihuang1c378ed2017-08-17 14:10:50 -0700328 // Union of send and recv.
329 AudioCodecs all_audio_codecs_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000330 RtpHeaderExtensions audio_rtp_extensions_;
331 VideoCodecs video_codecs_;
332 RtpHeaderExtensions video_rtp_extensions_;
Harald Alvestrand5fc28b12019-05-13 13:36:16 +0200333 RtpDataCodecs rtp_data_codecs_;
Amit Hilbuchbcd39d42019-01-25 17:13:56 -0800334 // This object is not owned by the channel so it must outlive it.
335 rtc::UniqueRandomIdGenerator* const ssrc_generator_;
jbauch5869f502017-06-29 12:31:36 -0700336 bool enable_encrypted_rtp_header_extensions_ = false;
zhihuang1c378ed2017-08-17 14:10:50 -0700337 // TODO(zhihuang): Rename secure_ to sdec_policy_; rename the related getter
338 // and setter.
339 SecurePolicy secure_ = SEC_DISABLED;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000340 const TransportDescriptionFactory* transport_desc_factory_;
341};
342
343// Convenience functions.
344bool IsMediaContent(const ContentInfo* content);
345bool IsAudioContent(const ContentInfo* content);
346bool IsVideoContent(const ContentInfo* content);
347bool IsDataContent(const ContentInfo* content);
deadbeef0ed85b22016-02-23 17:24:52 -0800348const ContentInfo* GetFirstMediaContent(const ContentInfos& contents,
349 MediaType media_type);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000350const ContentInfo* GetFirstAudioContent(const ContentInfos& contents);
351const ContentInfo* GetFirstVideoContent(const ContentInfos& contents);
352const ContentInfo* GetFirstDataContent(const ContentInfos& contents);
Steve Antonad7bffc2018-01-22 10:21:56 -0800353const ContentInfo* GetFirstMediaContent(const SessionDescription* sdesc,
354 MediaType media_type);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000355const ContentInfo* GetFirstAudioContent(const SessionDescription* sdesc);
356const ContentInfo* GetFirstVideoContent(const SessionDescription* sdesc);
357const ContentInfo* GetFirstDataContent(const SessionDescription* sdesc);
358const AudioContentDescription* GetFirstAudioContentDescription(
359 const SessionDescription* sdesc);
360const VideoContentDescription* GetFirstVideoContentDescription(
361 const SessionDescription* sdesc);
Harald Alvestrand5fc28b12019-05-13 13:36:16 +0200362const RtpDataContentDescription* GetFirstRtpDataContentDescription(
363 const SessionDescription* sdesc);
364const SctpDataContentDescription* GetFirstSctpDataContentDescription(
365 const SessionDescription* sdesc);
Taylor Brandstetterdc4eb8c2016-05-12 08:14:50 -0700366// Non-const versions of the above functions.
367// Useful when modifying an existing description.
Steve Anton36b29d12017-10-30 09:57:42 -0700368ContentInfo* GetFirstMediaContent(ContentInfos* contents, MediaType media_type);
369ContentInfo* GetFirstAudioContent(ContentInfos* contents);
370ContentInfo* GetFirstVideoContent(ContentInfos* contents);
371ContentInfo* GetFirstDataContent(ContentInfos* contents);
Steve Antonad7bffc2018-01-22 10:21:56 -0800372ContentInfo* GetFirstMediaContent(SessionDescription* sdesc,
373 MediaType media_type);
Taylor Brandstetterdc4eb8c2016-05-12 08:14:50 -0700374ContentInfo* GetFirstAudioContent(SessionDescription* sdesc);
375ContentInfo* GetFirstVideoContent(SessionDescription* sdesc);
376ContentInfo* GetFirstDataContent(SessionDescription* sdesc);
377AudioContentDescription* GetFirstAudioContentDescription(
378 SessionDescription* sdesc);
379VideoContentDescription* GetFirstVideoContentDescription(
380 SessionDescription* sdesc);
Harald Alvestrand5fc28b12019-05-13 13:36:16 +0200381RtpDataContentDescription* GetFirstRtpDataContentDescription(
382 SessionDescription* sdesc);
383SctpDataContentDescription* GetFirstSctpDataContentDescription(
384 SessionDescription* sdesc);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000385
deadbeef7914b8c2017-04-21 03:23:33 -0700386// Helper functions to return crypto suites used for SDES.
Benjamin Wrighta54daf12018-10-11 15:33:17 -0700387void GetSupportedAudioSdesCryptoSuites(
388 const webrtc::CryptoOptions& crypto_options,
389 std::vector<int>* crypto_suites);
390void GetSupportedVideoSdesCryptoSuites(
391 const webrtc::CryptoOptions& crypto_options,
392 std::vector<int>* crypto_suites);
393void GetSupportedDataSdesCryptoSuites(
394 const webrtc::CryptoOptions& crypto_options,
395 std::vector<int>* crypto_suites);
deadbeef7914b8c2017-04-21 03:23:33 -0700396void GetSupportedAudioSdesCryptoSuiteNames(
Benjamin Wrighta54daf12018-10-11 15:33:17 -0700397 const webrtc::CryptoOptions& crypto_options,
Guo-wei Shieh521ed7b2015-11-18 19:41:53 -0800398 std::vector<std::string>* crypto_suite_names);
deadbeef7914b8c2017-04-21 03:23:33 -0700399void GetSupportedVideoSdesCryptoSuiteNames(
Benjamin Wrighta54daf12018-10-11 15:33:17 -0700400 const webrtc::CryptoOptions& crypto_options,
Guo-wei Shieh521ed7b2015-11-18 19:41:53 -0800401 std::vector<std::string>* crypto_suite_names);
deadbeef7914b8c2017-04-21 03:23:33 -0700402void GetSupportedDataSdesCryptoSuiteNames(
Benjamin Wrighta54daf12018-10-11 15:33:17 -0700403 const webrtc::CryptoOptions& crypto_options,
Guo-wei Shieh521ed7b2015-11-18 19:41:53 -0800404 std::vector<std::string>* crypto_suite_names);
405
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000406} // namespace cricket
407
Steve Anton10542f22019-01-11 09:11:00 -0800408#endif // PC_MEDIA_SESSION_H_