blob: aa24f015de30fdbc88a1b87db00f57b11631f566 [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"
Steve Anton10542f22019-01-11 17:11:0022#include "api/media_types.h"
Harald Alvestrand5761e7b2021-01-29 14:45:0823#include "api/rtp_parameters.h"
24#include "api/rtp_transceiver_direction.h"
Steve Anton10542f22019-01-11 17:11:0025#include "media/base/media_constants.h"
Harald Alvestrand5761e7b2021-01-29 14:45:0826#include "media/base/rid_description.h"
27#include "media/base/stream_params.h"
Steve Anton10542f22019-01-11 17:11:0028#include "p2p/base/ice_credentials_iterator.h"
Harald Alvestrand5761e7b2021-01-29 14:45:0829#include "p2p/base/transport_description.h"
Steve Anton10542f22019-01-11 17:11:0030#include "p2p/base/transport_description_factory.h"
Harald Alvestrand5761e7b2021-01-29 14:45:0831#include "p2p/base/transport_info.h"
Steve Anton10542f22019-01-11 17:11:0032#include "pc/jsep_transport.h"
Harald Alvestrand5fc28b12019-05-13 11:36:1633#include "pc/media_protocol_names.h"
Steve Anton10542f22019-01-11 17:11:0034#include "pc/session_description.h"
Harald Alvestrand5761e7b2021-01-29 14:45:0835#include "pc/simulcast_description.h"
Amit Hilbuchbcd39d42019-01-26 01:13:5636#include "rtc_base/unique_id_generator.h"
henrike@webrtc.org28e20752013-07-10 00:45:3637
38namespace cricket {
39
40class ChannelManager;
henrike@webrtc.org28e20752013-07-10 00:45:3641
zhihuang8f65cdf2016-05-07 01:40:3042// Default RTCP CNAME for unit tests.
43const char kDefaultRtcpCname[] = "DefaultRtcpCname";
44
zhihuang1c378ed2017-08-17 21:10:5045// Options for an RtpSender contained with an media description/"m=" section.
Amit Hilbuchc63ddb22019-01-02 18:13:5846// Note: Spec-compliant Simulcast and legacy simulcast are mutually exclusive.
zhihuang1c378ed2017-08-17 21:10:5047struct SenderOptions {
48 std::string track_id;
Steve Anton8ffb9c32017-08-31 22:45:3849 std::vector<std::string> stream_ids;
Amit Hilbuchc63ddb22019-01-02 18:13:5850 // Use RIDs and Simulcast Layers to indicate spec-compliant Simulcast.
51 std::vector<RidDescription> rids;
52 SimulcastLayerList simulcast_layers;
Artem Titov880fa812021-07-30 20:30:2353 // Use `num_sim_layers` to indicate legacy simulcast.
zhihuang1c378ed2017-08-17 21:10:5054 int num_sim_layers;
55};
jiayl@webrtc.org742922b2014-10-07 21:32:4356
zhihuang1c378ed2017-08-17 21:10:5057// Options for an individual media description/"m=" section.
58struct MediaDescriptionOptions {
59 MediaDescriptionOptions(MediaType type,
60 const std::string& mid,
Steve Anton1d03a752017-11-27 22:30:0961 webrtc::RtpTransceiverDirection direction,
zhihuang1c378ed2017-08-17 21:10:5062 bool stopped)
63 : type(type), mid(mid), direction(direction), stopped(stopped) {}
zhihuanga77e6bb2017-08-15 01:17:4864
zhihuang1c378ed2017-08-17 21:10:5065 // TODO(deadbeef): When we don't support Plan B, there will only be one
66 // sender per media description and this can be simplified.
67 void AddAudioSender(const std::string& track_id,
Steve Anton8ffb9c32017-08-31 22:45:3868 const std::vector<std::string>& stream_ids);
zhihuang1c378ed2017-08-17 21:10:5069 void AddVideoSender(const std::string& track_id,
Steve Anton8ffb9c32017-08-31 22:45:3870 const std::vector<std::string>& stream_ids,
Amit Hilbuchc63ddb22019-01-02 18:13:5871 const std::vector<RidDescription>& rids,
72 const SimulcastLayerList& simulcast_layers,
olka3c747662017-08-17 13:50:3273 int num_sim_layers);
zhihuanga77e6bb2017-08-15 01:17:4874
zhihuang1c378ed2017-08-17 21:10:5075 MediaType type;
76 std::string mid;
Steve Anton1d03a752017-11-27 22:30:0977 webrtc::RtpTransceiverDirection direction;
zhihuang1c378ed2017-08-17 21:10:5078 bool stopped;
79 TransportOptions transport_options;
80 // Note: There's no equivalent "RtpReceiverOptions" because only send
81 // stream information goes in the local descriptions.
82 std::vector<SenderOptions> sender_options;
Florent Castelli2d9d82e2019-04-23 17:25:5183 std::vector<webrtc::RtpCodecCapability> codec_preferences;
Markus Handell755c65d2020-06-23 23:06:1084 std::vector<webrtc::RtpHeaderExtensionCapability> header_extensions;
zhihuang1c378ed2017-08-17 21:10:5085
86 private:
Artem Titov880fa812021-07-30 20:30:2387 // Doesn't DCHECK on `type`.
zhihuang1c378ed2017-08-17 21:10:5088 void AddSenderInternal(const std::string& track_id,
Steve Anton8ffb9c32017-08-31 22:45:3889 const std::vector<std::string>& stream_ids,
Amit Hilbuchc63ddb22019-01-02 18:13:5890 const std::vector<RidDescription>& rids,
91 const SimulcastLayerList& simulcast_layers,
olka3c747662017-08-17 13:50:3292 int num_sim_layers);
zhihuang1c378ed2017-08-17 21:10:5093};
olka3c747662017-08-17 13:50:3294
zhihuang1c378ed2017-08-17 21:10:5095// Provides a mechanism for describing how m= sections should be generated.
96// The m= section with index X will use media_description_options[X]. There
97// must be an option for each existing section if creating an answer, or a
98// subsequent offer.
99struct MediaSessionOptions {
100 MediaSessionOptions() {}
olka3c747662017-08-17 13:50:32101
zhihuang1c378ed2017-08-17 21:10:50102 bool has_audio() const { return HasMediaDescription(MEDIA_TYPE_AUDIO); }
103 bool has_video() const { return HasMediaDescription(MEDIA_TYPE_VIDEO); }
104 bool has_data() const { return HasMediaDescription(MEDIA_TYPE_DATA); }
105
106 bool HasMediaDescription(MediaType type) const;
107
zhihuang1c378ed2017-08-17 21:10:50108 bool vad_enabled = true; // When disabled, removes all CN codecs from SDP.
109 bool rtcp_mux_enabled = true;
110 bool bundle_enabled = false;
Johannes Kron89f874e2018-11-12 09:25:48111 bool offer_extmap_allow_mixed = false;
Mirta Dvornicic479a3c02019-06-04 13:38:50112 bool raw_packetization_for_video = false;
zhihuang1c378ed2017-08-17 21:10:50113 std::string rtcp_cname = kDefaultRtcpCname;
Benjamin Wrighta54daf12018-10-11 22:33:17114 webrtc::CryptoOptions crypto_options;
zhihuang1c378ed2017-08-17 21:10:50115 // List of media description options in the same order that the media
116 // descriptions will be generated.
117 std::vector<MediaDescriptionOptions> media_description_options;
Jonas Oreland1cd39fa2018-10-11 05:47:12118 std::vector<IceParameters> pooled_ice_credentials;
Piotr (Peter) Slatalab1ae10b2019-03-01 19:14:05119
Harald Alvestrand4aa11922019-05-14 20:00:01120 // Use the draft-ietf-mmusic-sctp-sdp-03 obsolete syntax for SCTP
121 // datachannels.
122 // Default is true for backwards compatibility with clients that use
123 // this internal interface.
124 bool use_obsolete_sctp_sdp = true;
henrike@webrtc.org28e20752013-07-10 00:45:36125};
126
henrike@webrtc.org28e20752013-07-10 00:45:36127// Creates media session descriptions according to the supplied codecs and
128// other fields, as well as the supplied per-call options.
129// When creating answers, performs the appropriate negotiation
130// of the various fields to determine the proper result.
131class MediaSessionDescriptionFactory {
132 public:
Amit Hilbuchbcd39d42019-01-26 01:13:56133 // Simple constructor that does not set any configuration for the factory.
134 // When using this constructor, the methods below can be used to set the
135 // configuration.
136 // The TransportDescriptionFactory and the UniqueRandomIdGenerator are not
137 // owned by MediaSessionDescriptionFactory, so they must be kept alive by the
138 // user of this class.
139 MediaSessionDescriptionFactory(const TransportDescriptionFactory* factory,
140 rtc::UniqueRandomIdGenerator* ssrc_generator);
henrike@webrtc.org28e20752013-07-10 00:45:36141 // This helper automatically sets up the factory to get its configuration
142 // from the specified ChannelManager.
143 MediaSessionDescriptionFactory(ChannelManager* cmanager,
Tomas Gunnarsson5411b172022-01-24 07:45:26144 const TransportDescriptionFactory* factory);
henrike@webrtc.org28e20752013-07-10 00:45:36145
ossudedfd282016-06-14 14:12:39146 const AudioCodecs& audio_sendrecv_codecs() const;
ossu075af922016-06-14 10:29:38147 const AudioCodecs& audio_send_codecs() const;
148 const AudioCodecs& audio_recv_codecs() const;
149 void set_audio_codecs(const AudioCodecs& send_codecs,
150 const AudioCodecs& recv_codecs);
Johannes Kron3e983682020-03-29 20:17:00151 const VideoCodecs& video_sendrecv_codecs() const;
152 const VideoCodecs& video_send_codecs() const;
153 const VideoCodecs& video_recv_codecs() const;
154 void set_video_codecs(const VideoCodecs& send_codecs,
155 const VideoCodecs& recv_codecs);
Markus Handell755c65d2020-06-23 23:06:10156 RtpHeaderExtensions filtered_rtp_header_extensions(
157 RtpHeaderExtensions extensions) const;
Harald Alvestrand0d018412021-11-04 13:52:31158 SecurePolicy secure() const { return secure_; }
159 void set_secure(SecurePolicy s) { secure_ = s; }
henrike@webrtc.org28e20752013-07-10 00:45:36160
jbauch5869f502017-06-29 19:31:36161 void set_enable_encrypted_rtp_header_extensions(bool enable) {
162 enable_encrypted_rtp_header_extensions_ = enable;
163 }
164
Steve Anton8f66ddb2018-12-11 00:08:05165 void set_is_unified_plan(bool is_unified_plan) {
166 is_unified_plan_ = is_unified_plan;
167 }
168
Steve Anton6fe1fba2018-12-11 18:15:23169 std::unique_ptr<SessionDescription> CreateOffer(
henrike@webrtc.org28e20752013-07-10 00:45:36170 const MediaSessionOptions& options,
171 const SessionDescription* current_description) const;
Steve Anton6fe1fba2018-12-11 18:15:23172 std::unique_ptr<SessionDescription> CreateAnswer(
zstein4b2e0822017-02-18 03:48:38173 const SessionDescription* offer,
174 const MediaSessionOptions& options,
175 const SessionDescription* current_description) const;
henrike@webrtc.org28e20752013-07-10 00:45:36176
177 private:
Markus Handell755c65d2020-06-23 23:06:10178 struct AudioVideoRtpHeaderExtensions {
179 RtpHeaderExtensions audio;
180 RtpHeaderExtensions video;
181 };
182
ossu075af922016-06-14 10:29:38183 const AudioCodecs& GetAudioCodecsForOffer(
Steve Anton1d03a752017-11-27 22:30:09184 const webrtc::RtpTransceiverDirection& direction) const;
ossu075af922016-06-14 10:29:38185 const AudioCodecs& GetAudioCodecsForAnswer(
Steve Anton1d03a752017-11-27 22:30:09186 const webrtc::RtpTransceiverDirection& offer,
187 const webrtc::RtpTransceiverDirection& answer) const;
Johannes Kron3e983682020-03-29 20:17:00188 const VideoCodecs& GetVideoCodecsForOffer(
189 const webrtc::RtpTransceiverDirection& direction) const;
190 const VideoCodecs& GetVideoCodecsForAnswer(
191 const webrtc::RtpTransceiverDirection& offer,
192 const webrtc::RtpTransceiverDirection& answer) const;
Steve Anton5c72e712018-12-10 22:25:30193 void GetCodecsForOffer(
194 const std::vector<const ContentInfo*>& current_active_contents,
195 AudioCodecs* audio_codecs,
Harald Alvestrand7af57c62021-04-16 11:12:14196 VideoCodecs* video_codecs) const;
Steve Anton5c72e712018-12-10 22:25:30197 void GetCodecsForAnswer(
198 const std::vector<const ContentInfo*>& current_active_contents,
199 const SessionDescription& remote_offer,
200 AudioCodecs* audio_codecs,
Harald Alvestrand7af57c62021-04-16 11:12:14201 VideoCodecs* video_codecs) const;
Markus Handell755c65d2020-06-23 23:06:10202 AudioVideoRtpHeaderExtensions GetOfferedRtpHeaderExtensionsWithIds(
Steve Anton5c72e712018-12-10 22:25:30203 const std::vector<const ContentInfo*>& current_active_contents,
Johannes Kron746dd0d2019-06-20 13:37:52204 bool extmap_allow_mixed,
Markus Handell755c65d2020-06-23 23:06:10205 const std::vector<MediaDescriptionOptions>& media_description_options)
206 const;
Yves Gerey665174f2018-06-19 13:03:05207 bool AddTransportOffer(const std::string& content_name,
208 const TransportOptions& transport_options,
209 const SessionDescription* current_desc,
Jonas Oreland1cd39fa2018-10-11 05:47:12210 SessionDescription* offer,
211 IceCredentialsIterator* ice_credentials) const;
henrike@webrtc.org28e20752013-07-10 00:45:36212
Steve Anton1a9d3c32018-12-11 01:18:54213 std::unique_ptr<TransportDescription> CreateTransportAnswer(
henrike@webrtc.org28e20752013-07-10 00:45:36214 const std::string& content_name,
215 const SessionDescription* offer_desc,
216 const TransportOptions& transport_options,
deadbeefb7892532017-02-23 03:35:18217 const SessionDescription* current_desc,
Jonas Oreland1cd39fa2018-10-11 05:47:12218 bool require_transport_attributes,
219 IceCredentialsIterator* ice_credentials) const;
henrike@webrtc.org28e20752013-07-10 00:45:36220
Yves Gerey665174f2018-06-19 13:03:05221 bool AddTransportAnswer(const std::string& content_name,
222 const TransportDescription& transport_desc,
223 SessionDescription* answer_desc) const;
henrike@webrtc.org28e20752013-07-10 00:45:36224
jiayl@webrtc.orge7d47a12014-08-05 19:19:05225 // Helpers for adding media contents to the SessionDescription. Returns true
226 // it succeeds or the media content is not needed, or false if there is any
227 // error.
228
229 bool AddAudioContentForOffer(
zhihuang1c378ed2017-08-17 21:10:50230 const MediaDescriptionOptions& media_description_options,
231 const MediaSessionOptions& session_options,
232 const ContentInfo* current_content,
jiayl@webrtc.orge7d47a12014-08-05 19:19:05233 const SessionDescription* current_description,
234 const RtpHeaderExtensions& audio_rtp_extensions,
235 const AudioCodecs& audio_codecs,
236 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 05:47:12237 SessionDescription* desc,
238 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05239
240 bool AddVideoContentForOffer(
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& video_rtp_extensions,
246 const VideoCodecs& video_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 AddDataContentForOffer(
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,
jiayl@webrtc.orge7d47a12014-08-05 19:19:05256 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 05:47:12257 SessionDescription* desc,
258 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05259
Philipp Hancke4e8c1152020-10-13 10:43:15260 bool AddUnsupportedContentForOffer(
261 const MediaDescriptionOptions& media_description_options,
262 const MediaSessionOptions& session_options,
263 const ContentInfo* current_content,
264 const SessionDescription* current_description,
265 SessionDescription* desc,
266 IceCredentialsIterator* ice_credentials) const;
267
zhihuang1c378ed2017-08-17 21:10:50268 bool AddAudioContentForAnswer(
269 const MediaDescriptionOptions& media_description_options,
270 const MediaSessionOptions& session_options,
271 const ContentInfo* offer_content,
272 const SessionDescription* offer_description,
273 const ContentInfo* current_content,
274 const SessionDescription* current_description,
275 const TransportInfo* bundle_transport,
276 const AudioCodecs& audio_codecs,
Markus Handell755c65d2020-06-23 23:06:10277 const RtpHeaderExtensions& default_audio_rtp_header_extensions,
zhihuang1c378ed2017-08-17 21:10:50278 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 05:47:12279 SessionDescription* answer,
280 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05281
zhihuang1c378ed2017-08-17 21:10:50282 bool AddVideoContentForAnswer(
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 VideoCodecs& video_codecs,
Markus Handell755c65d2020-06-23 23:06:10291 const RtpHeaderExtensions& default_video_rtp_header_extensions,
zhihuang1c378ed2017-08-17 21:10:50292 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 05:47:12293 SessionDescription* answer,
294 IceCredentialsIterator* ice_credentials) const;
jiayl@webrtc.orge7d47a12014-08-05 19:19:05295
zhihuang1c378ed2017-08-17 21:10:50296 bool AddDataContentForAnswer(
297 const MediaDescriptionOptions& media_description_options,
298 const MediaSessionOptions& session_options,
299 const ContentInfo* offer_content,
300 const SessionDescription* offer_description,
301 const ContentInfo* current_content,
302 const SessionDescription* current_description,
303 const TransportInfo* bundle_transport,
zhihuang1c378ed2017-08-17 21:10:50304 StreamParamsVec* current_streams,
Jonas Oreland1cd39fa2018-10-11 05:47:12305 SessionDescription* answer,
306 IceCredentialsIterator* ice_credentials) const;
zhihuang1c378ed2017-08-17 21:10:50307
Philipp Hancke4e8c1152020-10-13 10:43:15308 bool AddUnsupportedContentForAnswer(
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,
316 SessionDescription* answer,
317 IceCredentialsIterator* ice_credentials) const;
318
zhihuang1c378ed2017-08-17 21:10:50319 void ComputeAudioCodecsIntersectionAndUnion();
jiayl@webrtc.orge7d47a12014-08-05 19:19:05320
Johannes Kron3e983682020-03-29 20:17:00321 void ComputeVideoCodecsIntersectionAndUnion();
322
Steve Anton8f66ddb2018-12-11 00:08:05323 bool is_unified_plan_ = false;
ossu075af922016-06-14 10:29:38324 AudioCodecs audio_send_codecs_;
325 AudioCodecs audio_recv_codecs_;
zhihuang1c378ed2017-08-17 21:10:50326 // Intersection of send and recv.
ossu075af922016-06-14 10:29:38327 AudioCodecs audio_sendrecv_codecs_;
zhihuang1c378ed2017-08-17 21:10:50328 // Union of send and recv.
329 AudioCodecs all_audio_codecs_;
Johannes Kron3e983682020-03-29 20:17:00330 VideoCodecs video_send_codecs_;
331 VideoCodecs video_recv_codecs_;
332 // Intersection of send and recv.
333 VideoCodecs video_sendrecv_codecs_;
334 // Union of send and recv.
335 VideoCodecs all_video_codecs_;
Amit Hilbuchbcd39d42019-01-26 01:13:56336 // This object is not owned by the channel so it must outlive it.
337 rtc::UniqueRandomIdGenerator* const ssrc_generator_;
jbauch5869f502017-06-29 19:31:36338 bool enable_encrypted_rtp_header_extensions_ = false;
Harald Alvestrand0d018412021-11-04 13:52:31339 // TODO(zhihuang): Rename secure_ to sdec_policy_; rename the related getter
340 // and setter.
341 SecurePolicy secure_ = SEC_DISABLED;
henrike@webrtc.org28e20752013-07-10 00:45:36342 const TransportDescriptionFactory* transport_desc_factory_;
343};
344
345// Convenience functions.
346bool IsMediaContent(const ContentInfo* content);
347bool IsAudioContent(const ContentInfo* content);
348bool IsVideoContent(const ContentInfo* content);
349bool IsDataContent(const ContentInfo* content);
Philipp Hancke4e8c1152020-10-13 10:43:15350bool IsUnsupportedContent(const ContentInfo* content);
deadbeef0ed85b22016-02-24 01:24:52351const ContentInfo* GetFirstMediaContent(const ContentInfos& contents,
352 MediaType media_type);
henrike@webrtc.org28e20752013-07-10 00:45:36353const ContentInfo* GetFirstAudioContent(const ContentInfos& contents);
354const ContentInfo* GetFirstVideoContent(const ContentInfos& contents);
355const ContentInfo* GetFirstDataContent(const ContentInfos& contents);
Steve Antonad7bffc2018-01-22 18:21:56356const ContentInfo* GetFirstMediaContent(const SessionDescription* sdesc,
357 MediaType media_type);
henrike@webrtc.org28e20752013-07-10 00:45:36358const ContentInfo* GetFirstAudioContent(const SessionDescription* sdesc);
359const ContentInfo* GetFirstVideoContent(const SessionDescription* sdesc);
360const ContentInfo* GetFirstDataContent(const SessionDescription* sdesc);
361const AudioContentDescription* GetFirstAudioContentDescription(
362 const SessionDescription* sdesc);
363const VideoContentDescription* GetFirstVideoContentDescription(
364 const SessionDescription* sdesc);
Harald Alvestrand5fc28b12019-05-13 11:36:16365const SctpDataContentDescription* GetFirstSctpDataContentDescription(
366 const SessionDescription* sdesc);
Taylor Brandstetterdc4eb8c2016-05-12 15:14:50367// Non-const versions of the above functions.
368// Useful when modifying an existing description.
Steve Anton36b29d12017-10-30 16:57:42369ContentInfo* GetFirstMediaContent(ContentInfos* contents, MediaType media_type);
370ContentInfo* GetFirstAudioContent(ContentInfos* contents);
371ContentInfo* GetFirstVideoContent(ContentInfos* contents);
372ContentInfo* GetFirstDataContent(ContentInfos* contents);
Steve Antonad7bffc2018-01-22 18:21:56373ContentInfo* GetFirstMediaContent(SessionDescription* sdesc,
374 MediaType media_type);
Taylor Brandstetterdc4eb8c2016-05-12 15:14:50375ContentInfo* 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 11:36:16382SctpDataContentDescription* GetFirstSctpDataContentDescription(
383 SessionDescription* sdesc);
henrike@webrtc.org28e20752013-07-10 00:45:36384
Harald Alvestrand0d018412021-11-04 13:52:31385// Helper functions to return crypto suites used for SDES.
386void GetSupportedAudioSdesCryptoSuites(
387 const webrtc::CryptoOptions& crypto_options,
388 std::vector<int>* crypto_suites);
389void GetSupportedVideoSdesCryptoSuites(
390 const webrtc::CryptoOptions& crypto_options,
391 std::vector<int>* crypto_suites);
392void GetSupportedDataSdesCryptoSuites(
393 const webrtc::CryptoOptions& crypto_options,
394 std::vector<int>* crypto_suites);
395void GetSupportedAudioSdesCryptoSuiteNames(
396 const webrtc::CryptoOptions& crypto_options,
397 std::vector<std::string>* crypto_suite_names);
398void GetSupportedVideoSdesCryptoSuiteNames(
399 const webrtc::CryptoOptions& crypto_options,
400 std::vector<std::string>* crypto_suite_names);
401void GetSupportedDataSdesCryptoSuiteNames(
402 const webrtc::CryptoOptions& crypto_options,
403 std::vector<std::string>* crypto_suite_names);
404
henrike@webrtc.org28e20752013-07-10 00:45:36405} // namespace cricket
406
Steve Anton10542f22019-01-11 17:11:00407#endif // PC_MEDIA_SESSION_H_