blob: 1de8ed4e1a84e2d5c1a843c2292403c698d4930b [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,
Johannes Kron746dd0d2019-06-20 15:37:52 +0200206 bool extmap_allow_mixed,
Steve Anton5c72e712018-12-10 14:25:30 -0800207 RtpHeaderExtensions* audio_extensions,
208 RtpHeaderExtensions* video_extensions) const;
Yves Gerey665174f2018-06-19 15:03:05 +0200209 bool AddTransportOffer(const std::string& content_name,
210 const TransportOptions& transport_options,
211 const SessionDescription* current_desc,
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200212 SessionDescription* offer,
213 IceCredentialsIterator* ice_credentials) const;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000214
Steve Anton1a9d3c32018-12-10 17:18:54 -0800215 std::unique_ptr<TransportDescription> CreateTransportAnswer(
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000216 const std::string& content_name,
217 const SessionDescription* offer_desc,
218 const TransportOptions& transport_options,
deadbeefb7892532017-02-22 19:35:18 -0800219 const SessionDescription* current_desc,
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200220 bool require_transport_attributes,
221 IceCredentialsIterator* ice_credentials) const;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000222
Yves Gerey665174f2018-06-19 15:03:05 +0200223 bool AddTransportAnswer(const std::string& content_name,
224 const TransportDescription& transport_desc,
225 SessionDescription* answer_desc) const;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000226
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000227 // Helpers for adding media contents to the SessionDescription. Returns true
228 // it succeeds or the media content is not needed, or false if there is any
229 // error.
230
231 bool AddAudioContentForOffer(
zhihuang1c378ed2017-08-17 14:10:50 -0700232 const MediaDescriptionOptions& media_description_options,
233 const MediaSessionOptions& session_options,
234 const ContentInfo* current_content,
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000235 const SessionDescription* current_description,
236 const RtpHeaderExtensions& audio_rtp_extensions,
237 const AudioCodecs& audio_codecs,
238 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200239 SessionDescription* desc,
240 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000241
242 bool AddVideoContentForOffer(
zhihuang1c378ed2017-08-17 14:10:50 -0700243 const MediaDescriptionOptions& media_description_options,
244 const MediaSessionOptions& session_options,
245 const ContentInfo* current_content,
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000246 const SessionDescription* current_description,
247 const RtpHeaderExtensions& video_rtp_extensions,
248 const VideoCodecs& video_codecs,
249 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200250 SessionDescription* desc,
251 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000252
Harald Alvestrand5fc28b12019-05-13 13:36:16 +0200253 bool AddSctpDataContentForOffer(
254 const MediaDescriptionOptions& media_description_options,
255 const MediaSessionOptions& session_options,
256 const ContentInfo* current_content,
257 const SessionDescription* current_description,
258 StreamParamsVec* current_streams,
259 SessionDescription* desc,
260 IceCredentialsIterator* ice_credentials) const;
261 bool AddRtpDataContentForOffer(
262 const MediaDescriptionOptions& media_description_options,
263 const MediaSessionOptions& session_options,
264 const ContentInfo* current_content,
265 const SessionDescription* current_description,
266 const RtpDataCodecs& rtp_data_codecs,
267 StreamParamsVec* current_streams,
268 SessionDescription* desc,
269 IceCredentialsIterator* ice_credentials) const;
270 // This function calls either AddRtpDataContentForOffer or
271 // AddSctpDataContentForOffer depending on protocol.
272 // The codecs argument is ignored for SCTP.
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000273 bool AddDataContentForOffer(
zhihuang1c378ed2017-08-17 14:10:50 -0700274 const MediaDescriptionOptions& media_description_options,
275 const MediaSessionOptions& session_options,
276 const ContentInfo* current_content,
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000277 const SessionDescription* current_description,
Harald Alvestrand5fc28b12019-05-13 13:36:16 +0200278 const RtpDataCodecs& rtp_data_codecs,
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000279 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200280 SessionDescription* desc,
281 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000282
zhihuang1c378ed2017-08-17 14:10:50 -0700283 bool AddAudioContentForAnswer(
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 AudioCodecs& audio_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 AddVideoContentForAnswer(
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 VideoCodecs& video_codecs,
305 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200306 SessionDescription* answer,
307 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000308
zhihuang1c378ed2017-08-17 14:10:50 -0700309 bool AddDataContentForAnswer(
310 const MediaDescriptionOptions& media_description_options,
311 const MediaSessionOptions& session_options,
312 const ContentInfo* offer_content,
313 const SessionDescription* offer_description,
314 const ContentInfo* current_content,
315 const SessionDescription* current_description,
316 const TransportInfo* bundle_transport,
Harald Alvestrand5fc28b12019-05-13 13:36:16 +0200317 const RtpDataCodecs& rtp_data_codecs,
zhihuang1c378ed2017-08-17 14:10:50 -0700318 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 07:47:12 +0200319 SessionDescription* answer,
320 IceCredentialsIterator* ice_credentials) const;
zhihuang1c378ed2017-08-17 14:10:50 -0700321
322 void ComputeAudioCodecsIntersectionAndUnion();
jiayl@webrtc.orge7d47a12014-08-05 19:19:05 +0000323
Steve Anton8f66ddb2018-12-10 16:08:05 -0800324 bool is_unified_plan_ = false;
ossu075af922016-06-14 03:29:38 -0700325 AudioCodecs audio_send_codecs_;
326 AudioCodecs audio_recv_codecs_;
zhihuang1c378ed2017-08-17 14:10:50 -0700327 // Intersection of send and recv.
ossu075af922016-06-14 03:29:38 -0700328 AudioCodecs audio_sendrecv_codecs_;
zhihuang1c378ed2017-08-17 14:10:50 -0700329 // Union of send and recv.
330 AudioCodecs all_audio_codecs_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000331 RtpHeaderExtensions audio_rtp_extensions_;
332 VideoCodecs video_codecs_;
333 RtpHeaderExtensions video_rtp_extensions_;
Harald Alvestrand5fc28b12019-05-13 13:36:16 +0200334 RtpDataCodecs rtp_data_codecs_;
Amit Hilbuchbcd39d42019-01-25 17:13:56 -0800335 // This object is not owned by the channel so it must outlive it.
336 rtc::UniqueRandomIdGenerator* const ssrc_generator_;
jbauch5869f502017-06-29 12:31:36 -0700337 bool enable_encrypted_rtp_header_extensions_ = false;
zhihuang1c378ed2017-08-17 14:10:50 -0700338 // TODO(zhihuang): Rename secure_ to sdec_policy_; rename the related getter
339 // and setter.
340 SecurePolicy secure_ = SEC_DISABLED;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000341 const TransportDescriptionFactory* transport_desc_factory_;
342};
343
344// Convenience functions.
345bool IsMediaContent(const ContentInfo* content);
346bool IsAudioContent(const ContentInfo* content);
347bool IsVideoContent(const ContentInfo* content);
348bool IsDataContent(const ContentInfo* content);
deadbeef0ed85b22016-02-23 17:24:52 -0800349const ContentInfo* GetFirstMediaContent(const ContentInfos& contents,
350 MediaType media_type);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000351const ContentInfo* GetFirstAudioContent(const ContentInfos& contents);
352const ContentInfo* GetFirstVideoContent(const ContentInfos& contents);
353const ContentInfo* GetFirstDataContent(const ContentInfos& contents);
Steve Antonad7bffc2018-01-22 10:21:56 -0800354const ContentInfo* GetFirstMediaContent(const SessionDescription* sdesc,
355 MediaType media_type);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000356const ContentInfo* GetFirstAudioContent(const SessionDescription* sdesc);
357const ContentInfo* GetFirstVideoContent(const SessionDescription* sdesc);
358const ContentInfo* GetFirstDataContent(const SessionDescription* sdesc);
359const AudioContentDescription* GetFirstAudioContentDescription(
360 const SessionDescription* sdesc);
361const VideoContentDescription* GetFirstVideoContentDescription(
362 const SessionDescription* sdesc);
Harald Alvestrand5fc28b12019-05-13 13:36:16 +0200363const RtpDataContentDescription* GetFirstRtpDataContentDescription(
364 const SessionDescription* sdesc);
365const SctpDataContentDescription* GetFirstSctpDataContentDescription(
366 const SessionDescription* sdesc);
Taylor Brandstetterdc4eb8c2016-05-12 08:14:50 -0700367// Non-const versions of the above functions.
368// Useful when modifying an existing description.
Steve Anton36b29d12017-10-30 09:57:42 -0700369ContentInfo* GetFirstMediaContent(ContentInfos* contents, MediaType media_type);
370ContentInfo* GetFirstAudioContent(ContentInfos* contents);
371ContentInfo* GetFirstVideoContent(ContentInfos* contents);
372ContentInfo* GetFirstDataContent(ContentInfos* contents);
Steve Antonad7bffc2018-01-22 10:21:56 -0800373ContentInfo* GetFirstMediaContent(SessionDescription* sdesc,
374 MediaType media_type);
Taylor Brandstetterdc4eb8c2016-05-12 08:14:50 -0700375ContentInfo* GetFirstAudioContent(SessionDescription* sdesc);
376ContentInfo* GetFirstVideoContent(SessionDescription* sdesc);
377ContentInfo* GetFirstDataContent(SessionDescription* sdesc);
378AudioContentDescription* GetFirstAudioContentDescription(
379 SessionDescription* sdesc);
380VideoContentDescription* GetFirstVideoContentDescription(
381 SessionDescription* sdesc);
Harald Alvestrand5fc28b12019-05-13 13:36:16 +0200382RtpDataContentDescription* GetFirstRtpDataContentDescription(
383 SessionDescription* sdesc);
384SctpDataContentDescription* GetFirstSctpDataContentDescription(
385 SessionDescription* sdesc);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000386
deadbeef7914b8c2017-04-21 03:23:33 -0700387// Helper functions to return crypto suites used for SDES.
Benjamin Wrighta54daf12018-10-11 15:33:17 -0700388void GetSupportedAudioSdesCryptoSuites(
389 const webrtc::CryptoOptions& crypto_options,
390 std::vector<int>* crypto_suites);
391void GetSupportedVideoSdesCryptoSuites(
392 const webrtc::CryptoOptions& crypto_options,
393 std::vector<int>* crypto_suites);
394void GetSupportedDataSdesCryptoSuites(
395 const webrtc::CryptoOptions& crypto_options,
396 std::vector<int>* crypto_suites);
deadbeef7914b8c2017-04-21 03:23:33 -0700397void GetSupportedAudioSdesCryptoSuiteNames(
Benjamin Wrighta54daf12018-10-11 15:33:17 -0700398 const webrtc::CryptoOptions& crypto_options,
Guo-wei Shieh521ed7b2015-11-18 19:41:53 -0800399 std::vector<std::string>* crypto_suite_names);
deadbeef7914b8c2017-04-21 03:23:33 -0700400void GetSupportedVideoSdesCryptoSuiteNames(
Benjamin Wrighta54daf12018-10-11 15:33:17 -0700401 const webrtc::CryptoOptions& crypto_options,
Guo-wei Shieh521ed7b2015-11-18 19:41:53 -0800402 std::vector<std::string>* crypto_suite_names);
deadbeef7914b8c2017-04-21 03:23:33 -0700403void GetSupportedDataSdesCryptoSuiteNames(
Benjamin Wrighta54daf12018-10-11 15:33:17 -0700404 const webrtc::CryptoOptions& crypto_options,
Guo-wei Shieh521ed7b2015-11-18 19:41:53 -0800405 std::vector<std::string>* crypto_suite_names);
406
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000407} // namespace cricket
408
Steve Anton10542f22019-01-11 09:11:00 -0800409#endif // PC_MEDIA_SESSION_H_