blob: 87f04c779fee5573043b79afdf693891fbe73630 [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"
Harald Alvestrand8101e7b2022-05-23 14:57:4737#include "rtc_base/memory/always_valid_pointer.h"
Amit Hilbuchbcd39d42019-01-26 01:13:5638#include "rtc_base/unique_id_generator.h"
henrike@webrtc.org28e20752013-07-10 00:45:3639
Jonas Orelanded99dae2022-03-09 08:28:1040namespace webrtc {
41
42// Forward declaration due to circular dependecy.
43class ConnectionContext;
44
45} // namespace webrtc
46
henrike@webrtc.org28e20752013-07-10 00:45:3647namespace cricket {
48
Harald Alvestrandc3fa7c32022-05-22 10:57:0149class MediaEngineInterface;
henrike@webrtc.org28e20752013-07-10 00:45:3650
zhihuang8f65cdf2016-05-07 01:40:3051// Default RTCP CNAME for unit tests.
52const char kDefaultRtcpCname[] = "DefaultRtcpCname";
53
zhihuang1c378ed2017-08-17 21:10:5054// Options for an RtpSender contained with an media description/"m=" section.
Amit Hilbuchc63ddb22019-01-02 18:13:5855// Note: Spec-compliant Simulcast and legacy simulcast are mutually exclusive.
zhihuang1c378ed2017-08-17 21:10:5056struct SenderOptions {
57 std::string track_id;
Steve Anton8ffb9c32017-08-31 22:45:3858 std::vector<std::string> stream_ids;
Amit Hilbuchc63ddb22019-01-02 18:13:5859 // Use RIDs and Simulcast Layers to indicate spec-compliant Simulcast.
60 std::vector<RidDescription> rids;
61 SimulcastLayerList simulcast_layers;
Artem Titov880fa812021-07-30 20:30:2362 // Use `num_sim_layers` to indicate legacy simulcast.
zhihuang1c378ed2017-08-17 21:10:5063 int num_sim_layers;
64};
jiayl@webrtc.org742922b2014-10-07 21:32:4365
zhihuang1c378ed2017-08-17 21:10:5066// Options for an individual media description/"m=" section.
67struct MediaDescriptionOptions {
68 MediaDescriptionOptions(MediaType type,
69 const std::string& mid,
Steve Anton1d03a752017-11-27 22:30:0970 webrtc::RtpTransceiverDirection direction,
zhihuang1c378ed2017-08-17 21:10:5071 bool stopped)
72 : type(type), mid(mid), direction(direction), stopped(stopped) {}
zhihuanga77e6bb2017-08-15 01:17:4873
zhihuang1c378ed2017-08-17 21:10:5074 // TODO(deadbeef): When we don't support Plan B, there will only be one
75 // sender per media description and this can be simplified.
76 void AddAudioSender(const std::string& track_id,
Steve Anton8ffb9c32017-08-31 22:45:3877 const std::vector<std::string>& stream_ids);
zhihuang1c378ed2017-08-17 21:10:5078 void AddVideoSender(const std::string& track_id,
Steve Anton8ffb9c32017-08-31 22:45:3879 const std::vector<std::string>& stream_ids,
Amit Hilbuchc63ddb22019-01-02 18:13:5880 const std::vector<RidDescription>& rids,
81 const SimulcastLayerList& simulcast_layers,
olka3c747662017-08-17 13:50:3282 int num_sim_layers);
zhihuanga77e6bb2017-08-15 01:17:4883
zhihuang1c378ed2017-08-17 21:10:5084 MediaType type;
85 std::string mid;
Steve Anton1d03a752017-11-27 22:30:0986 webrtc::RtpTransceiverDirection direction;
zhihuang1c378ed2017-08-17 21:10:5087 bool stopped;
88 TransportOptions transport_options;
89 // Note: There's no equivalent "RtpReceiverOptions" because only send
90 // stream information goes in the local descriptions.
91 std::vector<SenderOptions> sender_options;
Florent Castelli2d9d82e2019-04-23 17:25:5192 std::vector<webrtc::RtpCodecCapability> codec_preferences;
Markus Handell755c65d2020-06-23 23:06:1093 std::vector<webrtc::RtpHeaderExtensionCapability> header_extensions;
zhihuang1c378ed2017-08-17 21:10:5094
95 private:
Artem Titov880fa812021-07-30 20:30:2396 // Doesn't DCHECK on `type`.
zhihuang1c378ed2017-08-17 21:10:5097 void AddSenderInternal(const std::string& track_id,
Steve Anton8ffb9c32017-08-31 22:45:3898 const std::vector<std::string>& stream_ids,
Amit Hilbuchc63ddb22019-01-02 18:13:5899 const std::vector<RidDescription>& rids,
100 const SimulcastLayerList& simulcast_layers,
olka3c747662017-08-17 13:50:32101 int num_sim_layers);
zhihuang1c378ed2017-08-17 21:10:50102};
olka3c747662017-08-17 13:50:32103
zhihuang1c378ed2017-08-17 21:10:50104// Provides a mechanism for describing how m= sections should be generated.
105// The m= section with index X will use media_description_options[X]. There
106// must be an option for each existing section if creating an answer, or a
107// subsequent offer.
108struct MediaSessionOptions {
109 MediaSessionOptions() {}
olka3c747662017-08-17 13:50:32110
zhihuang1c378ed2017-08-17 21:10:50111 bool has_audio() const { return HasMediaDescription(MEDIA_TYPE_AUDIO); }
112 bool has_video() const { return HasMediaDescription(MEDIA_TYPE_VIDEO); }
113 bool has_data() const { return HasMediaDescription(MEDIA_TYPE_DATA); }
114
115 bool HasMediaDescription(MediaType type) const;
116
zhihuang1c378ed2017-08-17 21:10:50117 bool vad_enabled = true; // When disabled, removes all CN codecs from SDP.
118 bool rtcp_mux_enabled = true;
119 bool bundle_enabled = false;
Johannes Kron89f874e2018-11-12 09:25:48120 bool offer_extmap_allow_mixed = false;
Mirta Dvornicic479a3c02019-06-04 13:38:50121 bool raw_packetization_for_video = false;
zhihuang1c378ed2017-08-17 21:10:50122 std::string rtcp_cname = kDefaultRtcpCname;
Benjamin Wrighta54daf12018-10-11 22:33:17123 webrtc::CryptoOptions crypto_options;
zhihuang1c378ed2017-08-17 21:10:50124 // List of media description options in the same order that the media
125 // descriptions will be generated.
126 std::vector<MediaDescriptionOptions> media_description_options;
Jonas Oreland1cd39fa2018-10-11 05:47:12127 std::vector<IceParameters> pooled_ice_credentials;
Piotr (Peter) Slatalab1ae10b2019-03-01 19:14:05128
Harald Alvestrand4aa11922019-05-14 20:00:01129 // Use the draft-ietf-mmusic-sctp-sdp-03 obsolete syntax for SCTP
130 // datachannels.
131 // Default is true for backwards compatibility with clients that use
132 // this internal interface.
133 bool use_obsolete_sctp_sdp = true;
henrike@webrtc.org28e20752013-07-10 00:45:36134};
135
henrike@webrtc.org28e20752013-07-10 00:45:36136// Creates media session descriptions according to the supplied codecs and
137// other fields, as well as the supplied per-call options.
138// When creating answers, performs the appropriate negotiation
139// of the various fields to determine the proper result.
140class MediaSessionDescriptionFactory {
141 public:
Amit Hilbuchbcd39d42019-01-26 01:13:56142 // Simple constructor that does not set any configuration for the factory.
143 // When using this constructor, the methods below can be used to set the
144 // configuration.
145 // The TransportDescriptionFactory and the UniqueRandomIdGenerator are not
146 // owned by MediaSessionDescriptionFactory, so they must be kept alive by the
147 // user of this class.
148 MediaSessionDescriptionFactory(const TransportDescriptionFactory* factory,
149 rtc::UniqueRandomIdGenerator* ssrc_generator);
henrike@webrtc.org28e20752013-07-10 00:45:36150 // This helper automatically sets up the factory to get its configuration
Harald Alvestrandc3fa7c32022-05-22 10:57:01151 // from the specified MediaEngine
152 MediaSessionDescriptionFactory(cricket::MediaEngineInterface* media_engine,
153 bool rtx_enabled,
154 rtc::UniqueRandomIdGenerator* ssrc_generator,
Tomas Gunnarsson5411b172022-01-24 07:45:26155 const TransportDescriptionFactory* factory);
henrike@webrtc.org28e20752013-07-10 00:45:36156
ossudedfd282016-06-14 14:12:39157 const AudioCodecs& audio_sendrecv_codecs() const;
ossu075af922016-06-14 10:29:38158 const AudioCodecs& audio_send_codecs() const;
159 const AudioCodecs& audio_recv_codecs() const;
160 void set_audio_codecs(const AudioCodecs& send_codecs,
161 const AudioCodecs& recv_codecs);
Johannes Kron3e983682020-03-29 20:17:00162 const VideoCodecs& video_sendrecv_codecs() const;
163 const VideoCodecs& video_send_codecs() const;
164 const VideoCodecs& video_recv_codecs() const;
165 void set_video_codecs(const VideoCodecs& send_codecs,
166 const VideoCodecs& recv_codecs);
Markus Handell755c65d2020-06-23 23:06:10167 RtpHeaderExtensions filtered_rtp_header_extensions(
168 RtpHeaderExtensions extensions) const;
Harald Alvestrand0d018412021-11-04 13:52:31169 SecurePolicy secure() const { return secure_; }
170 void set_secure(SecurePolicy s) { secure_ = s; }
henrike@webrtc.org28e20752013-07-10 00:45:36171
jbauch5869f502017-06-29 19:31:36172 void set_enable_encrypted_rtp_header_extensions(bool enable) {
173 enable_encrypted_rtp_header_extensions_ = enable;
174 }
175
Steve Anton8f66ddb2018-12-11 00:08:05176 void set_is_unified_plan(bool is_unified_plan) {
177 is_unified_plan_ = is_unified_plan;
178 }
179
Steve Anton6fe1fba2018-12-11 18:15:23180 std::unique_ptr<SessionDescription> CreateOffer(
henrike@webrtc.org28e20752013-07-10 00:45:36181 const MediaSessionOptions& options,
182 const SessionDescription* current_description) const;
Steve Anton6fe1fba2018-12-11 18:15:23183 std::unique_ptr<SessionDescription> CreateAnswer(
zstein4b2e0822017-02-18 03:48:38184 const SessionDescription* offer,
185 const MediaSessionOptions& options,
186 const SessionDescription* current_description) const;
henrike@webrtc.org28e20752013-07-10 00:45:36187
188 private:
Markus Handell755c65d2020-06-23 23:06:10189 struct AudioVideoRtpHeaderExtensions {
190 RtpHeaderExtensions audio;
191 RtpHeaderExtensions video;
192 };
193
ossu075af922016-06-14 10:29:38194 const AudioCodecs& GetAudioCodecsForOffer(
Steve Anton1d03a752017-11-27 22:30:09195 const webrtc::RtpTransceiverDirection& direction) const;
ossu075af922016-06-14 10:29:38196 const AudioCodecs& GetAudioCodecsForAnswer(
Steve Anton1d03a752017-11-27 22:30:09197 const webrtc::RtpTransceiverDirection& offer,
198 const webrtc::RtpTransceiverDirection& answer) const;
Johannes Kron3e983682020-03-29 20:17:00199 const VideoCodecs& GetVideoCodecsForOffer(
200 const webrtc::RtpTransceiverDirection& direction) const;
201 const VideoCodecs& GetVideoCodecsForAnswer(
202 const webrtc::RtpTransceiverDirection& offer,
203 const webrtc::RtpTransceiverDirection& answer) const;
Steve Anton5c72e712018-12-10 22:25:30204 void GetCodecsForOffer(
205 const std::vector<const ContentInfo*>& current_active_contents,
206 AudioCodecs* audio_codecs,
Harald Alvestrand7af57c62021-04-16 11:12:14207 VideoCodecs* video_codecs) const;
Steve Anton5c72e712018-12-10 22:25:30208 void GetCodecsForAnswer(
209 const std::vector<const ContentInfo*>& current_active_contents,
210 const SessionDescription& remote_offer,
211 AudioCodecs* audio_codecs,
Harald Alvestrand7af57c62021-04-16 11:12:14212 VideoCodecs* video_codecs) const;
Markus Handell755c65d2020-06-23 23:06:10213 AudioVideoRtpHeaderExtensions GetOfferedRtpHeaderExtensionsWithIds(
Steve Anton5c72e712018-12-10 22:25:30214 const std::vector<const ContentInfo*>& current_active_contents,
Johannes Kron746dd0d2019-06-20 13:37:52215 bool extmap_allow_mixed,
Markus Handell755c65d2020-06-23 23:06:10216 const std::vector<MediaDescriptionOptions>& media_description_options)
217 const;
Yves Gerey665174f2018-06-19 13:03:05218 bool AddTransportOffer(const std::string& content_name,
219 const TransportOptions& transport_options,
220 const SessionDescription* current_desc,
Jonas Oreland1cd39fa2018-10-11 05:47:12221 SessionDescription* offer,
222 IceCredentialsIterator* ice_credentials) const;
henrike@webrtc.org28e20752013-07-10 00:45:36223
Steve Anton1a9d3c32018-12-11 01:18:54224 std::unique_ptr<TransportDescription> CreateTransportAnswer(
henrike@webrtc.org28e20752013-07-10 00:45:36225 const std::string& content_name,
226 const SessionDescription* offer_desc,
227 const TransportOptions& transport_options,
deadbeefb7892532017-02-23 03:35:18228 const SessionDescription* current_desc,
Jonas Oreland1cd39fa2018-10-11 05:47:12229 bool require_transport_attributes,
230 IceCredentialsIterator* ice_credentials) const;
henrike@webrtc.org28e20752013-07-10 00:45:36231
Yves Gerey665174f2018-06-19 13:03:05232 bool AddTransportAnswer(const std::string& content_name,
233 const TransportDescription& transport_desc,
234 SessionDescription* answer_desc) const;
henrike@webrtc.org28e20752013-07-10 00:45:36235
jiayl@webrtc.orge7d47a12014-08-05 19:19:05236 // Helpers for adding media contents to the SessionDescription. Returns true
237 // it succeeds or the media content is not needed, or false if there is any
238 // error.
239
240 bool AddAudioContentForOffer(
zhihuang1c378ed2017-08-17 21:10:50241 const MediaDescriptionOptions& media_description_options,
242 const MediaSessionOptions& session_options,
243 const ContentInfo* current_content,
jiayl@webrtc.orge7d47a12014-08-05 19:19:05244 const SessionDescription* current_description,
245 const RtpHeaderExtensions& audio_rtp_extensions,
246 const AudioCodecs& audio_codecs,
247 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 05:47:12248 SessionDescription* desc,
249 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05250
251 bool AddVideoContentForOffer(
zhihuang1c378ed2017-08-17 21:10:50252 const MediaDescriptionOptions& media_description_options,
253 const MediaSessionOptions& session_options,
254 const ContentInfo* current_content,
jiayl@webrtc.orge7d47a12014-08-05 19:19:05255 const SessionDescription* current_description,
256 const RtpHeaderExtensions& video_rtp_extensions,
257 const VideoCodecs& video_codecs,
258 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 05:47:12259 SessionDescription* desc,
260 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05261
262 bool AddDataContentForOffer(
zhihuang1c378ed2017-08-17 21:10:50263 const MediaDescriptionOptions& media_description_options,
264 const MediaSessionOptions& session_options,
265 const ContentInfo* current_content,
jiayl@webrtc.orge7d47a12014-08-05 19:19:05266 const SessionDescription* current_description,
jiayl@webrtc.orge7d47a12014-08-05 19:19:05267 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 05:47:12268 SessionDescription* desc,
269 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05270
Philipp Hancke4e8c1152020-10-13 10:43:15271 bool AddUnsupportedContentForOffer(
272 const MediaDescriptionOptions& media_description_options,
273 const MediaSessionOptions& session_options,
274 const ContentInfo* current_content,
275 const SessionDescription* current_description,
276 SessionDescription* desc,
277 IceCredentialsIterator* ice_credentials) const;
278
zhihuang1c378ed2017-08-17 21:10:50279 bool AddAudioContentForAnswer(
280 const MediaDescriptionOptions& media_description_options,
281 const MediaSessionOptions& session_options,
282 const ContentInfo* offer_content,
283 const SessionDescription* offer_description,
284 const ContentInfo* current_content,
285 const SessionDescription* current_description,
286 const TransportInfo* bundle_transport,
287 const AudioCodecs& audio_codecs,
Philipp Hancked4fe3ce2023-03-31 11:33:42288 const RtpHeaderExtensions& rtp_header_extensions,
zhihuang1c378ed2017-08-17 21:10:50289 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 05:47:12290 SessionDescription* answer,
291 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05292
zhihuang1c378ed2017-08-17 21:10:50293 bool AddVideoContentForAnswer(
294 const MediaDescriptionOptions& media_description_options,
295 const MediaSessionOptions& session_options,
296 const ContentInfo* offer_content,
297 const SessionDescription* offer_description,
298 const ContentInfo* current_content,
299 const SessionDescription* current_description,
300 const TransportInfo* bundle_transport,
301 const VideoCodecs& video_codecs,
Philipp Hancked4fe3ce2023-03-31 11:33:42302 const RtpHeaderExtensions& rtp_header_extensions,
zhihuang1c378ed2017-08-17 21:10:50303 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 05:47:12304 SessionDescription* answer,
305 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05306
zhihuang1c378ed2017-08-17 21:10:50307 bool AddDataContentForAnswer(
308 const MediaDescriptionOptions& media_description_options,
309 const MediaSessionOptions& session_options,
310 const ContentInfo* offer_content,
311 const SessionDescription* offer_description,
312 const ContentInfo* current_content,
313 const SessionDescription* current_description,
314 const TransportInfo* bundle_transport,
zhihuang1c378ed2017-08-17 21:10:50315 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 05:47:12316 SessionDescription* answer,
317 IceCredentialsIterator* ice_credentials) const;
zhihuang1c378ed2017-08-17 21:10:50318
Philipp Hancke4e8c1152020-10-13 10:43:15319 bool AddUnsupportedContentForAnswer(
320 const MediaDescriptionOptions& media_description_options,
321 const MediaSessionOptions& session_options,
322 const ContentInfo* offer_content,
323 const SessionDescription* offer_description,
324 const ContentInfo* current_content,
325 const SessionDescription* current_description,
326 const TransportInfo* bundle_transport,
327 SessionDescription* answer,
328 IceCredentialsIterator* ice_credentials) const;
329
zhihuang1c378ed2017-08-17 21:10:50330 void ComputeAudioCodecsIntersectionAndUnion();
jiayl@webrtc.orge7d47a12014-08-05 19:19:05331
Johannes Kron3e983682020-03-29 20:17:00332 void ComputeVideoCodecsIntersectionAndUnion();
333
Harald Alvestrand8101e7b2022-05-23 14:57:47334 rtc::UniqueRandomIdGenerator* ssrc_generator() const {
335 return ssrc_generator_.get();
336 }
337
Steve Anton8f66ddb2018-12-11 00:08:05338 bool is_unified_plan_ = false;
ossu075af922016-06-14 10:29:38339 AudioCodecs audio_send_codecs_;
340 AudioCodecs audio_recv_codecs_;
zhihuang1c378ed2017-08-17 21:10:50341 // Intersection of send and recv.
ossu075af922016-06-14 10:29:38342 AudioCodecs audio_sendrecv_codecs_;
zhihuang1c378ed2017-08-17 21:10:50343 // Union of send and recv.
344 AudioCodecs all_audio_codecs_;
Johannes Kron3e983682020-03-29 20:17:00345 VideoCodecs video_send_codecs_;
346 VideoCodecs video_recv_codecs_;
347 // Intersection of send and recv.
348 VideoCodecs video_sendrecv_codecs_;
349 // Union of send and recv.
350 VideoCodecs all_video_codecs_;
Harald Alvestrand8101e7b2022-05-23 14:57:47351 // This object may or may not be owned by this class.
352 webrtc::AlwaysValidPointer<rtc::UniqueRandomIdGenerator> const
353 ssrc_generator_;
jbauch5869f502017-06-29 19:31:36354 bool enable_encrypted_rtp_header_extensions_ = false;
Harald Alvestrand0d018412021-11-04 13:52:31355 // TODO(zhihuang): Rename secure_ to sdec_policy_; rename the related getter
356 // and setter.
357 SecurePolicy secure_ = SEC_DISABLED;
henrike@webrtc.org28e20752013-07-10 00:45:36358 const TransportDescriptionFactory* transport_desc_factory_;
359};
360
361// Convenience functions.
362bool IsMediaContent(const ContentInfo* content);
363bool IsAudioContent(const ContentInfo* content);
364bool IsVideoContent(const ContentInfo* content);
365bool IsDataContent(const ContentInfo* content);
Philipp Hancke4e8c1152020-10-13 10:43:15366bool IsUnsupportedContent(const ContentInfo* content);
deadbeef0ed85b22016-02-24 01:24:52367const ContentInfo* GetFirstMediaContent(const ContentInfos& contents,
368 MediaType media_type);
henrike@webrtc.org28e20752013-07-10 00:45:36369const ContentInfo* GetFirstAudioContent(const ContentInfos& contents);
370const ContentInfo* GetFirstVideoContent(const ContentInfos& contents);
371const ContentInfo* GetFirstDataContent(const ContentInfos& contents);
Steve Antonad7bffc2018-01-22 18:21:56372const ContentInfo* GetFirstMediaContent(const SessionDescription* sdesc,
373 MediaType media_type);
henrike@webrtc.org28e20752013-07-10 00:45:36374const ContentInfo* GetFirstAudioContent(const SessionDescription* sdesc);
375const ContentInfo* GetFirstVideoContent(const SessionDescription* sdesc);
376const ContentInfo* GetFirstDataContent(const SessionDescription* sdesc);
377const AudioContentDescription* GetFirstAudioContentDescription(
378 const SessionDescription* sdesc);
379const VideoContentDescription* GetFirstVideoContentDescription(
380 const SessionDescription* sdesc);
Harald Alvestrand5fc28b12019-05-13 11:36:16381const SctpDataContentDescription* GetFirstSctpDataContentDescription(
382 const SessionDescription* sdesc);
Taylor Brandstetterdc4eb8c2016-05-12 15:14:50383// Non-const versions of the above functions.
384// Useful when modifying an existing description.
Steve Anton36b29d12017-10-30 16:57:42385ContentInfo* GetFirstMediaContent(ContentInfos* contents, MediaType media_type);
386ContentInfo* GetFirstAudioContent(ContentInfos* contents);
387ContentInfo* GetFirstVideoContent(ContentInfos* contents);
388ContentInfo* GetFirstDataContent(ContentInfos* contents);
Steve Antonad7bffc2018-01-22 18:21:56389ContentInfo* GetFirstMediaContent(SessionDescription* sdesc,
390 MediaType media_type);
Taylor Brandstetterdc4eb8c2016-05-12 15:14:50391ContentInfo* GetFirstAudioContent(SessionDescription* sdesc);
392ContentInfo* GetFirstVideoContent(SessionDescription* sdesc);
393ContentInfo* GetFirstDataContent(SessionDescription* sdesc);
394AudioContentDescription* GetFirstAudioContentDescription(
395 SessionDescription* sdesc);
396VideoContentDescription* GetFirstVideoContentDescription(
397 SessionDescription* sdesc);
Harald Alvestrand5fc28b12019-05-13 11:36:16398SctpDataContentDescription* GetFirstSctpDataContentDescription(
399 SessionDescription* sdesc);
henrike@webrtc.org28e20752013-07-10 00:45:36400
Harald Alvestrand0d018412021-11-04 13:52:31401// Helper functions to return crypto suites used for SDES.
402void GetSupportedAudioSdesCryptoSuites(
403 const webrtc::CryptoOptions& crypto_options,
404 std::vector<int>* crypto_suites);
405void GetSupportedVideoSdesCryptoSuites(
406 const webrtc::CryptoOptions& crypto_options,
407 std::vector<int>* crypto_suites);
408void GetSupportedDataSdesCryptoSuites(
409 const webrtc::CryptoOptions& crypto_options,
410 std::vector<int>* crypto_suites);
411void GetSupportedAudioSdesCryptoSuiteNames(
412 const webrtc::CryptoOptions& crypto_options,
413 std::vector<std::string>* crypto_suite_names);
414void GetSupportedVideoSdesCryptoSuiteNames(
415 const webrtc::CryptoOptions& crypto_options,
416 std::vector<std::string>* crypto_suite_names);
417void GetSupportedDataSdesCryptoSuiteNames(
418 const webrtc::CryptoOptions& crypto_options,
419 std::vector<std::string>* crypto_suite_names);
420
henrike@webrtc.org28e20752013-07-10 00:45:36421} // namespace cricket
422
Steve Anton10542f22019-01-11 17:11:00423#endif // PC_MEDIA_SESSION_H_