blob: 9a67ad1e3cc6ba82299f6a96d3a2aed842fc26a4 [file] [log] [blame]
henrike@webrtc.org28e20752013-07-10 00:45:361/*
kjellander65c7f672016-02-12 08:05:012 * Copyright 2004 The WebRTC project authors. All Rights Reserved.
henrike@webrtc.org28e20752013-07-10 00:45:363 *
kjellander65c7f672016-02-12 08:05:014 * 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:369 */
10
11// Types and classes used in media session descriptions.
12
Steve Anton10542f22019-01-11 17:11:0013#ifndef PC_MEDIA_SESSION_H_
14#define PC_MEDIA_SESSION_H_
henrike@webrtc.org28e20752013-07-10 00:45:3615
deadbeef0ed85b22016-02-24 01:24:5216#include <map>
Steve Anton1a9d3c32018-12-11 01:18:5417#include <memory>
henrike@webrtc.org28e20752013-07-10 00:45:3618#include <string>
19#include <vector>
henrike@webrtc.org28e20752013-07-10 00:45:3620
Harald Alvestrand5761e7b2021-01-29 14:45:0821#include "api/crypto/crypto_options.h"
Jonas Orelande62c2f22022-03-29 09:04:4822#include "api/field_trials_view.h"
Steve Anton10542f22019-01-11 17:11:0023#include "api/media_types.h"
Harald Alvestrand5761e7b2021-01-29 14:45:0824#include "api/rtp_parameters.h"
25#include "api/rtp_transceiver_direction.h"
Steve Anton10542f22019-01-11 17:11:0026#include "media/base/media_constants.h"
Harald Alvestrand5761e7b2021-01-29 14:45:0827#include "media/base/rid_description.h"
28#include "media/base/stream_params.h"
Steve Anton10542f22019-01-11 17:11:0029#include "p2p/base/ice_credentials_iterator.h"
Harald Alvestrand5761e7b2021-01-29 14:45:0830#include "p2p/base/transport_description.h"
Steve Anton10542f22019-01-11 17:11:0031#include "p2p/base/transport_description_factory.h"
Harald Alvestrand5761e7b2021-01-29 14:45:0832#include "p2p/base/transport_info.h"
Steve Anton10542f22019-01-11 17:11:0033#include "pc/jsep_transport.h"
Harald Alvestrand5fc28b12019-05-13 11:36:1634#include "pc/media_protocol_names.h"
Steve Anton10542f22019-01-11 17:11:0035#include "pc/session_description.h"
Harald Alvestrand5761e7b2021-01-29 14:45:0836#include "pc/simulcast_description.h"
Amit Hilbuchbcd39d42019-01-26 01:13:5637#include "rtc_base/unique_id_generator.h"
henrike@webrtc.org28e20752013-07-10 00:45:3638
Jonas Orelanded99dae2022-03-09 08:28:1039namespace webrtc {
40
41// Forward declaration due to circular dependecy.
42class ConnectionContext;
43
44} // namespace webrtc
45
henrike@webrtc.org28e20752013-07-10 00:45:3646namespace cricket {
47
48class ChannelManager;
henrike@webrtc.org28e20752013-07-10 00:45:3649
zhihuang8f65cdf2016-05-07 01:40:3050// Default RTCP CNAME for unit tests.
51const char kDefaultRtcpCname[] = "DefaultRtcpCname";
52
zhihuang1c378ed2017-08-17 21:10:5053// Options for an RtpSender contained with an media description/"m=" section.
Amit Hilbuchc63ddb22019-01-02 18:13:5854// Note: Spec-compliant Simulcast and legacy simulcast are mutually exclusive.
zhihuang1c378ed2017-08-17 21:10:5055struct SenderOptions {
56 std::string track_id;
Steve Anton8ffb9c32017-08-31 22:45:3857 std::vector<std::string> stream_ids;
Amit Hilbuchc63ddb22019-01-02 18:13:5858 // Use RIDs and Simulcast Layers to indicate spec-compliant Simulcast.
59 std::vector<RidDescription> rids;
60 SimulcastLayerList simulcast_layers;
Artem Titov880fa812021-07-30 20:30:2361 // Use `num_sim_layers` to indicate legacy simulcast.
zhihuang1c378ed2017-08-17 21:10:5062 int num_sim_layers;
63};
jiayl@webrtc.org742922b2014-10-07 21:32:4364
zhihuang1c378ed2017-08-17 21:10:5065// Options for an individual media description/"m=" section.
66struct MediaDescriptionOptions {
67 MediaDescriptionOptions(MediaType type,
68 const std::string& mid,
Steve Anton1d03a752017-11-27 22:30:0969 webrtc::RtpTransceiverDirection direction,
zhihuang1c378ed2017-08-17 21:10:5070 bool stopped)
71 : type(type), mid(mid), direction(direction), stopped(stopped) {}
zhihuanga77e6bb2017-08-15 01:17:4872
zhihuang1c378ed2017-08-17 21:10:5073 // TODO(deadbeef): When we don't support Plan B, there will only be one
74 // sender per media description and this can be simplified.
75 void AddAudioSender(const std::string& track_id,
Steve Anton8ffb9c32017-08-31 22:45:3876 const std::vector<std::string>& stream_ids);
zhihuang1c378ed2017-08-17 21:10:5077 void AddVideoSender(const std::string& track_id,
Steve Anton8ffb9c32017-08-31 22:45:3878 const std::vector<std::string>& stream_ids,
Amit Hilbuchc63ddb22019-01-02 18:13:5879 const std::vector<RidDescription>& rids,
80 const SimulcastLayerList& simulcast_layers,
olka3c747662017-08-17 13:50:3281 int num_sim_layers);
zhihuanga77e6bb2017-08-15 01:17:4882
zhihuang1c378ed2017-08-17 21:10:5083 MediaType type;
84 std::string mid;
Steve Anton1d03a752017-11-27 22:30:0985 webrtc::RtpTransceiverDirection direction;
zhihuang1c378ed2017-08-17 21:10:5086 bool stopped;
87 TransportOptions transport_options;
88 // Note: There's no equivalent "RtpReceiverOptions" because only send
89 // stream information goes in the local descriptions.
90 std::vector<SenderOptions> sender_options;
Florent Castelli2d9d82e2019-04-23 17:25:5191 std::vector<webrtc::RtpCodecCapability> codec_preferences;
Markus Handell755c65d2020-06-23 23:06:1092 std::vector<webrtc::RtpHeaderExtensionCapability> header_extensions;
zhihuang1c378ed2017-08-17 21:10:5093
94 private:
Artem Titov880fa812021-07-30 20:30:2395 // Doesn't DCHECK on `type`.
zhihuang1c378ed2017-08-17 21:10:5096 void AddSenderInternal(const std::string& track_id,
Steve Anton8ffb9c32017-08-31 22:45:3897 const std::vector<std::string>& stream_ids,
Amit Hilbuchc63ddb22019-01-02 18:13:5898 const std::vector<RidDescription>& rids,
99 const SimulcastLayerList& simulcast_layers,
olka3c747662017-08-17 13:50:32100 int num_sim_layers);
zhihuang1c378ed2017-08-17 21:10:50101};
olka3c747662017-08-17 13:50:32102
zhihuang1c378ed2017-08-17 21:10:50103// Provides a mechanism for describing how m= sections should be generated.
104// The m= section with index X will use media_description_options[X]. There
105// must be an option for each existing section if creating an answer, or a
106// subsequent offer.
107struct MediaSessionOptions {
108 MediaSessionOptions() {}
olka3c747662017-08-17 13:50:32109
zhihuang1c378ed2017-08-17 21:10:50110 bool has_audio() const { return HasMediaDescription(MEDIA_TYPE_AUDIO); }
111 bool has_video() const { return HasMediaDescription(MEDIA_TYPE_VIDEO); }
112 bool has_data() const { return HasMediaDescription(MEDIA_TYPE_DATA); }
113
114 bool HasMediaDescription(MediaType type) const;
115
zhihuang1c378ed2017-08-17 21:10:50116 bool vad_enabled = true; // When disabled, removes all CN codecs from SDP.
117 bool rtcp_mux_enabled = true;
118 bool bundle_enabled = false;
Johannes Kron89f874e2018-11-12 09:25:48119 bool offer_extmap_allow_mixed = false;
Mirta Dvornicic479a3c02019-06-04 13:38:50120 bool raw_packetization_for_video = false;
zhihuang1c378ed2017-08-17 21:10:50121 std::string rtcp_cname = kDefaultRtcpCname;
Benjamin Wrighta54daf12018-10-11 22:33:17122 webrtc::CryptoOptions crypto_options;
zhihuang1c378ed2017-08-17 21:10:50123 // List of media description options in the same order that the media
124 // descriptions will be generated.
125 std::vector<MediaDescriptionOptions> media_description_options;
Jonas Oreland1cd39fa2018-10-11 05:47:12126 std::vector<IceParameters> pooled_ice_credentials;
Piotr (Peter) Slatalab1ae10b2019-03-01 19:14:05127
Harald Alvestrand4aa11922019-05-14 20:00:01128 // Use the draft-ietf-mmusic-sctp-sdp-03 obsolete syntax for SCTP
129 // datachannels.
130 // Default is true for backwards compatibility with clients that use
131 // this internal interface.
132 bool use_obsolete_sctp_sdp = true;
henrike@webrtc.org28e20752013-07-10 00:45:36133};
134
henrike@webrtc.org28e20752013-07-10 00:45:36135// Creates media session descriptions according to the supplied codecs and
136// other fields, as well as the supplied per-call options.
137// When creating answers, performs the appropriate negotiation
138// of the various fields to determine the proper result.
139class MediaSessionDescriptionFactory {
140 public:
Amit Hilbuchbcd39d42019-01-26 01:13:56141 // Simple constructor that does not set any configuration for the factory.
142 // When using this constructor, the methods below can be used to set the
143 // configuration.
144 // The TransportDescriptionFactory and the UniqueRandomIdGenerator are not
145 // owned by MediaSessionDescriptionFactory, so they must be kept alive by the
146 // user of this class.
147 MediaSessionDescriptionFactory(const TransportDescriptionFactory* factory,
148 rtc::UniqueRandomIdGenerator* ssrc_generator);
henrike@webrtc.org28e20752013-07-10 00:45:36149 // This helper automatically sets up the factory to get its configuration
150 // from the specified ChannelManager.
151 MediaSessionDescriptionFactory(ChannelManager* cmanager,
Tomas Gunnarsson5411b172022-01-24 07:45:26152 const TransportDescriptionFactory* factory);
henrike@webrtc.org28e20752013-07-10 00:45:36153
ossudedfd282016-06-14 14:12:39154 const AudioCodecs& audio_sendrecv_codecs() const;
ossu075af922016-06-14 10:29:38155 const AudioCodecs& audio_send_codecs() const;
156 const AudioCodecs& audio_recv_codecs() const;
157 void set_audio_codecs(const AudioCodecs& send_codecs,
158 const AudioCodecs& recv_codecs);
Johannes Kron3e983682020-03-29 20:17:00159 const VideoCodecs& video_sendrecv_codecs() const;
160 const VideoCodecs& video_send_codecs() const;
161 const VideoCodecs& video_recv_codecs() const;
162 void set_video_codecs(const VideoCodecs& send_codecs,
163 const VideoCodecs& recv_codecs);
Markus Handell755c65d2020-06-23 23:06:10164 RtpHeaderExtensions filtered_rtp_header_extensions(
165 RtpHeaderExtensions extensions) const;
Harald Alvestrand0d018412021-11-04 13:52:31166 SecurePolicy secure() const { return secure_; }
167 void set_secure(SecurePolicy s) { secure_ = s; }
henrike@webrtc.org28e20752013-07-10 00:45:36168
jbauch5869f502017-06-29 19:31:36169 void set_enable_encrypted_rtp_header_extensions(bool enable) {
170 enable_encrypted_rtp_header_extensions_ = enable;
171 }
172
Steve Anton8f66ddb2018-12-11 00:08:05173 void set_is_unified_plan(bool is_unified_plan) {
174 is_unified_plan_ = is_unified_plan;
175 }
176
Steve Anton6fe1fba2018-12-11 18:15:23177 std::unique_ptr<SessionDescription> CreateOffer(
henrike@webrtc.org28e20752013-07-10 00:45:36178 const MediaSessionOptions& options,
179 const SessionDescription* current_description) const;
Steve Anton6fe1fba2018-12-11 18:15:23180 std::unique_ptr<SessionDescription> CreateAnswer(
zstein4b2e0822017-02-18 03:48:38181 const SessionDescription* offer,
182 const MediaSessionOptions& options,
183 const SessionDescription* current_description) const;
henrike@webrtc.org28e20752013-07-10 00:45:36184
185 private:
Markus Handell755c65d2020-06-23 23:06:10186 struct AudioVideoRtpHeaderExtensions {
187 RtpHeaderExtensions audio;
188 RtpHeaderExtensions video;
189 };
190
ossu075af922016-06-14 10:29:38191 const AudioCodecs& GetAudioCodecsForOffer(
Steve Anton1d03a752017-11-27 22:30:09192 const webrtc::RtpTransceiverDirection& direction) const;
ossu075af922016-06-14 10:29:38193 const AudioCodecs& GetAudioCodecsForAnswer(
Steve Anton1d03a752017-11-27 22:30:09194 const webrtc::RtpTransceiverDirection& offer,
195 const webrtc::RtpTransceiverDirection& answer) const;
Johannes Kron3e983682020-03-29 20:17:00196 const VideoCodecs& GetVideoCodecsForOffer(
197 const webrtc::RtpTransceiverDirection& direction) const;
198 const VideoCodecs& GetVideoCodecsForAnswer(
199 const webrtc::RtpTransceiverDirection& offer,
200 const webrtc::RtpTransceiverDirection& answer) const;
Steve Anton5c72e712018-12-10 22:25:30201 void GetCodecsForOffer(
202 const std::vector<const ContentInfo*>& current_active_contents,
203 AudioCodecs* audio_codecs,
Harald Alvestrand7af57c62021-04-16 11:12:14204 VideoCodecs* video_codecs) const;
Steve Anton5c72e712018-12-10 22:25:30205 void GetCodecsForAnswer(
206 const std::vector<const ContentInfo*>& current_active_contents,
207 const SessionDescription& remote_offer,
208 AudioCodecs* audio_codecs,
Harald Alvestrand7af57c62021-04-16 11:12:14209 VideoCodecs* video_codecs) const;
Markus Handell755c65d2020-06-23 23:06:10210 AudioVideoRtpHeaderExtensions GetOfferedRtpHeaderExtensionsWithIds(
Steve Anton5c72e712018-12-10 22:25:30211 const std::vector<const ContentInfo*>& current_active_contents,
Johannes Kron746dd0d2019-06-20 13:37:52212 bool extmap_allow_mixed,
Markus Handell755c65d2020-06-23 23:06:10213 const std::vector<MediaDescriptionOptions>& media_description_options)
214 const;
Yves Gerey665174f2018-06-19 13:03:05215 bool AddTransportOffer(const std::string& content_name,
216 const TransportOptions& transport_options,
217 const SessionDescription* current_desc,
Jonas Oreland1cd39fa2018-10-11 05:47:12218 SessionDescription* offer,
219 IceCredentialsIterator* ice_credentials) const;
henrike@webrtc.org28e20752013-07-10 00:45:36220
Steve Anton1a9d3c32018-12-11 01:18:54221 std::unique_ptr<TransportDescription> CreateTransportAnswer(
henrike@webrtc.org28e20752013-07-10 00:45:36222 const std::string& content_name,
223 const SessionDescription* offer_desc,
224 const TransportOptions& transport_options,
deadbeefb7892532017-02-23 03:35:18225 const SessionDescription* current_desc,
Jonas Oreland1cd39fa2018-10-11 05:47:12226 bool require_transport_attributes,
227 IceCredentialsIterator* ice_credentials) const;
henrike@webrtc.org28e20752013-07-10 00:45:36228
Yves Gerey665174f2018-06-19 13:03:05229 bool AddTransportAnswer(const std::string& content_name,
230 const TransportDescription& transport_desc,
231 SessionDescription* answer_desc) const;
henrike@webrtc.org28e20752013-07-10 00:45:36232
jiayl@webrtc.orge7d47a12014-08-05 19:19:05233 // Helpers for adding media contents to the SessionDescription. Returns true
234 // it succeeds or the media content is not needed, or false if there is any
235 // error.
236
237 bool AddAudioContentForOffer(
zhihuang1c378ed2017-08-17 21:10:50238 const MediaDescriptionOptions& media_description_options,
239 const MediaSessionOptions& session_options,
240 const ContentInfo* current_content,
jiayl@webrtc.orge7d47a12014-08-05 19:19:05241 const SessionDescription* current_description,
242 const RtpHeaderExtensions& audio_rtp_extensions,
243 const AudioCodecs& audio_codecs,
244 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 05:47:12245 SessionDescription* desc,
246 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05247
248 bool AddVideoContentForOffer(
zhihuang1c378ed2017-08-17 21:10:50249 const MediaDescriptionOptions& media_description_options,
250 const MediaSessionOptions& session_options,
251 const ContentInfo* current_content,
jiayl@webrtc.orge7d47a12014-08-05 19:19:05252 const SessionDescription* current_description,
253 const RtpHeaderExtensions& video_rtp_extensions,
254 const VideoCodecs& video_codecs,
255 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 05:47:12256 SessionDescription* desc,
257 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05258
259 bool AddDataContentForOffer(
zhihuang1c378ed2017-08-17 21:10:50260 const MediaDescriptionOptions& media_description_options,
261 const MediaSessionOptions& session_options,
262 const ContentInfo* current_content,
jiayl@webrtc.orge7d47a12014-08-05 19:19:05263 const SessionDescription* current_description,
jiayl@webrtc.orge7d47a12014-08-05 19:19:05264 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 05:47:12265 SessionDescription* desc,
266 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05267
Philipp Hancke4e8c1152020-10-13 10:43:15268 bool AddUnsupportedContentForOffer(
269 const MediaDescriptionOptions& media_description_options,
270 const MediaSessionOptions& session_options,
271 const ContentInfo* current_content,
272 const SessionDescription* current_description,
273 SessionDescription* desc,
274 IceCredentialsIterator* ice_credentials) const;
275
zhihuang1c378ed2017-08-17 21:10:50276 bool AddAudioContentForAnswer(
277 const MediaDescriptionOptions& media_description_options,
278 const MediaSessionOptions& session_options,
279 const ContentInfo* offer_content,
280 const SessionDescription* offer_description,
281 const ContentInfo* current_content,
282 const SessionDescription* current_description,
283 const TransportInfo* bundle_transport,
284 const AudioCodecs& audio_codecs,
Markus Handell755c65d2020-06-23 23:06:10285 const RtpHeaderExtensions& default_audio_rtp_header_extensions,
zhihuang1c378ed2017-08-17 21:10:50286 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 05:47:12287 SessionDescription* answer,
288 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05289
zhihuang1c378ed2017-08-17 21:10:50290 bool AddVideoContentForAnswer(
291 const MediaDescriptionOptions& media_description_options,
292 const MediaSessionOptions& session_options,
293 const ContentInfo* offer_content,
294 const SessionDescription* offer_description,
295 const ContentInfo* current_content,
296 const SessionDescription* current_description,
297 const TransportInfo* bundle_transport,
298 const VideoCodecs& video_codecs,
Markus Handell755c65d2020-06-23 23:06:10299 const RtpHeaderExtensions& default_video_rtp_header_extensions,
zhihuang1c378ed2017-08-17 21:10:50300 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 05:47:12301 SessionDescription* answer,
302 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05303
zhihuang1c378ed2017-08-17 21:10:50304 bool AddDataContentForAnswer(
305 const MediaDescriptionOptions& media_description_options,
306 const MediaSessionOptions& session_options,
307 const ContentInfo* offer_content,
308 const SessionDescription* offer_description,
309 const ContentInfo* current_content,
310 const SessionDescription* current_description,
311 const TransportInfo* bundle_transport,
zhihuang1c378ed2017-08-17 21:10:50312 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 05:47:12313 SessionDescription* answer,
314 IceCredentialsIterator* ice_credentials) const;
zhihuang1c378ed2017-08-17 21:10:50315
Philipp Hancke4e8c1152020-10-13 10:43:15316 bool AddUnsupportedContentForAnswer(
317 const MediaDescriptionOptions& media_description_options,
318 const MediaSessionOptions& session_options,
319 const ContentInfo* offer_content,
320 const SessionDescription* offer_description,
321 const ContentInfo* current_content,
322 const SessionDescription* current_description,
323 const TransportInfo* bundle_transport,
324 SessionDescription* answer,
325 IceCredentialsIterator* ice_credentials) const;
326
zhihuang1c378ed2017-08-17 21:10:50327 void ComputeAudioCodecsIntersectionAndUnion();
jiayl@webrtc.orge7d47a12014-08-05 19:19:05328
Johannes Kron3e983682020-03-29 20:17:00329 void ComputeVideoCodecsIntersectionAndUnion();
330
Steve Anton8f66ddb2018-12-11 00:08:05331 bool is_unified_plan_ = false;
ossu075af922016-06-14 10:29:38332 AudioCodecs audio_send_codecs_;
333 AudioCodecs audio_recv_codecs_;
zhihuang1c378ed2017-08-17 21:10:50334 // Intersection of send and recv.
ossu075af922016-06-14 10:29:38335 AudioCodecs audio_sendrecv_codecs_;
zhihuang1c378ed2017-08-17 21:10:50336 // Union of send and recv.
337 AudioCodecs all_audio_codecs_;
Johannes Kron3e983682020-03-29 20:17:00338 VideoCodecs video_send_codecs_;
339 VideoCodecs video_recv_codecs_;
340 // Intersection of send and recv.
341 VideoCodecs video_sendrecv_codecs_;
342 // Union of send and recv.
343 VideoCodecs all_video_codecs_;
Artem Titovc6c02ef2022-05-09 08:30:09344 // This object is not owned by the channel so it must outlive it.
345 rtc::UniqueRandomIdGenerator* const ssrc_generator_;
jbauch5869f502017-06-29 19:31:36346 bool enable_encrypted_rtp_header_extensions_ = false;
Harald Alvestrand0d018412021-11-04 13:52:31347 // TODO(zhihuang): Rename secure_ to sdec_policy_; rename the related getter
348 // and setter.
349 SecurePolicy secure_ = SEC_DISABLED;
henrike@webrtc.org28e20752013-07-10 00:45:36350 const TransportDescriptionFactory* transport_desc_factory_;
351};
352
353// Convenience functions.
354bool IsMediaContent(const ContentInfo* content);
355bool IsAudioContent(const ContentInfo* content);
356bool IsVideoContent(const ContentInfo* content);
357bool IsDataContent(const ContentInfo* content);
Philipp Hancke4e8c1152020-10-13 10:43:15358bool IsUnsupportedContent(const ContentInfo* content);
deadbeef0ed85b22016-02-24 01:24:52359const ContentInfo* GetFirstMediaContent(const ContentInfos& contents,
360 MediaType media_type);
henrike@webrtc.org28e20752013-07-10 00:45:36361const ContentInfo* GetFirstAudioContent(const ContentInfos& contents);
362const ContentInfo* GetFirstVideoContent(const ContentInfos& contents);
363const ContentInfo* GetFirstDataContent(const ContentInfos& contents);
Steve Antonad7bffc2018-01-22 18:21:56364const ContentInfo* GetFirstMediaContent(const SessionDescription* sdesc,
365 MediaType media_type);
henrike@webrtc.org28e20752013-07-10 00:45:36366const ContentInfo* GetFirstAudioContent(const SessionDescription* sdesc);
367const ContentInfo* GetFirstVideoContent(const SessionDescription* sdesc);
368const ContentInfo* GetFirstDataContent(const SessionDescription* sdesc);
369const AudioContentDescription* GetFirstAudioContentDescription(
370 const SessionDescription* sdesc);
371const VideoContentDescription* GetFirstVideoContentDescription(
372 const SessionDescription* sdesc);
Harald Alvestrand5fc28b12019-05-13 11:36:16373const SctpDataContentDescription* GetFirstSctpDataContentDescription(
374 const SessionDescription* sdesc);
Taylor Brandstetterdc4eb8c2016-05-12 15:14:50375// Non-const versions of the above functions.
376// Useful when modifying an existing description.
Steve Anton36b29d12017-10-30 16:57:42377ContentInfo* GetFirstMediaContent(ContentInfos* contents, MediaType media_type);
378ContentInfo* GetFirstAudioContent(ContentInfos* contents);
379ContentInfo* GetFirstVideoContent(ContentInfos* contents);
380ContentInfo* GetFirstDataContent(ContentInfos* contents);
Steve Antonad7bffc2018-01-22 18:21:56381ContentInfo* GetFirstMediaContent(SessionDescription* sdesc,
382 MediaType media_type);
Taylor Brandstetterdc4eb8c2016-05-12 15:14:50383ContentInfo* GetFirstAudioContent(SessionDescription* sdesc);
384ContentInfo* GetFirstVideoContent(SessionDescription* sdesc);
385ContentInfo* GetFirstDataContent(SessionDescription* sdesc);
386AudioContentDescription* GetFirstAudioContentDescription(
387 SessionDescription* sdesc);
388VideoContentDescription* GetFirstVideoContentDescription(
389 SessionDescription* sdesc);
Harald Alvestrand5fc28b12019-05-13 11:36:16390SctpDataContentDescription* GetFirstSctpDataContentDescription(
391 SessionDescription* sdesc);
henrike@webrtc.org28e20752013-07-10 00:45:36392
Harald Alvestrand0d018412021-11-04 13:52:31393// Helper functions to return crypto suites used for SDES.
394void GetSupportedAudioSdesCryptoSuites(
395 const webrtc::CryptoOptions& crypto_options,
396 std::vector<int>* crypto_suites);
397void GetSupportedVideoSdesCryptoSuites(
398 const webrtc::CryptoOptions& crypto_options,
399 std::vector<int>* crypto_suites);
400void GetSupportedDataSdesCryptoSuites(
401 const webrtc::CryptoOptions& crypto_options,
402 std::vector<int>* crypto_suites);
403void GetSupportedAudioSdesCryptoSuiteNames(
404 const webrtc::CryptoOptions& crypto_options,
405 std::vector<std::string>* crypto_suite_names);
406void GetSupportedVideoSdesCryptoSuiteNames(
407 const webrtc::CryptoOptions& crypto_options,
408 std::vector<std::string>* crypto_suite_names);
409void GetSupportedDataSdesCryptoSuiteNames(
410 const webrtc::CryptoOptions& crypto_options,
411 std::vector<std::string>* crypto_suite_names);
412
henrike@webrtc.org28e20752013-07-10 00:45:36413} // namespace cricket
414
Steve Anton10542f22019-01-11 17:11:00415#endif // PC_MEDIA_SESSION_H_