henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1 | /* |
kjellander | 65c7f67 | 2016-02-12 00:05:01 -0800 | [diff] [blame] | 2 | * Copyright 2004 The WebRTC project authors. All Rights Reserved. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 3 | * |
kjellander | 65c7f67 | 2016-02-12 00:05:01 -0800 | [diff] [blame] | 4 | * 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.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | // Types and classes used in media session descriptions. |
| 12 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 13 | #ifndef PC_MEDIASESSION_H_ |
| 14 | #define PC_MEDIASESSION_H_ |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 15 | |
buildbot@webrtc.org | a09a999 | 2014-08-13 17:26:08 +0000 | [diff] [blame] | 16 | #include <algorithm> |
deadbeef | 0ed85b2 | 2016-02-23 17:24:52 -0800 | [diff] [blame] | 17 | #include <map> |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 18 | #include <string> |
| 19 | #include <vector> |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 20 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 21 | #include "api/mediatypes.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 22 | #include "media/base/mediaconstants.h" |
| 23 | #include "media/base/mediaengine.h" // For DataChannelType |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 24 | #include "p2p/base/transportdescriptionfactory.h" |
Zhi Huang | 365381f | 2018-04-13 16:44:34 -0700 | [diff] [blame] | 25 | #include "pc/jseptransport.h" |
Steve Anton | 4ab68ee | 2017-12-19 14:26:11 -0800 | [diff] [blame] | 26 | #include "pc/sessiondescription.h" |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 27 | |
| 28 | namespace cricket { |
| 29 | |
| 30 | class ChannelManager; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 31 | |
zhihuang | 8f65cdf | 2016-05-06 18:40:30 -0700 | [diff] [blame] | 32 | // Default RTCP CNAME for unit tests. |
| 33 | const char kDefaultRtcpCname[] = "DefaultRtcpCname"; |
| 34 | |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 35 | // Options for an RtpSender contained with an media description/"m=" section. |
| 36 | struct SenderOptions { |
| 37 | std::string track_id; |
Steve Anton | 8ffb9c3 | 2017-08-31 15:45:38 -0700 | [diff] [blame] | 38 | std::vector<std::string> stream_ids; |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 39 | int num_sim_layers; |
| 40 | }; |
jiayl@webrtc.org | 742922b | 2014-10-07 21:32:43 +0000 | [diff] [blame] | 41 | |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 42 | // Options for an individual media description/"m=" section. |
| 43 | struct MediaDescriptionOptions { |
| 44 | MediaDescriptionOptions(MediaType type, |
| 45 | const std::string& mid, |
Steve Anton | 1d03a75 | 2017-11-27 14:30:09 -0800 | [diff] [blame] | 46 | webrtc::RtpTransceiverDirection direction, |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 47 | bool stopped) |
| 48 | : type(type), mid(mid), direction(direction), stopped(stopped) {} |
zhihuang | a77e6bb | 2017-08-14 18:17:48 -0700 | [diff] [blame] | 49 | |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 50 | // TODO(deadbeef): When we don't support Plan B, there will only be one |
| 51 | // sender per media description and this can be simplified. |
| 52 | void AddAudioSender(const std::string& track_id, |
Steve Anton | 8ffb9c3 | 2017-08-31 15:45:38 -0700 | [diff] [blame] | 53 | const std::vector<std::string>& stream_ids); |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 54 | void AddVideoSender(const std::string& track_id, |
Steve Anton | 8ffb9c3 | 2017-08-31 15:45:38 -0700 | [diff] [blame] | 55 | const std::vector<std::string>& stream_ids, |
olka | 3c74766 | 2017-08-17 06:50:32 -0700 | [diff] [blame] | 56 | int num_sim_layers); |
zhihuang | a77e6bb | 2017-08-14 18:17:48 -0700 | [diff] [blame] | 57 | |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 58 | // Internally just uses sender_options. |
| 59 | void AddRtpDataChannel(const std::string& track_id, |
| 60 | const std::string& stream_id); |
olka | 3c74766 | 2017-08-17 06:50:32 -0700 | [diff] [blame] | 61 | |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 62 | MediaType type; |
| 63 | std::string mid; |
Steve Anton | 1d03a75 | 2017-11-27 14:30:09 -0800 | [diff] [blame] | 64 | webrtc::RtpTransceiverDirection direction; |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 65 | bool stopped; |
| 66 | TransportOptions transport_options; |
| 67 | // Note: There's no equivalent "RtpReceiverOptions" because only send |
| 68 | // stream information goes in the local descriptions. |
| 69 | std::vector<SenderOptions> sender_options; |
| 70 | |
| 71 | private: |
| 72 | // Doesn't DCHECK on |type|. |
| 73 | void AddSenderInternal(const std::string& track_id, |
Steve Anton | 8ffb9c3 | 2017-08-31 15:45:38 -0700 | [diff] [blame] | 74 | const std::vector<std::string>& stream_ids, |
olka | 3c74766 | 2017-08-17 06:50:32 -0700 | [diff] [blame] | 75 | int num_sim_layers); |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 76 | }; |
olka | 3c74766 | 2017-08-17 06:50:32 -0700 | [diff] [blame] | 77 | |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 78 | // Provides a mechanism for describing how m= sections should be generated. |
| 79 | // The m= section with index X will use media_description_options[X]. There |
| 80 | // must be an option for each existing section if creating an answer, or a |
| 81 | // subsequent offer. |
| 82 | struct MediaSessionOptions { |
| 83 | MediaSessionOptions() {} |
olka | 3c74766 | 2017-08-17 06:50:32 -0700 | [diff] [blame] | 84 | |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 85 | bool has_audio() const { return HasMediaDescription(MEDIA_TYPE_AUDIO); } |
| 86 | bool has_video() const { return HasMediaDescription(MEDIA_TYPE_VIDEO); } |
| 87 | bool has_data() const { return HasMediaDescription(MEDIA_TYPE_DATA); } |
| 88 | |
| 89 | bool HasMediaDescription(MediaType type) const; |
| 90 | |
| 91 | DataChannelType data_channel_type = DCT_NONE; |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 92 | bool vad_enabled = true; // When disabled, removes all CN codecs from SDP. |
| 93 | bool rtcp_mux_enabled = true; |
| 94 | bool bundle_enabled = false; |
Steve Anton | e831b8c | 2018-02-01 12:22:16 -0800 | [diff] [blame] | 95 | bool is_unified_plan = false; |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 96 | std::string rtcp_cname = kDefaultRtcpCname; |
jbauch | cb56065 | 2016-08-04 05:20:32 -0700 | [diff] [blame] | 97 | rtc::CryptoOptions crypto_options; |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 98 | // List of media description options in the same order that the media |
| 99 | // descriptions will be generated. |
| 100 | std::vector<MediaDescriptionOptions> media_description_options; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 101 | }; |
| 102 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 103 | // Creates media session descriptions according to the supplied codecs and |
| 104 | // other fields, as well as the supplied per-call options. |
| 105 | // When creating answers, performs the appropriate negotiation |
| 106 | // of the various fields to determine the proper result. |
| 107 | class MediaSessionDescriptionFactory { |
| 108 | public: |
| 109 | // Default ctor; use methods below to set configuration. |
| 110 | // The TransportDescriptionFactory is not owned by MediaSessionDescFactory, |
| 111 | // so it must be kept alive by the user of this class. |
| 112 | explicit MediaSessionDescriptionFactory( |
| 113 | const TransportDescriptionFactory* factory); |
| 114 | // This helper automatically sets up the factory to get its configuration |
| 115 | // from the specified ChannelManager. |
| 116 | MediaSessionDescriptionFactory(ChannelManager* cmanager, |
| 117 | const TransportDescriptionFactory* factory); |
| 118 | |
ossu | dedfd28 | 2016-06-14 07:12:39 -0700 | [diff] [blame] | 119 | const AudioCodecs& audio_sendrecv_codecs() const; |
ossu | 075af92 | 2016-06-14 03:29:38 -0700 | [diff] [blame] | 120 | const AudioCodecs& audio_send_codecs() const; |
| 121 | const AudioCodecs& audio_recv_codecs() const; |
| 122 | void set_audio_codecs(const AudioCodecs& send_codecs, |
| 123 | const AudioCodecs& recv_codecs); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 124 | void set_audio_rtp_header_extensions(const RtpHeaderExtensions& extensions) { |
| 125 | audio_rtp_extensions_ = extensions; |
| 126 | } |
Steve Anton | 1b8773d | 2018-04-06 11:13:34 -0700 | [diff] [blame] | 127 | RtpHeaderExtensions audio_rtp_header_extensions(bool unified_plan) const { |
| 128 | RtpHeaderExtensions extensions = audio_rtp_extensions_; |
| 129 | // If we are Unified Plan, also offer the MID header extension. |
| 130 | if (unified_plan) { |
| 131 | extensions.push_back(webrtc::RtpExtension( |
| 132 | webrtc::RtpExtension::kMidUri, webrtc::RtpExtension::kMidDefaultId)); |
| 133 | } |
| 134 | return extensions; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 135 | } |
| 136 | const VideoCodecs& video_codecs() const { return video_codecs_; } |
| 137 | void set_video_codecs(const VideoCodecs& codecs) { video_codecs_ = codecs; } |
| 138 | void set_video_rtp_header_extensions(const RtpHeaderExtensions& extensions) { |
| 139 | video_rtp_extensions_ = extensions; |
| 140 | } |
Steve Anton | 1b8773d | 2018-04-06 11:13:34 -0700 | [diff] [blame] | 141 | RtpHeaderExtensions video_rtp_header_extensions(bool unified_plan) const { |
| 142 | RtpHeaderExtensions extensions = video_rtp_extensions_; |
| 143 | // If we are Unified Plan, also offer the MID header extension. |
| 144 | if (unified_plan) { |
| 145 | extensions.push_back(webrtc::RtpExtension( |
| 146 | webrtc::RtpExtension::kMidUri, webrtc::RtpExtension::kMidDefaultId)); |
| 147 | } |
| 148 | return extensions; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 149 | } |
| 150 | const DataCodecs& data_codecs() const { return data_codecs_; } |
| 151 | void set_data_codecs(const DataCodecs& codecs) { data_codecs_ = codecs; } |
| 152 | SecurePolicy secure() const { return secure_; } |
| 153 | void set_secure(SecurePolicy s) { secure_ = s; } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 154 | |
jbauch | 5869f50 | 2017-06-29 12:31:36 -0700 | [diff] [blame] | 155 | void set_enable_encrypted_rtp_header_extensions(bool enable) { |
| 156 | enable_encrypted_rtp_header_extensions_ = enable; |
| 157 | } |
| 158 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 159 | SessionDescription* CreateOffer( |
| 160 | const MediaSessionOptions& options, |
| 161 | const SessionDescription* current_description) const; |
| 162 | SessionDescription* CreateAnswer( |
zstein | 4b2e082 | 2017-02-17 19:48:38 -0800 | [diff] [blame] | 163 | const SessionDescription* offer, |
| 164 | const MediaSessionOptions& options, |
| 165 | const SessionDescription* current_description) const; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 166 | |
| 167 | private: |
ossu | 075af92 | 2016-06-14 03:29:38 -0700 | [diff] [blame] | 168 | const AudioCodecs& GetAudioCodecsForOffer( |
Steve Anton | 1d03a75 | 2017-11-27 14:30:09 -0800 | [diff] [blame] | 169 | const webrtc::RtpTransceiverDirection& direction) const; |
ossu | 075af92 | 2016-06-14 03:29:38 -0700 | [diff] [blame] | 170 | const AudioCodecs& GetAudioCodecsForAnswer( |
Steve Anton | 1d03a75 | 2017-11-27 14:30:09 -0800 | [diff] [blame] | 171 | const webrtc::RtpTransceiverDirection& offer, |
| 172 | const webrtc::RtpTransceiverDirection& answer) const; |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 173 | void GetCodecsForOffer(const SessionDescription* current_description, |
| 174 | AudioCodecs* audio_codecs, |
| 175 | VideoCodecs* video_codecs, |
| 176 | DataCodecs* data_codecs) const; |
| 177 | void GetCodecsForAnswer(const SessionDescription* current_description, |
| 178 | const SessionDescription* remote_offer, |
| 179 | AudioCodecs* audio_codecs, |
| 180 | VideoCodecs* video_codecs, |
| 181 | DataCodecs* data_codecs) const; |
Steve Anton | 1b8773d | 2018-04-06 11:13:34 -0700 | [diff] [blame] | 182 | void GetRtpHdrExtsToOffer(const MediaSessionOptions& session_options, |
| 183 | const SessionDescription* current_description, |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 184 | RtpHeaderExtensions* audio_extensions, |
| 185 | RtpHeaderExtensions* video_extensions) const; |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame^] | 186 | bool AddTransportOffer(const std::string& content_name, |
| 187 | const TransportOptions& transport_options, |
| 188 | const SessionDescription* current_desc, |
| 189 | SessionDescription* offer) const; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 190 | |
| 191 | TransportDescription* CreateTransportAnswer( |
| 192 | const std::string& content_name, |
| 193 | const SessionDescription* offer_desc, |
| 194 | const TransportOptions& transport_options, |
deadbeef | b789253 | 2017-02-22 19:35:18 -0800 | [diff] [blame] | 195 | const SessionDescription* current_desc, |
| 196 | bool require_transport_attributes) const; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 197 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame^] | 198 | bool AddTransportAnswer(const std::string& content_name, |
| 199 | const TransportDescription& transport_desc, |
| 200 | SessionDescription* answer_desc) const; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 201 | |
jiayl@webrtc.org | e7d47a1 | 2014-08-05 19:19:05 +0000 | [diff] [blame] | 202 | // Helpers for adding media contents to the SessionDescription. Returns true |
| 203 | // it succeeds or the media content is not needed, or false if there is any |
| 204 | // error. |
| 205 | |
| 206 | bool AddAudioContentForOffer( |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 207 | const MediaDescriptionOptions& media_description_options, |
| 208 | const MediaSessionOptions& session_options, |
| 209 | const ContentInfo* current_content, |
jiayl@webrtc.org | e7d47a1 | 2014-08-05 19:19:05 +0000 | [diff] [blame] | 210 | const SessionDescription* current_description, |
| 211 | const RtpHeaderExtensions& audio_rtp_extensions, |
| 212 | const AudioCodecs& audio_codecs, |
| 213 | StreamParamsVec* current_streams, |
| 214 | SessionDescription* desc) const; |
| 215 | |
| 216 | bool AddVideoContentForOffer( |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 217 | const MediaDescriptionOptions& media_description_options, |
| 218 | const MediaSessionOptions& session_options, |
| 219 | const ContentInfo* current_content, |
jiayl@webrtc.org | e7d47a1 | 2014-08-05 19:19:05 +0000 | [diff] [blame] | 220 | const SessionDescription* current_description, |
| 221 | const RtpHeaderExtensions& video_rtp_extensions, |
| 222 | const VideoCodecs& video_codecs, |
| 223 | StreamParamsVec* current_streams, |
| 224 | SessionDescription* desc) const; |
| 225 | |
| 226 | bool AddDataContentForOffer( |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 227 | const MediaDescriptionOptions& media_description_options, |
| 228 | const MediaSessionOptions& session_options, |
| 229 | const ContentInfo* current_content, |
jiayl@webrtc.org | e7d47a1 | 2014-08-05 19:19:05 +0000 | [diff] [blame] | 230 | const SessionDescription* current_description, |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 231 | const DataCodecs& data_codecs, |
jiayl@webrtc.org | e7d47a1 | 2014-08-05 19:19:05 +0000 | [diff] [blame] | 232 | StreamParamsVec* current_streams, |
| 233 | SessionDescription* desc) const; |
| 234 | |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 235 | bool AddAudioContentForAnswer( |
| 236 | const MediaDescriptionOptions& media_description_options, |
| 237 | const MediaSessionOptions& session_options, |
| 238 | const ContentInfo* offer_content, |
| 239 | const SessionDescription* offer_description, |
| 240 | const ContentInfo* current_content, |
| 241 | const SessionDescription* current_description, |
| 242 | const TransportInfo* bundle_transport, |
| 243 | const AudioCodecs& audio_codecs, |
| 244 | StreamParamsVec* current_streams, |
| 245 | SessionDescription* answer) const; |
jiayl@webrtc.org | e7d47a1 | 2014-08-05 19:19:05 +0000 | [diff] [blame] | 246 | |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 247 | bool AddVideoContentForAnswer( |
| 248 | const MediaDescriptionOptions& media_description_options, |
| 249 | const MediaSessionOptions& session_options, |
| 250 | const ContentInfo* offer_content, |
| 251 | const SessionDescription* offer_description, |
| 252 | const ContentInfo* current_content, |
| 253 | const SessionDescription* current_description, |
| 254 | const TransportInfo* bundle_transport, |
| 255 | const VideoCodecs& video_codecs, |
| 256 | StreamParamsVec* current_streams, |
| 257 | SessionDescription* answer) const; |
jiayl@webrtc.org | e7d47a1 | 2014-08-05 19:19:05 +0000 | [diff] [blame] | 258 | |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 259 | bool AddDataContentForAnswer( |
| 260 | const MediaDescriptionOptions& media_description_options, |
| 261 | const MediaSessionOptions& session_options, |
| 262 | const ContentInfo* offer_content, |
| 263 | const SessionDescription* offer_description, |
| 264 | const ContentInfo* current_content, |
| 265 | const SessionDescription* current_description, |
| 266 | const TransportInfo* bundle_transport, |
| 267 | const DataCodecs& data_codecs, |
| 268 | StreamParamsVec* current_streams, |
| 269 | SessionDescription* answer) const; |
| 270 | |
| 271 | void ComputeAudioCodecsIntersectionAndUnion(); |
jiayl@webrtc.org | e7d47a1 | 2014-08-05 19:19:05 +0000 | [diff] [blame] | 272 | |
ossu | 075af92 | 2016-06-14 03:29:38 -0700 | [diff] [blame] | 273 | AudioCodecs audio_send_codecs_; |
| 274 | AudioCodecs audio_recv_codecs_; |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 275 | // Intersection of send and recv. |
ossu | 075af92 | 2016-06-14 03:29:38 -0700 | [diff] [blame] | 276 | AudioCodecs audio_sendrecv_codecs_; |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 277 | // Union of send and recv. |
| 278 | AudioCodecs all_audio_codecs_; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 279 | RtpHeaderExtensions audio_rtp_extensions_; |
| 280 | VideoCodecs video_codecs_; |
| 281 | RtpHeaderExtensions video_rtp_extensions_; |
| 282 | DataCodecs data_codecs_; |
jbauch | 5869f50 | 2017-06-29 12:31:36 -0700 | [diff] [blame] | 283 | bool enable_encrypted_rtp_header_extensions_ = false; |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 284 | // TODO(zhihuang): Rename secure_ to sdec_policy_; rename the related getter |
| 285 | // and setter. |
| 286 | SecurePolicy secure_ = SEC_DISABLED; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 287 | const TransportDescriptionFactory* transport_desc_factory_; |
| 288 | }; |
| 289 | |
| 290 | // Convenience functions. |
| 291 | bool IsMediaContent(const ContentInfo* content); |
| 292 | bool IsAudioContent(const ContentInfo* content); |
| 293 | bool IsVideoContent(const ContentInfo* content); |
| 294 | bool IsDataContent(const ContentInfo* content); |
deadbeef | 0ed85b2 | 2016-02-23 17:24:52 -0800 | [diff] [blame] | 295 | const ContentInfo* GetFirstMediaContent(const ContentInfos& contents, |
| 296 | MediaType media_type); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 297 | const ContentInfo* GetFirstAudioContent(const ContentInfos& contents); |
| 298 | const ContentInfo* GetFirstVideoContent(const ContentInfos& contents); |
| 299 | const ContentInfo* GetFirstDataContent(const ContentInfos& contents); |
Steve Anton | ad7bffc | 2018-01-22 10:21:56 -0800 | [diff] [blame] | 300 | const ContentInfo* GetFirstMediaContent(const SessionDescription* sdesc, |
| 301 | MediaType media_type); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 302 | const ContentInfo* GetFirstAudioContent(const SessionDescription* sdesc); |
| 303 | const ContentInfo* GetFirstVideoContent(const SessionDescription* sdesc); |
| 304 | const ContentInfo* GetFirstDataContent(const SessionDescription* sdesc); |
| 305 | const AudioContentDescription* GetFirstAudioContentDescription( |
| 306 | const SessionDescription* sdesc); |
| 307 | const VideoContentDescription* GetFirstVideoContentDescription( |
| 308 | const SessionDescription* sdesc); |
| 309 | const DataContentDescription* GetFirstDataContentDescription( |
| 310 | const SessionDescription* sdesc); |
Taylor Brandstetter | dc4eb8c | 2016-05-12 08:14:50 -0700 | [diff] [blame] | 311 | // Non-const versions of the above functions. |
| 312 | // Useful when modifying an existing description. |
Steve Anton | 36b29d1 | 2017-10-30 09:57:42 -0700 | [diff] [blame] | 313 | ContentInfo* GetFirstMediaContent(ContentInfos* contents, MediaType media_type); |
| 314 | ContentInfo* GetFirstAudioContent(ContentInfos* contents); |
| 315 | ContentInfo* GetFirstVideoContent(ContentInfos* contents); |
| 316 | ContentInfo* GetFirstDataContent(ContentInfos* contents); |
Steve Anton | ad7bffc | 2018-01-22 10:21:56 -0800 | [diff] [blame] | 317 | ContentInfo* GetFirstMediaContent(SessionDescription* sdesc, |
| 318 | MediaType media_type); |
Taylor Brandstetter | dc4eb8c | 2016-05-12 08:14:50 -0700 | [diff] [blame] | 319 | ContentInfo* GetFirstAudioContent(SessionDescription* sdesc); |
| 320 | ContentInfo* GetFirstVideoContent(SessionDescription* sdesc); |
| 321 | ContentInfo* GetFirstDataContent(SessionDescription* sdesc); |
| 322 | AudioContentDescription* GetFirstAudioContentDescription( |
| 323 | SessionDescription* sdesc); |
| 324 | VideoContentDescription* GetFirstVideoContentDescription( |
| 325 | SessionDescription* sdesc); |
| 326 | DataContentDescription* GetFirstDataContentDescription( |
| 327 | SessionDescription* sdesc); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 328 | |
deadbeef | 7914b8c | 2017-04-21 03:23:33 -0700 | [diff] [blame] | 329 | // Helper functions to return crypto suites used for SDES. |
| 330 | void GetSupportedAudioSdesCryptoSuites(const rtc::CryptoOptions& crypto_options, |
| 331 | std::vector<int>* crypto_suites); |
| 332 | void GetSupportedVideoSdesCryptoSuites(const rtc::CryptoOptions& crypto_options, |
| 333 | std::vector<int>* crypto_suites); |
| 334 | void GetSupportedDataSdesCryptoSuites(const rtc::CryptoOptions& crypto_options, |
| 335 | std::vector<int>* crypto_suites); |
| 336 | void GetSupportedAudioSdesCryptoSuiteNames( |
| 337 | const rtc::CryptoOptions& crypto_options, |
Guo-wei Shieh | 521ed7b | 2015-11-18 19:41:53 -0800 | [diff] [blame] | 338 | std::vector<std::string>* crypto_suite_names); |
deadbeef | 7914b8c | 2017-04-21 03:23:33 -0700 | [diff] [blame] | 339 | void GetSupportedVideoSdesCryptoSuiteNames( |
| 340 | const rtc::CryptoOptions& crypto_options, |
Guo-wei Shieh | 521ed7b | 2015-11-18 19:41:53 -0800 | [diff] [blame] | 341 | std::vector<std::string>* crypto_suite_names); |
deadbeef | 7914b8c | 2017-04-21 03:23:33 -0700 | [diff] [blame] | 342 | void GetSupportedDataSdesCryptoSuiteNames( |
| 343 | const rtc::CryptoOptions& crypto_options, |
Guo-wei Shieh | 521ed7b | 2015-11-18 19:41:53 -0800 | [diff] [blame] | 344 | std::vector<std::string>* crypto_suite_names); |
| 345 | |
Steve Anton | fa2260d | 2017-12-28 16:38:23 -0800 | [diff] [blame] | 346 | // Returns true if the given media section protocol indicates use of RTP. |
| 347 | bool IsRtpProtocol(const std::string& protocol); |
| 348 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 349 | } // namespace cricket |
| 350 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 351 | #endif // PC_MEDIASESSION_H_ |