idnits 2.17.1 draft-ietf-rtcweb-jsep-26.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- -- The document has examples using IPv4 documentation addresses according to RFC6890, but does not use any IPv6 documentation addresses. Maybe there should be IPv6 examples, too? Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 3784 has weird spacing: '... mid a1...' == Line 3785 has weird spacing: '... attr candi...' == Line 3791 has weird spacing: '... mid a1...' == Line 3792 has weird spacing: '... attr candi...' == Line 3799 has weird spacing: '... mid a1...' == (11 more instances...) -- The document date (February 27, 2019) is 1883 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Unused Reference: 'RFC6544' is defined on line 4719, but no explicit reference was found in the text == Outdated reference: A later version (-39) exists of draft-ietf-mmusic-ice-sip-sdp-24 == Outdated reference: A later version (-19) exists of draft-ietf-mmusic-sdp-mux-attributes-17 == Outdated reference: A later version (-14) exists of draft-ietf-mmusic-sdp-simulcast-13 == Outdated reference: A later version (-10) exists of draft-ietf-rtcweb-fec-08 == Outdated reference: A later version (-12) exists of draft-ietf-rtcweb-security-11 == Outdated reference: A later version (-20) exists of draft-ietf-rtcweb-security-arch-18 ** Obsolete normative reference: RFC 4566 (Obsoleted by RFC 8866) ** Obsolete normative reference: RFC 5285 (Obsoleted by RFC 8285) ** Obsolete normative reference: RFC 6347 (Obsoleted by RFC 9147) == Outdated reference: A later version (-12) exists of draft-ietf-rtcweb-ip-handling-11 == Outdated reference: A later version (-14) exists of draft-ietf-rtcweb-sdp-11 -- Obsolete informational reference (is this intentional?): RFC 5245 (Obsoleted by RFC 8445, RFC 8839) Summary: 3 errors (**), 0 flaws (~~), 16 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group J. Uberti 3 Internet-Draft Google 4 Intended status: Standards Track C. Jennings 5 Expires: August 31, 2019 Cisco 6 E. Rescorla, Ed. 7 Mozilla 8 February 27, 2019 10 JavaScript Session Establishment Protocol 11 draft-ietf-rtcweb-jsep-26 13 Abstract 15 This document describes the mechanisms for allowing a JavaScript 16 application to control the signaling plane of a multimedia session 17 via the interface specified in the W3C RTCPeerConnection API, and 18 discusses how this relates to existing signaling protocols. 20 Status of This Memo 22 This Internet-Draft is submitted in full conformance with the 23 provisions of BCP 78 and BCP 79. 25 Internet-Drafts are working documents of the Internet Engineering 26 Task Force (IETF). Note that other groups may also distribute 27 working documents as Internet-Drafts. The list of current Internet- 28 Drafts is at https://datatracker.ietf.org/drafts/current/. 30 Internet-Drafts are draft documents valid for a maximum of six months 31 and may be updated, replaced, or obsoleted by other documents at any 32 time. It is inappropriate to use Internet-Drafts as reference 33 material or to cite them other than as "work in progress." 35 This Internet-Draft will expire on August 31, 2019. 37 Copyright Notice 39 Copyright (c) 2019 IETF Trust and the persons identified as the 40 document authors. All rights reserved. 42 This document is subject to BCP 78 and the IETF Trust's Legal 43 Provisions Relating to IETF Documents 44 (https://trustee.ietf.org/license-info) in effect on the date of 45 publication of this document. Please review these documents 46 carefully, as they describe your rights and restrictions with respect 47 to this document. Code Components extracted from this document must 48 include Simplified BSD License text as described in Section 4.e of 49 the Trust Legal Provisions and are provided without warranty as 50 described in the Simplified BSD License. 52 Table of Contents 54 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 55 1.1. General Design of JSEP . . . . . . . . . . . . . . . . . 4 56 1.2. Other Approaches Considered . . . . . . . . . . . . . . . 6 57 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 6 58 3. Semantics and Syntax . . . . . . . . . . . . . . . . . . . . 7 59 3.1. Signaling Model . . . . . . . . . . . . . . . . . . . . . 7 60 3.2. Session Descriptions and State Machine . . . . . . . . . 7 61 3.3. Session Description Format . . . . . . . . . . . . . . . 11 62 3.4. Session Description Control . . . . . . . . . . . . . . . 11 63 3.4.1. RtpTransceivers . . . . . . . . . . . . . . . . . . . 11 64 3.4.2. RtpSenders . . . . . . . . . . . . . . . . . . . . . 12 65 3.4.3. RtpReceivers . . . . . . . . . . . . . . . . . . . . 12 66 3.5. ICE . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 67 3.5.1. ICE Gathering Overview . . . . . . . . . . . . . . . 12 68 3.5.2. ICE Candidate Trickling . . . . . . . . . . . . . . . 13 69 3.5.2.1. ICE Candidate Format . . . . . . . . . . . . . . 13 70 3.5.3. ICE Candidate Policy . . . . . . . . . . . . . . . . 14 71 3.5.4. ICE Candidate Pool . . . . . . . . . . . . . . . . . 15 72 3.5.5. ICE Versions . . . . . . . . . . . . . . . . . . . . 16 73 3.6. Video Size Negotiation . . . . . . . . . . . . . . . . . 16 74 3.6.1. Creating an imageattr Attribute . . . . . . . . . . . 16 75 3.6.2. Interpreting imageattr Attributes . . . . . . . . . . 17 76 3.7. Simulcast . . . . . . . . . . . . . . . . . . . . . . . . 19 77 3.8. Interactions With Forking . . . . . . . . . . . . . . . . 20 78 3.8.1. Sequential Forking . . . . . . . . . . . . . . . . . 20 79 3.8.2. Parallel Forking . . . . . . . . . . . . . . . . . . 21 80 4. Interface . . . . . . . . . . . . . . . . . . . . . . . . . . 22 81 4.1. PeerConnection . . . . . . . . . . . . . . . . . . . . . 22 82 4.1.1. Constructor . . . . . . . . . . . . . . . . . . . . . 22 83 4.1.2. addTrack . . . . . . . . . . . . . . . . . . . . . . 24 84 4.1.3. removeTrack . . . . . . . . . . . . . . . . . . . . . 24 85 4.1.4. addTransceiver . . . . . . . . . . . . . . . . . . . 25 86 4.1.5. createDataChannel . . . . . . . . . . . . . . . . . . 25 87 4.1.6. createOffer . . . . . . . . . . . . . . . . . . . . . 25 88 4.1.7. createAnswer . . . . . . . . . . . . . . . . . . . . 26 89 4.1.8. SessionDescriptionType . . . . . . . . . . . . . . . 27 90 4.1.8.1. Use of Provisional Answers . . . . . . . . . . . 28 91 4.1.8.2. Rollback . . . . . . . . . . . . . . . . . . . . 28 92 4.1.9. setLocalDescription . . . . . . . . . . . . . . . . . 29 93 4.1.10. setRemoteDescription . . . . . . . . . . . . . . . . 30 94 4.1.11. currentLocalDescription . . . . . . . . . . . . . . . 30 95 4.1.12. pendingLocalDescription . . . . . . . . . . . . . . . 30 96 4.1.13. currentRemoteDescription . . . . . . . . . . . . . . 30 97 4.1.14. pendingRemoteDescription . . . . . . . . . . . . . . 31 98 4.1.15. canTrickleIceCandidates . . . . . . . . . . . . . . . 31 99 4.1.16. setConfiguration . . . . . . . . . . . . . . . . . . 31 100 4.1.17. addIceCandidate . . . . . . . . . . . . . . . . . . . 32 101 4.2. RtpTransceiver . . . . . . . . . . . . . . . . . . . . . 33 102 4.2.1. stop . . . . . . . . . . . . . . . . . . . . . . . . 33 103 4.2.2. stopped . . . . . . . . . . . . . . . . . . . . . . . 33 104 4.2.3. setDirection . . . . . . . . . . . . . . . . . . . . 33 105 4.2.4. direction . . . . . . . . . . . . . . . . . . . . . . 34 106 4.2.5. currentDirection . . . . . . . . . . . . . . . . . . 34 107 4.2.6. setCodecPreferences . . . . . . . . . . . . . . . . . 34 108 5. SDP Interaction Procedures . . . . . . . . . . . . . . . . . 35 109 5.1. Requirements Overview . . . . . . . . . . . . . . . . . . 35 110 5.1.1. Usage Requirements . . . . . . . . . . . . . . . . . 35 111 5.1.2. Profile Names and Interoperability . . . . . . . . . 35 112 5.2. Constructing an Offer . . . . . . . . . . . . . . . . . . 37 113 5.2.1. Initial Offers . . . . . . . . . . . . . . . . . . . 37 114 5.2.2. Subsequent Offers . . . . . . . . . . . . . . . . . . 43 115 5.2.3. Options Handling . . . . . . . . . . . . . . . . . . 47 116 5.2.3.1. IceRestart . . . . . . . . . . . . . . . . . . . 47 117 5.2.3.2. VoiceActivityDetection . . . . . . . . . . . . . 47 118 5.3. Generating an Answer . . . . . . . . . . . . . . . . . . 48 119 5.3.1. Initial Answers . . . . . . . . . . . . . . . . . . . 48 120 5.3.2. Subsequent Answers . . . . . . . . . . . . . . . . . 55 121 5.3.3. Options Handling . . . . . . . . . . . . . . . . . . 56 122 5.3.3.1. VoiceActivityDetection . . . . . . . . . . . . . 56 123 5.4. Modifying an Offer or Answer . . . . . . . . . . . . . . 57 124 5.5. Processing a Local Description . . . . . . . . . . . . . 57 125 5.6. Processing a Remote Description . . . . . . . . . . . . . 58 126 5.7. Processing a Rollback . . . . . . . . . . . . . . . . . . 58 127 5.8. Parsing a Session Description . . . . . . . . . . . . . . 59 128 5.8.1. Session-Level Parsing . . . . . . . . . . . . . . . . 60 129 5.8.2. Media Section Parsing . . . . . . . . . . . . . . . . 61 130 5.8.3. Semantics Verification . . . . . . . . . . . . . . . 64 131 5.9. Applying a Local Description . . . . . . . . . . . . . . 65 132 5.10. Applying a Remote Description . . . . . . . . . . . . . . 67 133 5.11. Applying an Answer . . . . . . . . . . . . . . . . . . . 71 134 6. Processing RTP/RTCP . . . . . . . . . . . . . . . . . . . . . 74 135 7. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 74 136 7.1. Simple Example . . . . . . . . . . . . . . . . . . . . . 74 137 7.2. Detailed Example . . . . . . . . . . . . . . . . . . . . 78 138 7.3. Early Transport Warmup Example . . . . . . . . . . . . . 88 139 8. Security Considerations . . . . . . . . . . . . . . . . . . . 95 140 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 96 141 10. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 96 142 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 96 143 11.1. Normative References . . . . . . . . . . . . . . . . . . 96 144 11.2. Informative References . . . . . . . . . . . . . . . . . 100 146 Appendix A. Appendix A . . . . . . . . . . . . . . . . . . . . . 103 147 Appendix B. Change log . . . . . . . . . . . . . . . . . . . . . 105 148 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 115 150 1. Introduction 152 This document describes how the W3C WEBRTC RTCPeerConnection 153 interface [W3C.webrtc] is used to control the setup, management and 154 teardown of a multimedia session. 156 1.1. General Design of JSEP 158 WebRTC call setup has been designed to focus on controlling the media 159 plane, leaving signaling plane behavior up to the application as much 160 as possible. The rationale is that different applications may prefer 161 to use different protocols, such as the existing SIP call signaling 162 protocol, or something custom to the particular application, perhaps 163 for a novel use case. In this approach, the key information that 164 needs to be exchanged is the multimedia session description, which 165 specifies the necessary transport and media configuration information 166 necessary to establish the media plane. 168 With these considerations in mind, this document describes the 169 JavaScript Session Establishment Protocol (JSEP) that allows for full 170 control of the signaling state machine from JavaScript. As described 171 above, JSEP assumes a model in which a JavaScript application 172 executes inside a runtime containing WebRTC APIs (the "JSEP 173 implementation"). The JSEP implementation is almost entirely 174 divorced from the core signaling flow, which is instead handled by 175 the JavaScript making use of two interfaces: (1) passing in local and 176 remote session descriptions and (2) interacting with the ICE state 177 machine. The combination of the JSEP implementation and the 178 JavaScript application is referred to throughout this document as a 179 "JSEP endpoint". 181 In this document, the use of JSEP is described as if it always occurs 182 between two JSEP endpoints. Note though in many cases it will 183 actually be between a JSEP endpoint and some kind of server, such as 184 a gateway or MCU. This distinction is invisible to the JSEP 185 endpoint; it just follows the instructions it is given via the API. 187 JSEP's handling of session descriptions is simple and 188 straightforward. Whenever an offer/answer exchange is needed, the 189 initiating side creates an offer by calling a createOffer() API. The 190 application then uses that offer to set up its local config via the 191 setLocalDescription() API. The offer is finally sent off to the 192 remote side over its preferred signaling mechanism (e.g., 193 WebSockets); upon receipt of that offer, the remote party installs it 194 using the setRemoteDescription() API. 196 To complete the offer/answer exchange, the remote party uses the 197 createAnswer() API to generate an appropriate answer, applies it 198 using the setLocalDescription() API, and sends the answer back to the 199 initiator over the signaling channel. When the initiator gets that 200 answer, it installs it using the setRemoteDescription() API, and 201 initial setup is complete. This process can be repeated for 202 additional offer/answer exchanges. 204 Regarding ICE [RFC8445], JSEP decouples the ICE state machine from 205 the overall signaling state machine, as the ICE state machine must 206 remain in the JSEP implementation, because only the implementation 207 has the necessary knowledge of candidates and other transport 208 information. Performing this separation provides additional 209 flexibility in protocols that decouple session descriptions from 210 transport. For instance, in traditional SIP, each offer or answer is 211 self-contained, including both the session descriptions and the 212 transport information. However, [I-D.ietf-mmusic-trickle-ice-sip] 213 allows SIP to be used with trickle ICE [I-D.ietf-ice-trickle], in 214 which the session description can be sent immediately and the 215 transport information can be sent when available. Sending transport 216 information separately can allow for faster ICE and DTLS startup, 217 since ICE checks can start as soon as any transport information is 218 available rather than waiting for all of it. JSEP's decoupling of 219 the ICE and signaling state machines allows it to accommodate either 220 model. 222 Through its abstraction of signaling, the JSEP approach does require 223 the application to be aware of the signaling process. While the 224 application does not need to understand the contents of session 225 descriptions to set up a call, the application must call the right 226 APIs at the right times, convert the session descriptions and ICE 227 information into the defined messages of its chosen signaling 228 protocol, and perform the reverse conversion on the messages it 229 receives from the other side. 231 One way to make life easier for the application is to provide a 232 JavaScript library that hides this complexity from the developer; 233 said library would implement a given signaling protocol along with 234 its state machine and serialization code, presenting a higher level 235 call-oriented interface to the application developer. For example, 236 libraries exist to adapt the JSEP API into an API suitable for a SIP 237 or XMPP. Thus, JSEP provides greater control for the experienced 238 developer without forcing any additional complexity on the novice 239 developer. 241 1.2. Other Approaches Considered 243 One approach that was considered instead of JSEP was to include a 244 lightweight signaling protocol. Instead of providing session 245 descriptions to the API, the API would produce and consume messages 246 from this protocol. While providing a more high-level API, this put 247 more control of signaling within the JSEP implementation, forcing it 248 to have to understand and handle concepts like signaling glare (see 249 [RFC3264], Section 4). 251 A second approach that was considered but not chosen was to decouple 252 the management of the media control objects from session 253 descriptions, instead offering APIs that would control each component 254 directly. This was rejected based on the argument that requiring 255 exposure of this level of complexity to the application programmer 256 would not be beneficial; it would result in an API where even a 257 simple example would require a significant amount of code to 258 orchestrate all the needed interactions, as well as creating a large 259 API surface that needed to be agreed upon and documented. In 260 addition, these API points could be called in any order, resulting in 261 a more complex set of interactions with the media subsystem than the 262 JSEP approach, which specifies how session descriptions are to be 263 evaluated and applied. 265 One variation on JSEP that was considered was to keep the basic 266 session description-oriented API, but to move the mechanism for 267 generating offers and answers out of the JSEP implementation. 268 Instead of providing createOffer/createAnswer methods within the 269 implementation, this approach would instead expose a getCapabilities 270 API which would provide the application with the information it 271 needed in order to generate its own session descriptions. This 272 increases the amount of work that the application needs to do; it 273 needs to know how to generate session descriptions from capabilities, 274 and especially how to generate the correct answer from an arbitrary 275 offer and the supported capabilities. While this could certainly be 276 addressed by using a library like the one mentioned above, it 277 basically forces the use of said library even for a simple example. 278 Providing createOffer/createAnswer avoids this problem. 280 2. Terminology 282 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 283 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 284 document are to be interpreted as described in [RFC2119]. 286 3. Semantics and Syntax 288 3.1. Signaling Model 290 JSEP does not specify a particular signaling model or state machine, 291 other than the generic need to exchange session descriptions in the 292 fashion described by [RFC3264] (offer/answer) in order for both sides 293 of the session to know how to conduct the session. JSEP provides 294 mechanisms to create offers and answers, as well as to apply them to 295 a session. However, the JSEP implementation is totally decoupled 296 from the actual mechanism by which these offers and answers are 297 communicated to the remote side, including addressing, 298 retransmission, forking, and glare handling. These issues are left 299 entirely up to the application; the application has complete control 300 over which offers and answers get handed to the implementation, and 301 when. 303 +-----------+ +-----------+ 304 | Web App |<--- App-Specific Signaling -->| Web App | 305 +-----------+ +-----------+ 306 ^ ^ 307 | SDP | SDP 308 V V 309 +-----------+ +-----------+ 310 | JSEP |<----------- Media ------------>| JSEP | 311 | Impl. | | Impl. | 312 +-----------+ +-----------+ 314 Figure 1: JSEP Signaling Model 316 3.2. Session Descriptions and State Machine 318 In order to establish the media plane, the JSEP implementation needs 319 specific parameters to indicate what to transmit to the remote side, 320 as well as how to handle the media that is received. These 321 parameters are determined by the exchange of session descriptions in 322 offers and answers, and there are certain details to this process 323 that must be handled in the JSEP APIs. 325 Whether a session description applies to the local side or the remote 326 side affects the meaning of that description. For example, the list 327 of codecs sent to a remote party indicates what the local side is 328 willing to receive, which, when intersected with the set of codecs 329 the remote side supports, specifies what the remote side should send. 330 However, not all parameters follow this rule; some parameters are 331 declarative and the remote side MUST either accept them or reject 332 them altogether. An example of such a parameter is the DTLS 333 fingerprints [RFC8122], which are calculated based on the local 334 certificate(s) offered, and are not subject to negotiation. 336 In addition, various RFCs put different conditions on the format of 337 offers versus answers. For example, an offer may propose an 338 arbitrary number of m= sections (i.e., media descriptions as 339 described in [RFC4566], Section 5.14), but an answer must contain the 340 exact same number as the offer. 342 Lastly, while the exact media parameters are only known only after an 343 offer and an answer have been exchanged, the offerer may receive ICE 344 checks, and possibly media (e.g., in the case of a re-offer after a 345 connection has been established) before it receives an answer. To 346 properly process incoming media in this case, the offerer's media 347 handler must be aware of the details of the offer before the answer 348 arrives. 350 Therefore, in order to handle session descriptions properly, the JSEP 351 implementation needs: 353 1. To know if a session description pertains to the local or remote 354 side. 356 2. To know if a session description is an offer or an answer. 358 3. To allow the offer to be specified independently of the answer. 360 JSEP addresses this by adding both setLocalDescription and 361 setRemoteDescription methods and having session description objects 362 contain a type field indicating the type of session description being 363 supplied. This satisfies the requirements listed above for both the 364 offerer, who first calls setLocalDescription(sdp [offer]) and then 365 later setRemoteDescription(sdp [answer]), as well as for the 366 answerer, who first calls setRemoteDescription(sdp [offer]) and then 367 later setLocalDescription(sdp [answer]). 369 During the offer/answer exchange, the outstanding offer is considered 370 to be "pending" at the offerer and the answerer, as it may either be 371 accepted or rejected. If this is a re-offer, each side will also 372 have "current" local and remote descriptions, which reflect the 373 result of the last offer/answer exchange. Sections Section 4.1.12, 374 Section 4.1.14, Section 4.1.11, and Section 4.1.13, provide more 375 detail on pending and current descriptions. 377 JSEP also allows for an answer to be treated as provisional by the 378 application. Provisional answers provide a way for an answerer to 379 communicate initial session parameters back to the offerer, in order 380 to allow the session to begin, while allowing a final answer to be 381 specified later. This concept of a final answer is important to the 382 offer/answer model; when such an answer is received, any extra 383 resources allocated by the caller can be released, now that the exact 384 session configuration is known. These "resources" can include things 385 like extra ICE components, TURN candidates, or video decoders. 386 Provisional answers, on the other hand, do no such deallocation; as a 387 result, multiple dissimilar provisional answers, with their own codec 388 choices, transport parameters, etc., can be received and applied 389 during call setup. Note that the final answer itself may be 390 different than any received provisional answers. 392 In [RFC3264], the constraint at the signaling level is that only one 393 offer can be outstanding for a given session, but at the media stack 394 level, a new offer can be generated at any point. For example, when 395 using SIP for signaling, if one offer is sent, then cancelled using a 396 SIP CANCEL, another offer can be generated even though no answer was 397 received for the first offer. To support this, the JSEP media layer 398 can provide an offer via the createOffer() method whenever the 399 JavaScript application needs one for the signaling. The answerer can 400 send back zero or more provisional answers, and finally end the 401 offer-answer exchange by sending a final answer. The state machine 402 for this is as follows: 404 setRemote(OFFER) setLocal(PRANSWER) 405 /-----\ /-----\ 406 | | | | 407 v | v | 408 +---------------+ | +---------------+ | 409 | |----/ | |----/ 410 | have- | setLocal(PRANSWER) | have- | 411 | remote-offer |------------------- >| local-pranswer| 412 | | | | 413 | | | | 414 +---------------+ +---------------+ 415 ^ | | 416 | | setLocal(ANSWER) | 417 setRemote(OFFER) | | 418 | V setLocal(ANSWER) | 419 +---------------+ | 420 | | | 421 | |<---------------------------+ 422 | stable | 423 | |<---------------------------+ 424 | | | 425 +---------------+ setRemote(ANSWER) | 426 ^ | | 427 | | setLocal(OFFER) | 428 setRemote(ANSWER) | | 429 | V | 430 +---------------+ +---------------+ 431 | | | | 432 | have- | setRemote(PRANSWER) |have- | 433 | local-offer |------------------- >|remote-pranswer| 434 | | | | 435 | |----\ | |----\ 436 +---------------+ | +---------------+ | 437 ^ | ^ | 438 | | | | 439 \-----/ \-----/ 440 setLocal(OFFER) setRemote(PRANSWER) 442 Figure 2: JSEP State Machine 444 Aside from these state transitions there is no other difference 445 between the handling of provisional ("pranswer") and final ("answer") 446 answers. 448 3.3. Session Description Format 450 JSEP's session descriptions use SDP syntax for their internal 451 representation. While this format is not optimal for manipulation 452 from JavaScript, it is widely accepted, and frequently updated with 453 new features; any alternate encoding of session descriptions would 454 have to keep pace with the changes to SDP, at least until the time 455 that this new encoding eclipsed SDP in popularity. 457 However, to provide for future flexibility, the SDP syntax is 458 encapsulated within a SessionDescription object, which can be 459 constructed from SDP, and be serialized out to SDP. If future 460 specifications agree on a JSON format for session descriptions, we 461 could easily enable this object to generate and consume that JSON. 463 As detailed below, most applications should be able to treat the 464 SessionDescriptions produced and consumed by these various API calls 465 as opaque blobs; that is, the application will not need to read or 466 change them. 468 3.4. Session Description Control 470 In order to give the application control over various common session 471 parameters, JSEP provides control surfaces which tell the JSEP 472 implementation how to generate session descriptions. This avoids the 473 need for JavaScript to modify session descriptions in most cases. 475 Changes to these objects result in changes to the session 476 descriptions generated by subsequent createOffer/Answer calls. 478 3.4.1. RtpTransceivers 480 RtpTransceivers allow the application to control the RTP media 481 associated with one m= section. Each RtpTransceiver has an RtpSender 482 and an RtpReceiver, which an application can use to control the 483 sending and receiving of RTP media. The application may also modify 484 the RtpTransceiver directly, for instance, by stopping it. 486 RtpTransceivers generally have a 1:1 mapping with m= sections, 487 although there may be more RtpTransceivers than m= sections when 488 RtpTransceivers are created but not yet associated with a m= section, 489 or if RtpTransceivers have been stopped and disassociated from m= 490 sections. An RtpTransceiver is said to be associated with an m= 491 section if its mid property is non-null; otherwise it is said to be 492 disassociated. The associated m= section is determined using a 493 mapping between transceivers and m= section indices, formed when 494 creating an offer or applying a remote offer. 496 An RtpTransceiver is never associated with more than one m= section, 497 and once a session description is applied, a m= section is always 498 associated with exactly one RtpTransceiver. However, in certain 499 cases where a m= section has been rejected, as discussed in 500 Section 5.2.2 below, that m= section will be "recycled" and 501 associated with a new RtpTransceiver with a new mid value. 503 RtpTransceivers can be created explicitly by the application or 504 implicitly by calling setRemoteDescription with an offer that adds 505 new m= sections. 507 3.4.2. RtpSenders 509 RtpSenders allow the application to control how RTP media is sent. 510 An RtpSender is conceptually responsible for the outgoing RTP 511 stream(s) described by an m= section. This includes encoding the 512 attached MediaStreamTrack, sending RTP media packets, and generating/ 513 processing RTCP for the outgoing RTP streams(s). 515 3.4.3. RtpReceivers 517 RtpReceivers allow the application to inspect how RTP media is 518 received. An RtpReceiver is conceptually responsible for the 519 incoming RTP stream(s) described by an m= section. This includes 520 processing received RTP media packets, decoding the incoming 521 stream(s) to produce a remote MediaStreamTrack, and generating/ 522 processing RTCP for the incoming RTP stream(s). 524 3.5. ICE 526 3.5.1. ICE Gathering Overview 528 JSEP gathers ICE candidates as needed by the application. Collection 529 of ICE candidates is referred to as a gathering phase, and this is 530 triggered either by the addition of a new or recycled m= section to 531 the local session description, or new ICE credentials in the 532 description, indicating an ICE restart. Use of new ICE credentials 533 can be triggered explicitly by the application, or implicitly by the 534 JSEP implementation in response to changes in the ICE configuration. 536 When the ICE configuration changes in a way that requires a new 537 gathering phase, a 'needs-ice-restart' bit is set. When this bit is 538 set, calls to the createOffer API will generate new ICE credentials. 539 This bit is cleared by a call to the setLocalDescription API with new 540 ICE credentials from either an offer or an answer, i.e., from either 541 a local- or remote-initiated ICE restart. 543 When a new gathering phase starts, the ICE agent will notify the 544 application that gathering is occurring through an event. Then, when 545 each new ICE candidate becomes available, the ICE agent will supply 546 it to the application via an additional event; these candidates will 547 also automatically be added to the current and/or pending local 548 session description. Finally, when all candidates have been 549 gathered, an event will be dispatched to signal that the gathering 550 process is complete. 552 Note that gathering phases only gather the candidates needed by 553 new/recycled/restarting m= sections; other m= sections continue to 554 use their existing candidates. Also, if an m= section is bundled 555 (either by a successful bundle negotiation or by being marked as 556 bundle-only), then candidates will be gathered and exchanged for that 557 m= section if and only if its MID is a BUNDLE-tag, as described in 558 [I-D.ietf-mmusic-sdp-bundle-negotiation]. 560 3.5.2. ICE Candidate Trickling 562 Candidate trickling is a technique through which a caller may 563 incrementally provide candidates to the callee after the initial 564 offer has been dispatched; the semantics of "Trickle ICE" are defined 565 in [I-D.ietf-ice-trickle]. This process allows the callee to begin 566 acting upon the call and setting up the ICE (and perhaps DTLS) 567 connections immediately, without having to wait for the caller to 568 gather all possible candidates. This results in faster media setup 569 in cases where gathering is not performed prior to initiating the 570 call. 572 JSEP supports optional candidate trickling by providing APIs, as 573 described above, that provide control and feedback on the ICE 574 candidate gathering process. Applications that support candidate 575 trickling can send the initial offer immediately and send individual 576 candidates when they get the notified of a new candidate; 577 applications that do not support this feature can simply wait for the 578 indication that gathering is complete, and then create and send their 579 offer, with all the candidates, at this time. 581 Upon receipt of trickled candidates, the receiving application will 582 supply them to its ICE agent. This triggers the ICE agent to start 583 using the new remote candidates for connectivity checks. 585 3.5.2.1. ICE Candidate Format 587 In JSEP, ICE candidates are abstracted by an IceCandidate object, and 588 as with session descriptions, SDP syntax is used for the internal 589 representation. 591 The candidate details are specified in an IceCandidate field, using 592 the same SDP syntax as the "candidate-attribute" field defined in 593 [I-D.ietf-mmusic-ice-sip-sdp], Section 4.1. Note that this field 594 does not contain an "a=" prefix, as indicated in the following 595 example: 597 candidate:1 1 UDP 1694498815 192.0.2.33 10000 typ host 599 The IceCandidate object contains a field to indicate which ICE ufrag 600 it is associated with, as defined in [I-D.ietf-mmusic-ice-sip-sdp], 601 Section 4.4. This value is used to determine which session 602 description (and thereby which gathering phase) this IceCandidate 603 belongs to, which helps resolve ambiguities during ICE restarts. If 604 this field is absent in a received IceCandidate (perhaps when 605 communicating with a non-JSEP endpoint), the most recently received 606 session description is assumed. 608 The IceCandidate object also contains fields to indicate which m= 609 section it is associated with, which can be identified in one of two 610 ways, either by a m= section index, or a MID. The m= section index 611 is a zero-based index, with index N referring to the N+1th m= section 612 in the session description referenced by this IceCandidate. The MID 613 is a "media stream identification" value, as defined in [RFC5888], 614 Section 4, which provides a more robust way to identify the m= 615 section in the session description, using the MID of the associated 616 RtpTransceiver object (which may have been locally generated by the 617 answerer when interacting with a non-JSEP endpoint that does not 618 support the MID attribute, as discussed in Section 5.10 below). If 619 the MID field is present in a received IceCandidate, it MUST be used 620 for identification; otherwise, the m= section index is used instead. 622 When creating an IceCandidate object, JSEP implementations MUST 623 populate each of the candidate, ufrag, m= section index, and MID 624 fields. Implementations MUST also be prepared to receive objects 625 with some fields missing, as mentioned above. 627 3.5.3. ICE Candidate Policy 629 Typically, when gathering ICE candidates, the JSEP implementation 630 will gather all possible forms of initial candidates - host, server 631 reflexive, and relay. However, in certain cases, applications may 632 want to have more specific control over the gathering process, due to 633 privacy or related concerns. For example, one may want to only use 634 relay candidates, to leak as little location information as possible 635 (keeping in mind that this choice comes with corresponding 636 operational costs). To accomplish this, JSEP allows the application 637 to restrict which ICE candidates are used in a session. Note that 638 this filtering is applied on top of any restrictions the 639 implementation chooses to enforce regarding which IP addresses are 640 permitted for the application, as discussed in 641 [I-D.ietf-rtcweb-ip-handling]. 643 There may also be cases where the application wants to change which 644 types of candidates are used while the session is active. A prime 645 example is where a callee may initially want to use only relay 646 candidates, to avoid leaking location information to an arbitrary 647 caller, but then change to use all candidates (for lower operational 648 cost) once the user has indicated they want to take the call. For 649 this scenario, the JSEP implementation MUST allow the candidate 650 policy to be changed in mid-session, subject to the aforementioned 651 interactions with local policy. 653 To administer the ICE candidate policy, the JSEP implementation will 654 determine the current setting at the start of each gathering phase. 655 Then, during the gathering phase, the implementation MUST NOT expose 656 candidates disallowed by the current policy to the application, use 657 them as the source of connectivity checks, or indirectly expose them 658 via other fields, such as the raddr/rport attributes for other ICE 659 candidates. Later, if a different policy is specified by the 660 application, the application can apply it by kicking off a new 661 gathering phase via an ICE restart. 663 3.5.4. ICE Candidate Pool 665 JSEP applications typically inform the JSEP implementation to begin 666 ICE gathering via the information supplied to setLocalDescription, as 667 the local description indicates the number of ICE components which 668 will be needed and for which candidates must be gathered. However, 669 to accelerate cases where the application knows the number of ICE 670 components to use ahead of time, it may ask the implementation to 671 gather a pool of potential ICE candidates to help ensure rapid media 672 setup. 674 When setLocalDescription is eventually called, and the JSEP 675 implementation goes to gather the needed ICE candidates, it SHOULD 676 start by checking if any candidates are available in the pool. If 677 there are candidates in the pool, they SHOULD be handed to the 678 application immediately via the ICE candidate event. If the pool 679 becomes depleted, either because a larger-than-expected number of ICE 680 components is used, or because the pool has not had enough time to 681 gather candidates, the remaining candidates are gathered as usual. 682 This only occurs for the first offer/answer exchange, after which the 683 candidate pool is emptied and no longer used. 685 One example of where this concept is useful is an application that 686 expects an incoming call at some point in the future, and wants to 687 minimize the time it takes to establish connectivity, to avoid 688 clipping of initial media. By pre-gathering candidates into the 689 pool, it can exchange and start sending connectivity checks from 690 these candidates almost immediately upon receipt of a call. Note 691 though that by holding on to these pre-gathered candidates, which 692 will be kept alive as long as they may be needed, the application 693 will consume resources on the STUN/TURN servers it is using. 695 3.5.5. ICE Versions 697 While this specification formally relies on [RFC8445], at the time of 698 its publication, the majority of WebRTC implementations support the 699 version of ICE described in [RFC5245]. The use of the "ice2" 700 attribute defined in [RFC8445] can be used to detect the version in 701 use by a remote endpoint and to provide a smooth transition from the 702 older specification to the newer one. Implementations MUST be able 703 to accept remote descriptions that do not have the "ice2" attribute. 705 3.6. Video Size Negotiation 707 Video size negotiation is the process through which a receiver can 708 use the "a=imageattr" SDP attribute [RFC6236] to indicate what video 709 frame sizes it is capable of receiving. A receiver may have hard 710 limits on what its video decoder can process, or it may have some 711 maximum set by policy. By specifying these limits in an 712 "a=imageattr" attribute, JSEP endpoints can attempt to ensure that 713 the remote sender transmits video at an acceptable resolution. 714 However, when communicating with a non-JSEP endpoint that does not 715 understand this attribute, any signaled limits may be exceeded, and 716 the JSEP implementation MUST handle this gracefully, e.g., by 717 discarding the video. 719 Note that certain codecs support transmission of samples with aspect 720 ratios other than 1.0 (i.e., non-square pixels). JSEP 721 implementations will not transmit non-square pixels, but SHOULD 722 receive and render such video with the correct aspect ratio. 723 However, sample aspect ratio has no impact on the size negotiation 724 described below; all dimensions are measured in pixels, whether 725 square or not. 727 3.6.1. Creating an imageattr Attribute 729 The receiver will first intersect any known local limits (e.g., 730 hardware decoder capababilities, local policy) to determine the 731 absolute minimum and maximum sizes it can receive. If there are no 732 known local limits, the "a=imageattr" attribute SHOULD be omitted. 734 If these local limits preclude receiving any video, i.e., the 735 degenerate case of no permitted resolutions, the "a=imageattr" 736 attribute MUST be omitted, and the m= section MUST be marked as 737 sendonly/inactive, as appropriate. 739 Otherwise, an "a=imageattr" attribute is created with "recv" 740 direction, and the resulting resolution space formed from the 741 aforementioned intersection is used to specify its minimum and 742 maximum x= and y= values. 744 The rules here express a single set of preferences, and therefore, 745 the "a=imageattr" q= value is not important. It SHOULD be set to 746 1.0. 748 The "a=imageattr" field is payload type specific. When all video 749 codecs supported have the same capabilities, use of a single 750 attribute, with the wildcard payload type (*), is RECOMMENDED. 751 However, when the supported video codecs have different limitations, 752 specific "a=imageattr" attributes MUST be inserted for each payload 753 type. 755 As an example, consider a system with a multiformat video decoder, 756 which is capable of decoding any resolution from 48x48 to 720p, In 757 this case, the implementation would generate this attribute: 759 a=imageattr:* recv [x=[48:1280],y=[48:720],q=1.0] 761 This declaration indicates that the receiver is capable of decoding 762 any image resolution from 48x48 up to 1280x720 pixels. 764 3.6.2. Interpreting imageattr Attributes 766 [RFC6236] defines "a=imageattr" to be an advisory field. This means 767 that it does not absolutely constrain the video formats that the 768 sender can use, but gives an indication of the preferred values. 770 This specification prescribes more specific behavior. When a 771 MediaStreamTrack, which is producing video of a certain resolution 772 (the "track resolution"), is attached to a RtpSender, which is 773 encoding the track video at the same or lower resolution(s) (the 774 "encoder resolutions"), and a remote description is applied that 775 references the sender and contains valid "a=imageattr recv" 776 attributes, it MUST follow the rules below to ensure the sender does 777 not transmit a resolution that would exceed the size criteria 778 specified in the attributes. These rules MUST be followed as long as 779 the attributes remain present in the remote description, including 780 cases in which the track changes its resolution, or is replaced with 781 a different track. 783 Depending on how the RtpSender is configured, it may be producing a 784 single encoding at a certain resolution, or, if simulcast Section 3.7 785 has been negotiated, multiple encodings, each at their own specific 786 resolution. In addition, depending on the configuration, each 787 encoding may have the flexibility to reduce resolution when needed, 788 or may be locked to a specific output resolution. 790 For each encoding being produced by the RtpSender, the set of 791 "a=imageattr recv" attributes in the corresponding m= section of the 792 remote description is processed to determine what should be 793 transmitted. Only attributes that reference the media format 794 selected for the encoding are considered; each such attribute is 795 evaluated individually, starting with the attribute with the highest 796 "q=" value. If multiple attributes have the same "q=" value, they 797 are evaluated in the order they appear in their containing m= 798 section. Note that while JSEP endpoints will include at most one 799 "a=imageattr recv" attribute per media format, JSEP endpoints may 800 receive session descriptions from non-JSEP endpoints with m= sections 801 that contain multiple such attributes. 803 For each "a=imageattr recv" attribute, the following rules are 804 applied. If this processing is successful, the encoding is 805 transmitted accordingly, and no further attributes are considered for 806 that encoding. Otherwise, the next attribute is evaluated, in the 807 aforementioned order. If none of the supplied attributes can be 808 processed successfully, the encoding MUST NOT be transmitted, and an 809 error SHOULD be raised to the application. 811 o The limits from the attribute are compared to the encoder 812 resolution. Only the specific limits mentioned below are 813 considered; any other values, such as picture aspect ratio, MUST 814 be ignored. When considering a MediaStreamTrack that is producing 815 rotated video, the unrotated resolution MUST be used for the 816 checks. This is required regardless of whether the receiver 817 supports performing receive-side rotation (e.g., through CVO 818 [TS26.114]), as it significantly simplifies the matching logic. 820 o If the attribute includes a "sar=" (sample aspect ratio) value set 821 to something other than "1.0", indicating the receiver wants to 822 receive non-square pixels, this cannot be satisfied and the 823 attribute MUST NOT be used. 825 o If the encoder resolution exceeds the maximum size permitted by 826 the attribute, and the encoder is allowed to adjust its 827 resolution, the encoder SHOULD apply downscaling in order to 828 satisfy the limits. Downscaling MUST NOT change the picture 829 aspect ratio of the encoding, ignoring any trivial differences due 830 to rounding. For example, if the encoder resolution is 1280x720, 831 and the attribute specified a maximum of 640x480, the expected 832 output resolution would be 640x360. If downscaling cannot be 833 applied, the attribute MUST NOT be used. 835 o If the encoder resolution is less than the minimum size permitted 836 by the attribute, the attribute MUST NOT be used; the encoder MUST 837 NOT apply upscaling. JSEP implementations SHOULD avoid this 838 situation by allowing receipt of arbitrarily small resolutions, 839 perhaps via fallback to a software decoder. 841 o If the encoder resolution is within the maximum and minimum sizes, 842 no action is needed. 844 3.7. Simulcast 846 JSEP supports simulcast transmission of a MediaStreamTrack, where 847 multiple encodings of the source media can be transmitted within the 848 context of a single m= section. The current JSEP API is designed to 849 allow applications to send simulcasted media but only to receive a 850 single encoding. This allows for multi-user scenarios where each 851 sending client sends multiple encodings to a server, which then, for 852 each receiving client, chooses the appropriate encoding to forward. 854 Applications request support for simulcast by configuring multiple 855 encodings on an RtpSender. Upon generation of an offer or answer, 856 these encodings are indicated via SDP markings on the corresponding 857 m= section, as described below. Receivers that understand simulcast 858 and are willing to receive it will also include SDP markings to 859 indicate their support, and JSEP endpoints will use these markings to 860 determine whether simulcast is permitted for a given RtpSender. If 861 simulcast support is not negotiated, the RtpSender will only use the 862 first configured encoding. 864 Note that the exact simulcast parameters are up to the sending 865 application. While the aforementioned SDP markings are provided to 866 ensure the remote side can receive and demux multiple simulcast 867 encodings, the specific resolutions and bitrates to be used for each 868 encoding are purely a send-side decision in JSEP. 870 JSEP currently does not provide a mechanism to configure receipt of 871 simulcast. This means that if simulcast is offered by the remote 872 endpoint, the answer generated by a JSEP endpoint will not indicate 873 support for receipt of simulcast, and as such the remote endpoint 874 will only send a single encoding per m= section. 876 In addition, JSEP does not provide a mechanism to handle an incoming 877 offer requesting simulcast from the JSEP endpoint. This means that 878 setting up simulcast in the case where the JSEP endpoint receives the 879 initial offer requires out-of-band signaling or SDP inspection. 880 However, in the case where the JSEP endpoint sets up simulcast in its 881 in initial offer, any established simulcast streams will continue to 882 work upon receipt of an incoming re-offer. Future versions of this 883 specification may add additional APIs to handle the incoming initial 884 offer scenario. 886 When using JSEP to transmit multiple encodings from a RtpSender, the 887 techniques from [I-D.ietf-mmusic-sdp-simulcast] and 888 [I-D.ietf-mmusic-rid] are used. Specifically, when multiple 889 encodings have been configured for a RtpSender, the m= section for 890 the RtpSender will include an "a=simulcast" attribute, as defined in 891 [I-D.ietf-mmusic-sdp-simulcast], Section 6.2, with a "send" simulcast 892 stream description that lists each desired encoding, and no "recv" 893 simulcast stream description. The m= section will also include an 894 "a=rid" attribute for each encoding, as specified in 895 [I-D.ietf-mmusic-rid], Section 4; the use of RID identifiers allows 896 the individual encodings to be disambiguated even though they are all 897 part of the same m= section. 899 3.8. Interactions With Forking 901 Some call signaling systems allow various types of forking where an 902 SDP Offer may be provided to more than one device. For example, SIP 903 [RFC3261] defines both a "Parallel Search" and "Sequential Search". 904 Although these are primarily signaling level issues that are outside 905 the scope of JSEP, they do have some impact on the configuration of 906 the media plane that is relevant. When forking happens at the 907 signaling layer, the JavaScript application responsible for the 908 signaling needs to make the decisions about what media should be sent 909 or received at any point of time, as well as which remote endpoint it 910 should communicate with; JSEP is used to make sure the media engine 911 can make the RTP and media perform as required by the application. 912 The basic operations that the applications can have the media engine 913 do are: 915 o Start exchanging media with a given remote peer, but keep all the 916 resources reserved in the offer. 918 o Start exchanging media with a given remote peer, and free any 919 resources in the offer that are not being used. 921 3.8.1. Sequential Forking 923 Sequential forking involves a call being dispatched to multiple 924 remote callees, where each callee can accept the call, but only one 925 active session ever exists at a time; no mixing of received media is 926 performed. 928 JSEP handles sequential forking well, allowing the application to 929 easily control the policy for selecting the desired remote endpoint. 930 When an answer arrives from one of the callees, the application can 931 choose to apply it either as a provisional answer, leaving open the 932 possibility of using a different answer in the future, or apply it as 933 a final answer, ending the setup flow. 935 In a "first-one-wins" situation, the first answer will be applied as 936 a final answer, and the application will reject any subsequent 937 answers. In SIP parlance, this would be ACK + BYE. 939 In a "last-one-wins" situation, all answers would be applied as 940 provisional answers, and any previous call leg will be terminated. 941 At some point, the application will end the setup process, perhaps 942 with a timer; at this point, the application could reapply the 943 pending remote description as a final answer. 945 3.8.2. Parallel Forking 947 Parallel forking involves a call being dispatched to multiple remote 948 callees, where each callee can accept the call, and multiple 949 simultaneous active signaling sessions can be established as a 950 result. If multiple callees send media at the same time, the 951 possibilities for handling this are described in [RFC3960], 952 Section 3.1. Most SIP devices today only support exchanging media 953 with a single device at a time, and do not try to mix multiple early 954 media audio sources, as that could result in a confusing situation. 955 For example, consider having a European ringback tone mixed together 956 with the North American ringback tone - the resulting sound would not 957 be like either tone, and would confuse the user. If the signaling 958 application wishes to only exchange media with one of the remote 959 endpoints at a time, then from a media engine point of view, this is 960 exactly like the sequential forking case. 962 In the parallel forking case where the JavaScript application wishes 963 to simultaneously exchange media with multiple peers, the flow is 964 slightly more complex, but the JavaScript application can follow the 965 strategy that [RFC3960] describes using UPDATE. The UPDATE approach 966 allows the signaling to set up a separate media flow for each peer 967 that it wishes to exchange media with. In JSEP, this offer used in 968 the UPDATE would be formed by simply creating a new PeerConnection 969 (see Section 4.1) and making sure that the same local media streams 970 have been added into this new PeerConnection. Then the new 971 PeerConnection object would produce a SDP offer that could be used by 972 the signaling to perform the UPDATE strategy discussed in [RFC3960]. 974 As a result of sharing the media streams, the application will end up 975 with N parallel PeerConnection sessions, each with a local and remote 976 description and their own local and remote addresses. The media flow 977 from these sessions can be managed using setDirection (see 978 Section 4.2.3), or the application can choose to play out the media 979 from all sessions mixed together. Of course, if the application 980 wants to only keep a single session, it can simply terminate the 981 sessions that it no longer needs. 983 4. Interface 985 This section details the basic operations that must be present to 986 implement JSEP functionality. The actual API exposed in the W3C API 987 may have somewhat different syntax, but should map easily to these 988 concepts. 990 4.1. PeerConnection 992 4.1.1. Constructor 994 The PeerConnection constructor allows the application to specify 995 global parameters for the media session, such as the STUN/TURN 996 servers and credentials to use when gathering candidates, as well as 997 the initial ICE candidate policy and pool size, and also the bundle 998 policy to use. 1000 If an ICE candidate policy is specified, it functions as described in 1001 Section 3.5.3, causing the JSEP implementation to only surface the 1002 permitted candidates (including any implementation-internal 1003 filtering) to the application, and only use those candidates for 1004 connectivity checks. The set of available policies is as follows: 1006 all: All candidates permitted by implementation policy will be 1007 gathered and used. 1009 relay: All candidates except relay candidates will be filtered out. 1010 This obfuscates the location information that might be ascertained 1011 by the remote peer from the received candidates. Depending on how 1012 the application deploys and chooses relay servers, this could 1013 obfuscate location to a metro or possibly even global level. 1015 The default ICE candidate policy MUST be set to "all" as this is 1016 generally the desired policy, and also typically reduces use of 1017 application TURN server resources significantly. 1019 If a size is specified for the ICE candidate pool, this indicates the 1020 number of ICE components to pre-gather candidates for. Because pre- 1021 gathering results in utilizing STUN/TURN server resources for 1022 potentially long periods of time, this must only occur upon 1023 application request, and therefore the default candidate pool size 1024 MUST be zero. 1026 The application can specify its preferred policy regarding use of 1027 bundle, the multiplexing mechanism defined in 1028 [I-D.ietf-mmusic-sdp-bundle-negotiation]. Regardless of policy, the 1029 application will always try to negotiate bundle onto a single 1030 transport, and will offer a single bundle group across all m= 1031 sections; use of this single transport is contingent upon the 1032 answerer accepting bundle. However, by specifying a policy from the 1033 list below, the application can control exactly how aggressively it 1034 will try to bundle media streams together, which affects how it will 1035 interoperate with a non-bundle-aware endpoint. When negotiating with 1036 a non-bundle-aware endpoint, only the streams not marked as bundle- 1037 only streams will be established. 1039 The set of available policies is as follows: 1041 balanced: The first m= section of each type (audio, video, or 1042 application) will contain transport parameters, which will allow 1043 an answerer to unbundle that section. The second and any 1044 subsequent m= section of each type will be marked bundle-only. 1045 The result is that if there are N distinct media types, then 1046 candidates will be gathered for for N media streams. This policy 1047 balances desire to multiplex with the need to ensure basic audio 1048 and video can still be negotiated in legacy cases. When acting as 1049 answerer, if there is no bundle group in the offer, the 1050 implementation will reject all but the first m= section of each 1051 type. 1053 max-compat: All m= sections will contain transport parameters; none 1054 will be marked as bundle-only. This policy will allow all streams 1055 to be received by non-bundle-aware endpoints, but require separate 1056 candidates to be gathered for each media stream. 1058 max-bundle: Only the first m= section will contain transport 1059 parameters; all streams other than the first will be marked as 1060 bundle-only. This policy aims to minimize candidate gathering and 1061 maximize multiplexing, at the cost of less compatibility with 1062 legacy endpoints. When acting as answerer, the implementation 1063 will reject any m= sections other than the first m= section, 1064 unless they are in the same bundle group as that m= section. 1066 As it provides the best tradeoff between performance and 1067 compatibility with legacy endpoints, the default bundle policy MUST 1068 be set to "balanced". 1070 The application can specify its preferred policy regarding use of 1071 RTP/RTCP multiplexing [RFC5761] using one of the following policies: 1073 negotiate: The JSEP implementation will gather both RTP and RTCP 1074 candidates but also will offer "a=rtcp-mux", thus allowing for 1075 compatibility with either multiplexing or non-multiplexing 1076 endpoints. 1078 require: The JSEP implementation will only gather RTP candidates and 1079 will insert an "a=rtcp-mux-only" indication into any new m= 1080 sections in offers it generates. This halves the number of 1081 candidates that the offerer needs to gather. Applying a 1082 description with an m= section that does not contain an "a=rtcp- 1083 mux" attribute will cause an error to be returned. 1085 The default multiplexing policy MUST be set to "require". 1086 Implementations MAY choose to reject attempts by the application to 1087 set the multiplexing policy to "negotiate". 1089 4.1.2. addTrack 1091 The addTrack method adds a MediaStreamTrack to the PeerConnection, 1092 using the MediaStream argument to associate the track with other 1093 tracks in the same MediaStream, so that they can be added to the same 1094 "LS" group when creating an offer or answer. Adding tracks to the 1095 same "LS" group indicates that the playback of these tracks should be 1096 synchronized for proper lip sync, as described in [RFC5888], 1097 Section 7. addTrack attempts to minimize the number of transceivers 1098 as follows: If the PeerConnection is in the "have-remote-offer" 1099 state, the track will be attached to the first compatible transceiver 1100 that was created by the most recent call to setRemoteDescription() 1101 and does not have a local track. Otherwise, a new transceiver will 1102 be created, as described in Section 4.1.4. 1104 4.1.3. removeTrack 1106 The removeTrack method removes a MediaStreamTrack from the 1107 PeerConnection, using the RtpSender argument to indicate which sender 1108 should have its track removed. The sender's track is cleared, and 1109 the sender stops sending. Future calls to createOffer will mark the 1110 m= section associated with the sender as recvonly (if 1111 transceiver.direction is sendrecv) or as inactive (if 1112 transceiver.direction is sendonly). 1114 4.1.4. addTransceiver 1116 The addTransceiver method adds a new RtpTransceiver to the 1117 PeerConnection. If a MediaStreamTrack argument is provided, then the 1118 transceiver will be configured with that media type and the track 1119 will be attached to the transceiver. Otherwise, the application MUST 1120 explicitly specify the type; this mode is useful for creating 1121 recvonly transceivers as well as for creating transceivers to which a 1122 track can be attached at some later point. 1124 At the time of creation, the application can also specify a 1125 transceiver direction attribute, a set of MediaStreams which the 1126 transceiver is associated with (allowing LS group assignments), and a 1127 set of encodings for the media (used for simulcast as described in 1128 Section 3.7). 1130 4.1.5. createDataChannel 1132 The createDataChannel method creates a new data channel and attaches 1133 it to the PeerConnection. If no data channel currently exists for 1134 this PeerConnection, then a new offer/answer exchange is required. 1135 All data channels on a given PeerConnection share the same SCTP/DTLS 1136 association and therefore the same m= section, so subsequent creation 1137 of data channels does not have any impact on the JSEP state. 1139 The createDataChannel method also includes a number of arguments 1140 which are used by the PeerConnection (e.g., maxPacketLifetime) but 1141 are not reflected in the SDP and do not affect the JSEP state. 1143 4.1.6. createOffer 1145 The createOffer method generates a blob of SDP that contains a 1146 [RFC3264] offer with the supported configurations for the session, 1147 including descriptions of the media added to this PeerConnection, the 1148 codec/RTP/RTCP options supported by this implementation, and any 1149 candidates that have been gathered by the ICE agent. An options 1150 parameter may be supplied to provide additional control over the 1151 generated offer. This options parameter allows an application to 1152 trigger an ICE restart, for the purpose of reestablishing 1153 connectivity. 1155 In the initial offer, the generated SDP will contain all desired 1156 functionality for the session (functionality that is supported but 1157 not desired by default may be omitted); for each SDP line, the 1158 generation of the SDP will follow the process defined for generating 1159 an initial offer from the document that specifies the given SDP line. 1160 The exact handling of initial offer generation is detailed in 1161 Section 5.2.1 below. 1163 In the event createOffer is called after the session is established, 1164 createOffer will generate an offer to modify the current session 1165 based on any changes that have been made to the session, e.g., adding 1166 or stopping RtpTransceivers, or requesting an ICE restart. For each 1167 existing stream, the generation of each SDP line must follow the 1168 process defined for generating an updated offer from the RFC that 1169 specifies the given SDP line. For each new stream, the generation of 1170 the SDP must follow the process of generating an initial offer, as 1171 mentioned above. If no changes have been made, or for SDP lines that 1172 are unaffected by the requested changes, the offer will only contain 1173 the parameters negotiated by the last offer-answer exchange. The 1174 exact handling of subsequent offer generation is detailed in 1175 Section 5.2.2. below. 1177 Session descriptions generated by createOffer must be immediately 1178 usable by setLocalDescription; if a system has limited resources 1179 (e.g. a finite number of decoders), createOffer should return an 1180 offer that reflects the current state of the system, so that 1181 setLocalDescription will succeed when it attempts to acquire those 1182 resources. 1184 Calling this method may do things such as generating new ICE 1185 credentials, but does not change the PeerConnection state, trigger 1186 candidate gathering, or cause media to start or stop flowing. 1187 Specifically, the offer is not applied, and does not become the 1188 pending local description, until setLocalDescription is called. 1190 4.1.7. createAnswer 1192 The createAnswer method generates a blob of SDP that contains a 1193 [RFC3264] SDP answer with the supported configuration for the session 1194 that is compatible with the parameters supplied in the most recent 1195 call to setRemoteDescription, which MUST have been called prior to 1196 calling createAnswer. Like createOffer, the returned blob contains 1197 descriptions of the media added to this PeerConnection, the 1198 codec/RTP/RTCP options negotiated for this session, and any 1199 candidates that have been gathered by the ICE agent. An options 1200 parameter may be supplied to provide additional control over the 1201 generated answer. 1203 As an answer, the generated SDP will contain a specific configuration 1204 that specifies how the media plane should be established; for each 1205 SDP line, the generation of the SDP must follow the process defined 1206 for generating an answer from the document that specifies the given 1207 SDP line. The exact handling of answer generation is detailed in 1208 Section 5.3. below. 1210 Session descriptions generated by createAnswer must be immediately 1211 usable by setLocalDescription; like createOffer, the returned 1212 description should reflect the current state of the system. 1214 Calling this method may do things such as generating new ICE 1215 credentials, but does not change the PeerConnection state, trigger 1216 candidate gathering, or or cause a media state change. Specifically, 1217 the answer is not applied, and does not become the current local 1218 description, until setLocalDescription is called. 1220 4.1.8. SessionDescriptionType 1222 Session description objects (RTCSessionDescription) may be of type 1223 "offer", "pranswer", "answer" or "rollback". These types provide 1224 information as to how the description parameter should be parsed, and 1225 how the media state should be changed. 1227 "offer" indicates that a description should be parsed as an offer; 1228 said description may include many possible media configurations. A 1229 description used as an "offer" may be applied anytime the 1230 PeerConnection is in a stable state, or as an update to a previously 1231 supplied but unanswered "offer". 1233 "pranswer" indicates that a description should be parsed as an 1234 answer, but not a final answer, and so should not result in the 1235 freeing of allocated resources. It may result in the start of media 1236 transmission, if the answer does not specify an inactive media 1237 direction. A description used as a "pranswer" may be applied as a 1238 response to an "offer", or an update to a previously sent "pranswer". 1240 "answer" indicates that a description should be parsed as an answer, 1241 the offer-answer exchange should be considered complete, and any 1242 resources (decoders, candidates) that are no longer needed can be 1243 released. A description used as an "answer" may be applied as a 1244 response to an "offer", or an update to a previously sent "pranswer". 1246 The only difference between a provisional and final answer is that 1247 the final answer results in the freeing of any unused resources that 1248 were allocated as a result of the offer. As such, the application 1249 can use some discretion on whether an answer should be applied as 1250 provisional or final, and can change the type of the session 1251 description as needed. For example, in a serial forking scenario, an 1252 application may receive multiple "final" answers, one from each 1253 remote endpoint. The application could choose to accept the initial 1254 answers as provisional answers, and only apply an answer as final 1255 when it receives one that meets its criteria (e.g. a live user 1256 instead of voicemail). 1258 "rollback" is a special session description type implying that the 1259 state machine should be rolled back to the previous stable state, as 1260 described in Section 4.1.8.2. The contents MUST be empty. 1262 4.1.8.1. Use of Provisional Answers 1264 Most applications will not need to create answers using the 1265 "pranswer" type. While it is good practice to send an immediate 1266 response to an offer, in order to warm up the session transport and 1267 prevent media clipping, the preferred handling for a JSEP application 1268 is to create and send a "sendonly" final answer with a null 1269 MediaStreamTrack immediately after receiving the offer, which will 1270 prevent media from being sent by the caller, and allow media to be 1271 sent immediately upon answer by the callee. Later, when the callee 1272 actually accepts the call, the application can plug in the real 1273 MediaStreamTrack and create a new "sendrecv" offer to update the 1274 previous offer/answer pair and start bidirectional media flow. While 1275 this could also be done with a "sendonly" pranswer, followed by a 1276 "sendrecv" answer, the initial pranswer leaves the offer-answer 1277 exchange open, which means that the caller cannot send an updated 1278 offer during this time. 1280 As an example, consider a typical JSEP application that wants to set 1281 up audio and video as quickly as possible. When the callee receives 1282 an offer with audio and video MediaStreamTracks, it will send an 1283 immediate answer accepting these tracks as sendonly (meaning that the 1284 caller will not send the callee any media yet, and because the callee 1285 has not yet added its own MediaStreamTracks, the callee will not send 1286 any media either). It will then ask the user to accept the call and 1287 acquire the needed local tracks. Upon acceptance by the user, the 1288 application will plug in the tracks it has acquired, which, because 1289 ICE and DTLS handshaking have likely completed by this point, can 1290 start transmitting immediately. The application will also send a new 1291 offer to the remote side indicating call acceptance and moving the 1292 audio and video to be two-way media. A detailed example flow along 1293 these lines is shown in Section 7.3. 1295 Of course, some applications may not be able to perform this double 1296 offer-answer exchange, particularly ones that are attempting to 1297 gateway to legacy signaling protocols. In these cases, pranswer can 1298 still provide the application with a mechanism to warm up the 1299 transport. 1301 4.1.8.2. Rollback 1303 In certain situations it may be desirable to "undo" a change made to 1304 setLocalDescription or setRemoteDescription. Consider a case where a 1305 call is ongoing, and one side wants to change some of the session 1306 parameters; that side generates an updated offer and then calls 1307 setLocalDescription. However, the remote side, either before or 1308 after setRemoteDescription, decides it does not want to accept the 1309 new parameters, and sends a reject message back to the offerer. Now, 1310 the offerer, and possibly the answerer as well, need to return to a 1311 stable state and the previous local/remote description. To support 1312 this, we introduce the concept of "rollback", which discards any 1313 proposed changes to the session, returning the state machine to the 1314 stable state. A rollback is performed by supplying a session 1315 description of type "rollback" with empty contents to either 1316 setLocalDescription or setRemoteDescription. 1318 4.1.9. setLocalDescription 1320 The setLocalDescription method instructs the PeerConnection to apply 1321 the supplied session description as its local configuration. The 1322 type field indicates whether the description should be processed as 1323 an offer, provisional answer, final answer, or rollback; offers and 1324 answers are checked differently, using the various rules that exist 1325 for each SDP line. 1327 This API changes the local media state; among other things, it sets 1328 up local resources for receiving and decoding media. In order to 1329 successfully handle scenarios where the application wants to offer to 1330 change from one media format to a different, incompatible format, the 1331 PeerConnection must be able to simultaneously support use of both the 1332 current and pending local descriptions (e.g., support the codecs that 1333 exist in either description). This dual processing begins when the 1334 PeerConnection enters the "have-local-offer" state, and continues 1335 until setRemoteDescription is called with either a final answer, at 1336 which point the PeerConnection can fully adopt the pending local 1337 description, or a rollback, which results in a revert to the current 1338 local description. 1340 This API indirectly controls the candidate gathering process. When a 1341 local description is supplied, and the number of transports currently 1342 in use does not match the number of transports needed by the local 1343 description, the PeerConnection will create transports as needed and 1344 begin gathering candidates for each transport, using ones from the 1345 candidate pool if available. 1347 If setRemoteDescription was previously called with an offer, and 1348 setLocalDescription is called with an answer (provisional or final), 1349 and the media directions are compatible, and media is available to 1350 send, this will result in the starting of media transmission. 1352 4.1.10. setRemoteDescription 1354 The setRemoteDescription method instructs the PeerConnection to apply 1355 the supplied session description as the desired remote configuration. 1356 As in setLocalDescription, the type field of the description 1357 indicates how it should be processed. 1359 This API changes the local media state; among other things, it sets 1360 up local resources for sending and encoding media. 1362 If setLocalDescription was previously called with an offer, and 1363 setRemoteDescription is called with an answer (provisional or final), 1364 and the media directions are compatible, and media is available to 1365 send, this will result in the starting of media transmission. 1367 4.1.11. currentLocalDescription 1369 The currentLocalDescription method returns the current negotiated 1370 local description - i.e., the local description from the last 1371 successful offer/answer exchange - in addition to any local 1372 candidates that have been generated by the ICE agent since the local 1373 description was set. 1375 A null object will be returned if an offer/answer exchange has not 1376 yet been completed. 1378 4.1.12. pendingLocalDescription 1380 The pendingLocalDescription method returns a copy of the local 1381 description currently in negotiation - i.e., a local offer set 1382 without any corresponding remote answer - in addition to any local 1383 candidates that have been generated by the ICE agent since the local 1384 description was set. 1386 A null object will be returned if the state of the PeerConnection is 1387 "stable" or "have-remote-offer". 1389 4.1.13. currentRemoteDescription 1391 The currentRemoteDescription method returns a copy of the current 1392 negotiated remote description - i.e., the remote description from the 1393 last successful offer/answer exchange - in addition to any remote 1394 candidates that have been supplied via processIceMessage since the 1395 remote description was set. 1397 A null object will be returned if an offer/answer exchange has not 1398 yet been completed. 1400 4.1.14. pendingRemoteDescription 1402 The pendingRemoteDescription method returns a copy of the remote 1403 description currently in negotiation - i.e., a remote offer set 1404 without any corresponding local answer - in addition to any remote 1405 candidates that have been supplied via processIceMessage since the 1406 remote description was set. 1408 A null object will be returned if the state of the PeerConnection is 1409 "stable" or "have-local-offer". 1411 4.1.15. canTrickleIceCandidates 1413 The canTrickleIceCandidates property indicates whether the remote 1414 side supports receiving trickled candidates. There are three 1415 potential values: 1417 null: No SDP has been received from the other side, so it is not 1418 known if it can handle trickle. This is the initial value before 1419 setRemoteDescription() is called. 1421 true: SDP has been received from the other side indicating that it 1422 can support trickle. 1424 false: SDP has been received from the other side indicating that it 1425 cannot support trickle. 1427 As described in Section 3.5.2, JSEP implementations always provide 1428 candidates to the application individually, consistent with what is 1429 needed for Trickle ICE. However, applications can use the 1430 canTrickleIceCandidates property to determine whether their peer can 1431 actually do Trickle ICE, i.e., whether it is safe to send an initial 1432 offer or answer followed later by candidates as they are gathered. 1433 As "true" is the only value that definitively indicates remote 1434 Trickle ICE support, an application which compares 1435 canTrickleIceCandidates against "true" will by default attempt Half 1436 Trickle on initial offers and Full Trickle on subsequent interactions 1437 with a Trickle ICE-compatible agent. 1439 4.1.16. setConfiguration 1441 The setConfiguration method allows the global configuration of the 1442 PeerConnection, which was initially set by constructor parameters, to 1443 be changed during the session. The effects of this method call 1444 depend on when it is invoked, and differ depending on which specific 1445 parameters are changed: 1447 o Any changes to the STUN/TURN servers to use affect the next 1448 gathering phase. If an ICE gathering phase has already started or 1449 completed, the 'needs-ice-restart' bit mentioned in Section 3.5.1 1450 will be set. This will cause the next call to createOffer to 1451 generate new ICE credentials, for the purpose of forcing an ICE 1452 restart and kicking off a new gathering phase, in which the new 1453 servers will be used. If the ICE candidate pool has a nonzero 1454 size, and a local description has not yet been applied, any 1455 existing candidates will be discarded, and new candidates will be 1456 gathered from the new servers. 1458 o Any change to the ICE candidate policy affects the next gathering 1459 phase. If an ICE gathering phase has already started or 1460 completed, the 'needs-ice-restart' bit will be set. Either way, 1461 changes to the policy have no effect on the candidate pool, 1462 because pooled candidates are not made available to the 1463 application until a gathering phase occurs, and so any necessary 1464 filtering can still be done on any pooled candidates. 1466 o The ICE candidate pool size MUST NOT be changed after applying a 1467 local description. If a local description has not yet been 1468 applied, any changes to the ICE candidate pool size take effect 1469 immediately; if increased, additional candidates are pre-gathered; 1470 if decreased, the now-superfluous candidates are discarded. 1472 o The bundle and RTCP-multiplexing policies MUST NOT be changed 1473 after the construction of the PeerConnection. 1475 This call may result in a change to the state of the ICE Agent. 1477 4.1.17. addIceCandidate 1479 The addIceCandidate method provides an update to the ICE agent via an 1480 IceCandidate object Section 3.5.2.1. If the IceCandidate's candidate 1481 field is filled in, the IceCandidate is treated as a new remote ICE 1482 candidate, which will be added to the current and/or pending remote 1483 description according to the rules defined for Trickle ICE. 1484 Otherwise, the IceCandidate is treated as an end-of-candidates 1485 indication, as defined in [I-D.ietf-ice-trickle]. 1487 In either case, the m= section index, MID, and ufrag fields from the 1488 supplied IceCandidate are used to determine which m= section and ICE 1489 candidate generation the IceCandidate belongs to, as described in 1490 Section 3.5.2.1 above. In the case of an end-of-candidates 1491 indication, the absence of both the m= section index and MID fields 1492 is interpreted to mean that the indication applies to all m= sections 1493 in the specified ICE candidate generation. However, if both fields 1494 are absent for a new remote candidate, this MUST be treated as an 1495 invalid condition, as specified below. 1497 If any IceCandidate fields contain invalid values, or an error occurs 1498 during the processing of the IceCandidate object, the supplied 1499 IceCandidate MUST be ignored and an error MUST be returned. 1501 Otherwise, the new remote candidate or end-of-candidates indication 1502 is supplied to the ICE agent. In the case of a new remote candidate, 1503 connectivity checks will be sent to the new candidate. 1505 4.2. RtpTransceiver 1507 4.2.1. stop 1509 The stop method stops an RtpTransceiver. This will cause future 1510 calls to createOffer to generate a zero port for the associated m= 1511 section. See below for more details. 1513 4.2.2. stopped 1515 The stopped property indicates whether the transceiver has been 1516 stopped, either by a call to stopTransceiver or by applying an answer 1517 that rejects the associated m= section. In either of these cases, it 1518 is set to "true", and otherwise will be set to "false". 1520 A stopped RtpTransceiver does not send any outgoing RTP or RTCP or 1521 process any incoming RTP or RTCP. It cannot be restarted. 1523 4.2.3. setDirection 1525 The setDirection method sets the direction of a transceiver, which 1526 affects the direction property of the associated m= section on future 1527 calls to createOffer and createAnswer. The permitted values for 1528 direction are "recvonly", "sendrecv", "sendonly", and "inactive", 1529 mirroring the identically-named directional attributes defined in 1530 [RFC4566], Section 6. 1532 When creating offers, the transceiver direction is directly reflected 1533 in the output, even for re-offers. When creating answers, the 1534 transceiver direction is intersected with the offered direction, as 1535 explained in Section 5.3 below. 1537 Note that while setDirection sets the direction property of the 1538 transceiver immediately ( Section 4.2.4), this property does not 1539 immediately affect whether the transceiver's RtpSender will send or 1540 its RtpReceiver will receive. The direction in effect is represented 1541 by the currentDirection property, which is only updated when an 1542 answer is applied. 1544 4.2.4. direction 1546 The direction property indicates the last value passed into 1547 setDirection. If setDirection has never been called, it is set to 1548 the direction the transceiver was initialized with. 1550 4.2.5. currentDirection 1552 The currentDirection property indicates the last negotiated direction 1553 for the transceiver's associated m= section. More specifically, it 1554 indicates the [RFC3264] directional attribute of the associated m= 1555 section in the last applied answer (including provisional answers), 1556 with "send" and "recv" directions reversed if it was a remote answer. 1557 For example, if the directional attribute for the associated m= 1558 section in a remote answer is "recvonly", currentDirection is set to 1559 "sendonly". 1561 If an answer that references this transceiver has not yet been 1562 applied, or if the transceiver is stopped, currentDirection is set to 1563 null. 1565 4.2.6. setCodecPreferences 1567 The setCodecPreferences method sets the codec preferences of a 1568 transceiver, which in turn affect the presence and order of codecs of 1569 the associated m= section on future calls to createOffer and 1570 createAnswer. Note that setCodecPreferences does not directly affect 1571 which codec the implementation decides to send. It only affects 1572 which codecs the implementation indicates that it prefers to receive, 1573 via the offer or answer. Even when a codec is excluded by 1574 setCodecPreferences, it still may be used to send until the next 1575 offer/answer exchange discards it. 1577 The codec preferences of an RtpTransceiver can cause codecs to be 1578 excluded by subsequent calls to createOffer and createAnswer, in 1579 which case the corresponding media formats in the associated m= 1580 section will be excluded. The codec preferences cannot add media 1581 formats that would otherwise not be present. 1583 The codec preferences of an RtpTransceiver can also determine the 1584 order of codecs in subsequent calls to createOffer and createAnswer, 1585 in which case the order of the media formats in the associated m= 1586 section will follow the specified preferences. 1588 5. SDP Interaction Procedures 1590 This section describes the specific procedures to be followed when 1591 creating and parsing SDP objects. 1593 5.1. Requirements Overview 1595 JSEP implementations must comply with the specifications listed below 1596 that govern the creation and processing of offers and answers. 1598 5.1.1. Usage Requirements 1600 All session descriptions handled by JSEP implementations, both local 1601 and remote, MUST indicate support for the following specifications. 1602 If any of these are absent, this omission MUST be treated as an 1603 error. 1605 o ICE, as specified in [RFC8445], MUST be used. Note that the 1606 remote endpoint may use a Lite implementation; implementations 1607 MUST properly handle remote endpoints which do ICE-Lite. 1609 o DTLS [RFC6347] or DTLS-SRTP [RFC5763], MUST be used, as 1610 appropriate for the media type, as specified in 1611 [I-D.ietf-rtcweb-security-arch] 1613 The SDES SRTP keying mechanism from [RFC4568] MUST NOT be used, as 1614 discussed in [I-D.ietf-rtcweb-security-arch]. 1616 5.1.2. Profile Names and Interoperability 1618 For media m= sections, JSEP implementations MUST support the 1619 "UDP/TLS/RTP/SAVPF" profile specified in [RFC5764] as well as the 1620 "TCP/DTLS/RTP/SAVPF" profile specified in [RFC7850], and MUST 1621 indicate one of these profiles for each media m= line they produce in 1622 an offer. For data m= sections, implementations MUST support the 1623 "UDP/DTLS/SCTP" profile as well as the "TCP/DTLS/SCTP" profile, and 1624 MUST indicate one of these profiles for each data m= line they 1625 produce in an offer. The exact profile to use is determined by the 1626 protocol associated with the current default or selected ICE 1627 candidate, as described in [I-D.ietf-mmusic-ice-sip-sdp], 1628 Section 3.2.1.2. 1630 Unfortunately, in an attempt at compatibility, some endpoints 1631 generate other profile strings even when they mean to support one of 1632 these profiles. For instance, an endpoint might generate "RTP/AVP" 1633 but supply "a=fingerprint" and "a=rtcp-fb" attributes, indicating its 1634 willingness to support "UDP/TLS/RTP/SAVPF" or "TCP/DTLS/RTP/SAVPF". 1635 In order to simplify compatibility with such endpoints, JSEP 1636 implementations MUST follow the following rules when processing the 1637 media m= sections in a received offer: 1639 o Any profile in the offer matching one of the following MUST be 1640 accepted: 1642 * "RTP/AVP" (Defined in [RFC4566], Section 8.2.2) 1644 * "RTP/AVPF" (Defined in [RFC4585], Section 9) 1646 * "RTP/SAVP" (Defined in [RFC3711], Section 12) 1648 * "RTP/SAVPF" (Defined in [RFC5124], Section 6) 1650 * "TCP/DTLS/RTP/SAVP" (Defined in [RFC7850], Section 3.4) 1652 * "TCP/DTLS/RTP/SAVPF" (Defined in [RFC7850], Section 3.5) 1654 * "UDP/TLS/RTP/SAVP" (Defined in [RFC5764], Section 9) 1656 * "UDP/TLS/RTP/SAVPF" (Defined in [RFC5764], Section 9) 1658 o The profile in any "m=" line in any generated answer MUST exactly 1659 match the profile provided in the offer. 1661 o Because DTLS-SRTP is REQUIRED, the choice of SAVP or AVP has no 1662 effect; support for DTLS-SRTP is determined by the presence of one 1663 or more "a=fingerprint" attribute. Note that lack of an 1664 "a=fingerprint" attribute will lead to negotiation failure. 1666 o The use of AVPF or AVP simply controls the timing rules used for 1667 RTCP feedback. If AVPF is provided, or an "a=rtcp-fb" attribute 1668 is present, assume AVPF timing, i.e., a default value of "trr- 1669 int=0". Otherwise, assume that AVPF is being used in an AVP 1670 compatible mode and use a value of "trr-int=4000". 1672 o For data m= sections, implementations MUST support receiving the 1673 "UDP/DTLS/SCTP", "TCP/DTLS/SCTP", or "DTLS/SCTP" (for backwards 1674 compatibility) profiles. 1676 Note that re-offers by JSEP implementations MUST use the correct 1677 profile strings even if the initial offer/answer exchange used an 1678 (incorrect) older profile string. This simplifies JSEP behavior, 1679 with minimal downside, as any remote endpoint that fails to handle 1680 such a re-offer will also fail to handle a JSEP endpoint's initial 1681 offer. 1683 5.2. Constructing an Offer 1685 When createOffer is called, a new SDP description must be created 1686 that includes the functionality specified in 1687 [I-D.ietf-rtcweb-rtp-usage]. The exact details of this process are 1688 explained below. 1690 5.2.1. Initial Offers 1692 When createOffer is called for the first time, the result is known as 1693 the initial offer. 1695 The first step in generating an initial offer is to generate session- 1696 level attributes, as specified in [RFC4566], Section 5. 1697 Specifically: 1699 o The first SDP line MUST be "v=0", as specified in [RFC4566], 1700 Section 5.1 1702 o The second SDP line MUST be an "o=" line, as specified in 1703 [RFC4566], Section 5.2. The value of the field SHOULD 1704 be "-". The sess-id MUST be representable by a 64-bit signed 1705 integer, and the value MUST be less than (2**63)-1. It is 1706 RECOMMENDED that the sess-id be constructed by generating a 64-bit 1707 quantity with the highest bit set to zero and the remaining 63 1708 bits being cryptographically random. The value of the 1709 tuple SHOULD be set to a non- 1710 meaningful address, such as IN IP4 0.0.0.0, to prevent leaking a 1711 local IP address in this field; this problem is discussed in 1712 [I-D.ietf-rtcweb-ip-handling]. As mentioned in [RFC4566], the 1713 entire o= line needs to be unique, but selecting a random number 1714 for is sufficient to accomplish this. 1716 o The third SDP line MUST be a "s=" line, as specified in [RFC4566], 1717 Section 5.3; to match the "o=" line, a single dash SHOULD be used 1718 as the session name, e.g. "s=-". Note that this differs from the 1719 advice in [RFC4566] which proposes a single space, but as both 1720 "o=" and "s=" are meaningless in JSEP, having the same meaningless 1721 value seems clearer. 1723 o Session Information ("i="), URI ("u="), Email Address ("e="), 1724 Phone Number ("p="), Repeat Times ("r="), and Time Zones ("z=") 1725 lines are not useful in this context and SHOULD NOT be included. 1727 o Encryption Keys ("k=") lines do not provide sufficient security 1728 and MUST NOT be included. 1730 o A "t=" line MUST be added, as specified in [RFC4566], Section 5.9; 1731 both and SHOULD be set to zero, e.g. "t=0 1732 0". 1734 o An "a=ice-options" line with the "trickle" and "ice2" options MUST 1735 be added, as specified in [I-D.ietf-ice-trickle], Section 3 and 1736 [RFC8445], Section 10. 1738 o If WebRTC identity is being used, an "a=identity" line as 1739 described in [I-D.ietf-rtcweb-security-arch], Section 5. 1741 The next step is to generate m= sections, as specified in [RFC4566], 1742 Section 5.14. An m= section is generated for each RtpTransceiver 1743 that has been added to the PeerConnection, excluding any stopped 1744 RtpTransceivers; this is done in the order the RtpTransceivers were 1745 added to the PeerConnection. If there are no such RtpTransceivers, 1746 no m= sections are generated; more can be added later, as discussed 1747 in [RFC3264], Section 5. 1749 For each m= section generated for an RtpTransceiver, establish a 1750 mapping between the transceiver and the index of the generated m= 1751 section. 1753 Each m= section, provided it is not marked as bundle-only, MUST 1754 generate a unique set of ICE credentials and gather its own unique 1755 set of ICE candidates. Bundle-only m= sections MUST NOT contain any 1756 ICE credentials and MUST NOT gather any candidates. 1758 For DTLS, all m= sections MUST use all the certificate(s) that have 1759 been specified for the PeerConnection; as a result, they MUST all 1760 have the same [RFC8122] fingerprint value(s), or these value(s) MUST 1761 be session-level attributes. 1763 Each m= section should be generated as specified in [RFC4566], 1764 Section 5.14. For the m= line itself, the following rules MUST be 1765 followed: 1767 o If the m= section is marked as bundle-only, then the port value 1768 MUST be set to 0. Otherwise, the port value is set to the port of 1769 the default ICE candidate for this m= section, but given that no 1770 candidates are available yet, the "dummy" port value of 9 1771 (Discard) MUST be used, as indicated in [I-D.ietf-ice-trickle], 1772 Section 5.1. 1774 o To properly indicate use of DTLS, the field MUST be set to 1775 "UDP/TLS/RTP/SAVPF", as specified in [RFC5764], Section 8. 1777 o If codec preferences have been set for the associated transceiver, 1778 media formats MUST be generated in the corresponding order, and 1779 MUST exclude any codecs not present in the codec preferences. 1781 o Unless excluded by the above restrictions, the media formats MUST 1782 include the mandatory audio/video codecs as specified in 1783 [RFC7874], Section 3, and [RFC7742], Section 5. 1785 The m= line MUST be followed immediately by a "c=" line, as specified 1786 in [RFC4566], Section 5.7. Again, as no candidates are available 1787 yet, the "c=" line must contain the "dummy" value "IN IP4 0.0.0.0", 1788 as defined in [I-D.ietf-ice-trickle], Section 5.1. 1790 [I-D.ietf-mmusic-sdp-mux-attributes] groups SDP attributes into 1791 different categories. To avoid unnecessary duplication when 1792 bundling, attributes of category IDENTICAL or TRANSPORT MUST NOT be 1793 repeated in bundled m= sections, repeating the guidance from 1794 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 8.1. This includes 1795 m= sections for which bundling has been negotiated and is still 1796 desired, as well as m= sections marked as bundle-only. 1798 The following attributes, which are of a category other than 1799 IDENTICAL or TRANSPORT, MUST be included in each m= section: 1801 o An "a=mid" line, as specified in [RFC5888], Section 4. All MID 1802 values MUST be generated in a fashion that does not leak user 1803 information, e.g., randomly or using a per-PeerConnection counter, 1804 and SHOULD be 3 bytes or less, to allow them to efficiently fit 1805 into the RTP header extension defined in 1806 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 14. Note that 1807 this does not set the RtpTransceiver mid property, as that only 1808 occurs when the description is applied. The generated MID value 1809 can be considered a "proposed" MID at this point. 1811 o A direction attribute which is the same as that of the associated 1812 transceiver. 1814 o For each media format on the m= line, "a=rtpmap" and "a=fmtp" 1815 lines, as specified in [RFC4566], Section 6, and [RFC3264], 1816 Section 5.1. 1818 o For each primary codec where RTP retransmission should be used, a 1819 corresponding "a=rtpmap" line indicating "rtx" with the clock rate 1820 of the primary codec and an "a=fmtp" line that references the 1821 payload type of the primary codec, as specified in [RFC4588], 1822 Section 8.1. 1824 o For each supported FEC mechanism, "a=rtpmap" and "a=fmtp" lines, 1825 as specified in [RFC4566], Section 6. The FEC mechanisms that 1826 MUST be supported are specified in [I-D.ietf-rtcweb-fec], 1827 Section 6, and specific usage for each media type is outlined in 1828 Sections 4 and 5. 1830 o If this m= section is for media with configurable durations of 1831 media per packet, e.g., audio, an "a=maxptime" line, indicating 1832 the maximum amount of media, specified in milliseconds, that can 1833 be encapsulated in each packet, as specified in [RFC4566], 1834 Section 6. This value is set to the smallest of the maximum 1835 duration values across all the codecs included in the m= section. 1837 o If this m= section is for video media, and there are known 1838 limitations on the size of images which can be decoded, an 1839 "a=imageattr" line, as specified in Section 3.6. 1841 o For each supported RTP header extension, an "a=extmap" line, as 1842 specified in [RFC5285], Section 5. The list of header extensions 1843 that SHOULD/MUST be supported is specified in 1844 [I-D.ietf-rtcweb-rtp-usage], Section 5.2. Any header extensions 1845 that require encryption MUST be specified as indicated in 1846 [RFC6904], Section 4. 1848 o For each supported RTCP feedback mechanism, an "a=rtcp-fb" line, 1849 as specified in [RFC4585], Section 4.2. The list of RTCP feedback 1850 mechanisms that SHOULD/MUST be supported is specified in 1851 [I-D.ietf-rtcweb-rtp-usage], Section 5.1. 1853 o If the RtpTransceiver has a sendrecv or sendonly direction: 1855 * For each MediaStream that was associated with the transceiver 1856 when it was created via addTrack or addTransceiver, an "a=msid" 1857 line, as specified in [I-D.ietf-mmusic-msid], Section 2, but 1858 omitting the "appdata" field. 1860 o If the RtpTransceiver has a sendrecv or sendonly direction, and 1861 the application has specified RID values or has specified more 1862 than one encoding in the RtpSenders's parameters, an "a=rid" line 1863 for each encoding specified. The "a=rid" line is specified in 1864 [I-D.ietf-mmusic-rid], and its direction MUST be "send". If the 1865 application has chosen a RID value, it MUST be used as the rid- 1866 identifier; otherwise a RID value MUST be generated by the 1867 implementation. RID values MUST be generated in a fashion that 1868 does not leak user information, e.g., randomly or using a per- 1869 PeerConnection counter, and SHOULD be 3 bytes or less, to allow 1870 them to efficiently fit into the RTP header extension defined in 1871 [I-D.ietf-avtext-rid], Section 3. If no encodings have been 1872 specified, or only one encoding is specified but without a RID 1873 value, then no "a=rid" lines are generated. 1875 o If the RtpTransceiver has a sendrecv or sendonly direction and 1876 more than one "a=rid" line has been generated, an "a=simulcast" 1877 line, with direction "send", as defined in 1878 [I-D.ietf-mmusic-sdp-simulcast], Section 6.2. The list of RIDs 1879 MUST include all of the RID identifiers used in the "a=rid" lines 1880 for this m= section. 1882 o If the bundle policy for this PeerConnection is set to "max- 1883 bundle", and this is not the first m= section, or the bundle 1884 policy is set to "balanced", and this is not the first m= section 1885 for this media type, an "a=bundle-only" line. 1887 The following attributes, which are of category IDENTICAL or 1888 TRANSPORT, MUST appear only in "m=" sections which either have a 1889 unique address or which are associated with the bundle-tag. (In 1890 initial offers, this means those "m=" sections which do not contain 1891 an "a=bundle-only" attribute.) 1893 o "a=ice-ufrag" and "a=ice-pwd" lines, as specified in 1894 [I-D.ietf-mmusic-ice-sip-sdp], Section 4.4. 1896 o For each desired digest algorithm, one or more "a=fingerprint" 1897 lines for each of the endpoint's certificates, as specified in 1898 [RFC8122], Section 5. 1900 o An "a=setup" line, as specified in [RFC4145], Section 4, and 1901 clarified for use in DTLS-SRTP scenarios in [RFC5763], Section 5. 1902 The role value in the offer MUST be "actpass". 1904 o An "a=tls-id" line, as specified in [I-D.ietf-mmusic-dtls-sdp], 1905 Section 5.2. 1907 o An "a=rtcp" line, as specified in [RFC3605], Section 2.1, 1908 containing the dummy value "9 IN IP4 0.0.0.0", because no 1909 candidates have yet been gathered. 1911 o An "a=rtcp-mux" line, as specified in [RFC5761], Section 5.1.3. 1913 o If the RTP/RTCP multiplexing policy is "require", an "a=rtcp-mux- 1914 only" line, as specified in [I-D.ietf-mmusic-mux-exclusive], 1915 Section 4. 1917 o An "a=rtcp-rsize" line, as specified in [RFC5506], Section 5. 1919 Lastly, if a data channel has been created, a m= section MUST be 1920 generated for data. The field MUST be set to "application" 1921 and the field MUST be set to "UDP/DTLS/SCTP" 1922 [I-D.ietf-mmusic-sctp-sdp]. The "fmt" value MUST be set to "webrtc- 1923 datachannel" as specified in [I-D.ietf-mmusic-sctp-sdp], Section 4.1. 1925 Within the data m= section, an "a=mid" line MUST be generated and 1926 included as described above, along with an "a=sctp-port" line 1927 referencing the SCTP port number, as defined in 1928 [I-D.ietf-mmusic-sctp-sdp], Section 5.1, and, if appropriate, an 1929 "a=max-message-size" line, as defined in [I-D.ietf-mmusic-sctp-sdp], 1930 Section 6.1. 1932 As discussed above, the following attributes of category IDENTICAL or 1933 TRANSPORT are included only if the data m= section either has a 1934 unique address or is associated with the bundle-tag (e.g., if it is 1935 the only m= section): 1937 o "a=ice-ufrag" 1939 o "a=ice-pwd" 1941 o "a=fingerprint" 1943 o "a=setup" 1945 o "a=tls-id" 1947 Once all m= sections have been generated, a session-level "a=group" 1948 attribute MUST be added as specified in [RFC5888]. This attribute 1949 MUST have semantics "BUNDLE", and MUST include the mid identifiers of 1950 each m= section. The effect of this is that the JSEP implementation 1951 offers all m= sections as one bundle group. However, whether the m= 1952 sections are bundle-only or not depends on the bundle policy. 1954 The next step is to generate session-level lip sync groups as defined 1955 in [RFC5888], Section 7. For each MediaStream referenced by more 1956 than one RtpTransceiver (by passing those MediaStreams as arguments 1957 to the addTrack and addTransceiver methods), a group of type "LS" 1958 MUST be added that contains the mid values for each RtpTransceiver. 1960 Attributes which SDP permits to either be at the session level or the 1961 media level SHOULD generally be at the media level even if they are 1962 identical. This assists development and debugging by making it 1963 easier to understand individual media sections, especially if one of 1964 a set of initially identical attributes is subsequently changed. 1965 However, implementations MAY choose to aggregate attributes at the 1966 session level and JSEP implementations MUST be prepared to receive 1967 attributes in either location. 1969 Attributes other than the ones specified above MAY be included, 1970 except for the following attributes which are specifically 1971 incompatible with the requirements of [I-D.ietf-rtcweb-rtp-usage], 1972 and MUST NOT be included: 1974 o "a=crypto" 1976 o "a=key-mgmt" 1978 o "a=ice-lite" 1980 Note that when bundle is used, any additional attributes that are 1981 added MUST follow the advice in [I-D.ietf-mmusic-sdp-mux-attributes] 1982 on how those attributes interact with bundle. 1984 Note that these requirements are in some cases stricter than those of 1985 SDP. Implementations MUST be prepared to accept compliant SDP even 1986 if it would not conform to the requirements for generating SDP in 1987 this specification. 1989 5.2.2. Subsequent Offers 1991 When createOffer is called a second (or later) time, or is called 1992 after a local description has already been installed, the processing 1993 is somewhat different than for an initial offer. 1995 If the previous offer was not applied using setLocalDescription, 1996 meaning the PeerConnection is still in the "stable" state, the steps 1997 for generating an initial offer should be followed, subject to the 1998 following restriction: 2000 o The fields of the "o=" line MUST stay the same except for the 2001 field, which MUST increment by one on each call 2002 to createOffer if the offer might differ from the output of the 2003 previous call to createOffer; implementations MAY opt to increment 2004 on every call. The value of the generated 2005 is independent of the of the 2006 current local description; in particular, in the case where the 2007 current version is N, an offer is created and applied with version 2008 N+1, and then that offer is rolled back so that the current 2009 version is again N, the next generated offer will still have 2010 version N+2. 2012 Note that if the application creates an offer by reading 2013 currentLocalDescription instead of calling createOffer, the returned 2014 SDP may be different than when setLocalDescription was originally 2015 called, due to the addition of gathered ICE candidates, but the 2016 will not have changed. There are no known 2017 scenarios in which this causes problems, but if this is a concern, 2018 the solution is simply to use createOffer to ensure a unique 2019 . 2021 If the previous offer was applied using setLocalDescription, but a 2022 corresponding answer from the remote side has not yet been applied, 2023 meaning the PeerConnection is still in the "have-local-offer" state, 2024 an offer is generated by following the steps in the "stable" state 2025 above, along with these exceptions: 2027 o The "s=" and "t=" lines MUST stay the same. 2029 o If any RtpTransceiver has been added, and there exists an m= 2030 section with a zero port in the current local description or the 2031 current remote description, that m= section MUST be recycled by 2032 generating an m= section for the added RtpTransceiver as if the m= 2033 section were being added to the session description (including a 2034 new MID value), and placing it at the same index as the m= section 2035 with a zero port. 2037 o If an RtpTransceiver is stopped and is not associated with an m= 2038 section, an m= section MUST NOT be generated for it. This 2039 prevents adding back RtpTransceivers whose m= sections were 2040 recycled and used for a new RtpTransceiver in a previous offer/ 2041 answer exchange, as described above. 2043 o If an RtpTransceiver has been stopped and is associated with an m= 2044 section, and the m= section is not being recycled as described 2045 above, an m= section MUST be generated for it with the port set to 2046 zero and all "a=msid" lines removed. 2048 o For RtpTransceivers that are not stopped, the "a=msid" line(s) 2049 MUST stay the same if they are present in the current description, 2050 regardless of changes to the transceiver's direction or track. If 2051 no "a=msid" line is present in the current description, "a=msid" 2052 line(s) MUST be generated according to the same rules as for an 2053 initial offer. 2055 o Each "m=" and c=" line MUST be filled in with the port, relevant 2056 RTP profile, and address of the default candidate for the m= 2057 section, as described in [I-D.ietf-mmusic-ice-sip-sdp], 2058 Section 3.2.1.2, and clarified in Section 5.1.2. If no RTP 2059 candidates have yet been gathered, dummy values MUST still be 2060 used, as described above. 2062 o Each "a=mid" line MUST stay the same. 2064 o Each "a=ice-ufrag" and "a=ice-pwd" line MUST stay the same, unless 2065 the ICE configuration has changed (either changes to the supported 2066 STUN/TURN servers, or the ICE candidate policy), or the 2067 "IceRestart" option ( Section 5.2.3.1 was specified. If the m= 2068 section is bundled into another m= section, it still MUST NOT 2069 contain any ICE credentials. 2071 o If the m= section is not bundled into another m= section, its 2072 "a=rtcp" attribute line MUST be filled in with the port and 2073 address of the default RTCP candidate, as indicated in [RFC5761], 2074 Section 5.1.3. If no RTCP candidates have yet been gathered, 2075 dummy values MUST be used, as described in the initial offer 2076 section above. 2078 o If the m= section is not bundled into another m= section, for each 2079 candidate that has been gathered during the most recent gathering 2080 phase (see Section 3.5.1), an "a=candidate" line MUST be added, as 2081 defined in [I-D.ietf-mmusic-ice-sip-sdp], Section 4.1. If 2082 candidate gathering for the section has completed, an "a=end-of- 2083 candidates" attribute MUST be added, as described in 2084 [I-D.ietf-ice-trickle], Section 9.3. If the m= section is bundled 2085 into another m= section, both "a=candidate" and "a=end-of- 2086 candidates" MUST be omitted. 2088 o For RtpTransceivers that are still present, the "a=rid" lines MUST 2089 stay the same. 2091 o For RtpTransceivers that are still present, any "a=simulcast" line 2092 MUST stay the same. 2094 If the previous offer was applied using setLocalDescription, and a 2095 corresponding answer from the remote side has been applied using 2096 setRemoteDescription, meaning the PeerConnection is in the "have- 2097 remote-pranswer" or "stable" states, an offer is generated based on 2098 the negotiated session descriptions by following the steps mentioned 2099 for the "have-local-offer" state above. 2101 In addition, for each existing, non-recycled, non-rejected m= section 2102 in the new offer, the following adjustments are made based on the 2103 contents of the corresponding m= section in the current local or 2104 remote description, as appropriate: 2106 o The m= line and corresponding "a=rtpmap" and "a=fmtp" lines MUST 2107 only include media formats which have not been excluded by the 2108 codec preferences of the associated transceiver, and MUST include 2109 all currently available formats. Media formats that were 2110 previously offered but are no longer available (e.g., a shared 2111 hardware codec) MAY be excluded. 2113 o Unless codec preferences have been set for the associated 2114 transceiver, the media formats on the m= line MUST be generated in 2115 the same order as in the most recent answer. Any media formats 2116 that were not present in the most recent answer MUST be added 2117 after all existing formats. 2119 o The RTP header extensions MUST only include those that are present 2120 in the most recent answer. 2122 o The RTCP feedback mechanisms MUST only include those that are 2123 present in the most recent answer, except for the case of format- 2124 specific mechanisms that are referencing a newly-added media 2125 format. 2127 o The "a=rtcp" line MUST NOT be added if the most recent answer 2128 included an "a=rtcp-mux" line. 2130 o The "a=rtcp-mux" line MUST be the same as that in the most recent 2131 answer. 2133 o The "a=rtcp-mux-only" line MUST NOT be added. 2135 o The "a=rtcp-rsize" line MUST NOT be added unless present in the 2136 most recent answer. 2138 o An "a=bundle-only" line MUST NOT be added, as indicated in 2139 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 6. Instead, 2140 JSEP implementations MUST simply omit parameters in the IDENTICAL 2141 and TRANSPORT categories for bundled m= sections, as described in 2142 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 8.1. 2144 o Note that if media m= sections are bundled into a data m= section, 2145 then certain TRANSPORT and IDENTICAL attributes may appear in the 2146 data m= section even if they would otherwise only be appropriate 2147 for a media m= section (e.g., "a=rtcp-mux"). This cannot happen 2148 in initial offers because in the initial offer JSEP 2149 implementations always list media m= sections (if any) before the 2150 data m= section (if any), and at least one of those media m= 2151 sections will not have the "a=bundle-only" attribute. Therefore, 2152 in initial offers, any "a=bundle-only" m= sections will be bundled 2153 into a preceding non-bundle-only media m= section. 2155 The "a=group:BUNDLE" attribute MUST include the MID identifiers 2156 specified in the bundle group in the most recent answer, minus any m= 2157 sections that have been marked as rejected, plus any newly added or 2158 re-enabled m= sections. In other words, the bundle attribute must 2159 contain all m= sections that were previously bundled, as long as they 2160 are still alive, as well as any new m= sections. 2162 "a=group:LS" attributes are generated in the same way as for initial 2163 offers, with the additional stipulation that any lip sync groups that 2164 were present in the most recent answer MUST continue to exist and 2165 MUST contain any previously existing MID identifiers, as long as the 2166 identified m= sections still exist and are not rejected, and the 2167 group still contains at least two MID identifiers. This ensures that 2168 any synchronized "recvonly" m= sections continue to be synchronized 2169 in the new offer. 2171 5.2.3. Options Handling 2173 The createOffer method takes as a parameter an RTCOfferOptions 2174 object. Special processing is performed when generating a SDP 2175 description if the following options are present. 2177 5.2.3.1. IceRestart 2179 If the "IceRestart" option is specified, with a value of "true", the 2180 offer MUST indicate an ICE restart by generating new ICE ufrag and 2181 pwd attributes, as specified in [I-D.ietf-mmusic-ice-sip-sdp], 2182 Section 3.4.1.1.1. If this option is specified on an initial offer, 2183 it has no effect (since a new ICE ufrag and pwd are already 2184 generated). Similarly, if the ICE configuration has changed, this 2185 option has no effect, since new ufrag and pwd attributes will be 2186 generated automatically. This option is primarily useful for 2187 reestablishing connectivity in cases where failures are detected by 2188 the application. 2190 5.2.3.2. VoiceActivityDetection 2192 Silence suppression, also known as discontinuous transmission 2193 ("DTX"), can reduce the bandwidth used for audio by switching to a 2194 special encoding when voice activity is not detected, at the cost of 2195 some fidelity. 2197 If the "VoiceActivityDetection" option is specified, with a value of 2198 "true", the offer MUST indicate support for silence suppression in 2199 the audio it receives by including comfort noise ("CN") codecs for 2200 each offered audio codec, as specified in [RFC3389], Section 5.1, 2201 except for codecs that have their own internal silence suppression 2202 support. For codecs that have their own internal silence suppression 2203 support, the appropriate fmtp parameters for that codec MUST be 2204 specified to indicate that silence suppression for received audio is 2205 desired. For example, when using the Opus codec [RFC6716], the 2206 "usedtx=1" parameter, specified in [RFC7587], would be used in the 2207 offer. 2209 If the "VoiceActivityDetection" option is specified, with a value of 2210 "false", the JSEP implementation MUST NOT emit "CN" codecs. For 2211 codecs that have their own internal silence suppression support, the 2212 appropriate fmtp parameters for that codec MUST be specified to 2213 indicate that silence suppression for received audio is not desired. 2214 For example, when using the Opus codec, the "usedtx=0" parameter 2215 would be specified in the offer. In addition, the implementation 2216 MUST NOT use silence suppression for media it generates, regardless 2217 of whether the "CN" codecs or related fmtp parameters appear in the 2218 peer's description. The impact of these rules is that silence 2219 suppression in JSEP depends on mutual agreement of both sides, which 2220 ensures consistent handling regardless of which codec is used. 2222 The "VoiceActivityDetection" option does not have any impact on the 2223 setting of the "vad" value in the signaling of the client to mixer 2224 audio level header extension described in [RFC6464], Section 4. 2226 5.3. Generating an Answer 2228 When createAnswer is called, a new SDP description must be created 2229 that is compatible with the supplied remote description as well as 2230 the requirements specified in [I-D.ietf-rtcweb-rtp-usage]. The exact 2231 details of this process are explained below. 2233 5.3.1. Initial Answers 2235 When createAnswer is called for the first time after a remote 2236 description has been provided, the result is known as the initial 2237 answer. If no remote description has been installed, an answer 2238 cannot be generated, and an error MUST be returned. 2240 Note that the remote description SDP may not have been created by a 2241 JSEP endpoint and may not conform to all the requirements listed in 2242 Section 5.2. For many cases, this is not a problem. However, if any 2243 mandatory SDP attributes are missing, or functionality listed as 2244 mandatory-to-use above is not present, this MUST be treated as an 2245 error, and MUST cause the affected m= sections to be marked as 2246 rejected. 2248 The first step in generating an initial answer is to generate 2249 session-level attributes. The process here is identical to that 2250 indicated in the initial offers section above, except that the 2251 "a=ice-options" line, with the "trickle" option as specified in 2252 [I-D.ietf-ice-trickle], Section 3, and the "ice2" option as specified 2253 in [RFC8445], Section 10, is only included if such an option was 2254 present in the offer. 2256 The next step is to generate session-level lip sync groups, as 2257 defined in [RFC5888], Section 7. For each group of type "LS" present 2258 in the offer, select the local RtpTransceivers that are referenced by 2259 the MID values in the specified group, and determine which of them 2260 either reference a common local MediaStream (specified in the calls 2261 to addTrack/addTransceiver used to create them), or have no 2262 MediaStream to reference because they were not created by addTrack/ 2263 addTransceiver. If at least two such RtpTransceivers exist, a group 2264 of type "LS" with the mid values of these RtpTransceivers MUST be 2265 added. Otherwise the offered "LS" group MUST be ignored and no 2266 corresponding group generated in the answer. 2268 As a simple example, consider the following offer of a single audio 2269 and single video track contained in the same MediaStream. SDP lines 2270 not relevant to this example have been removed for clarity. As 2271 explained in Section 5.2, a group of type "LS" has been added that 2272 references each track's RtpTransceiver. 2274 a=group:LS a1 v1 2275 m=audio 10000 UDP/TLS/RTP/SAVPF 0 2276 a=mid:a1 2277 a=msid:ms1 2278 m=video 10001 UDP/TLS/RTP/SAVPF 96 2279 a=mid:v1 2280 a=msid:ms1 2282 If the answerer uses a single MediaStream when it adds its tracks, 2283 both of its transceivers will reference this stream, and so the 2284 subsequent answer will contain a "LS" group identical to that in the 2285 offer, as shown below: 2287 a=group:LS a1 v1 2288 m=audio 20000 UDP/TLS/RTP/SAVPF 0 2289 a=mid:a1 2290 a=msid:ms2 2291 m=video 20001 UDP/TLS/RTP/SAVPF 96 2292 a=mid:v1 2293 a=msid:ms2 2295 However, if the answerer groups its tracks into separate 2296 MediaStreams, its transceivers will reference different streams, and 2297 so the subsequent answer will not contain a "LS" group. 2299 m=audio 20000 UDP/TLS/RTP/SAVPF 0 2300 a=mid:a1 2301 a=msid:ms2a 2302 m=video 20001 UDP/TLS/RTP/SAVPF 96 2303 a=mid:v1 2304 a=msid:ms2b 2306 Finally, if the answerer does not add any tracks, its transceivers 2307 will not reference any MediaStreams, causing the preferences of the 2308 offerer to be maintained, and so the subsequent answer will contain 2309 an identical "LS" group. 2311 a=group:LS a1 v1 2312 m=audio 20000 UDP/TLS/RTP/SAVPF 0 2313 a=mid:a1 2314 a=recvonly 2315 m=video 20001 UDP/TLS/RTP/SAVPF 96 2316 a=mid:v1 2317 a=recvonly 2319 The Section 7.2 example later in this document shows a more involved 2320 case of "LS" group generation. 2322 The next step is to generate m= sections for each m= section that is 2323 present in the remote offer, as specified in [RFC3264], Section 6. 2324 For the purposes of this discussion, any session-level attributes in 2325 the offer that are also valid as media-level attributes are 2326 considered to be present in each m= section. Each offered m= section 2327 will have an associated RtpTransceiver, as described in Section 5.10. 2328 If there are more RtpTransceivers than there are m= sections, the 2329 unmatched RtpTransceivers will need to be associated in a subsequent 2330 offer. 2332 For each offered m= section, if any of the following conditions are 2333 true, the corresponding m= section in the answer MUST be marked as 2334 rejected by setting the port in the m= line to zero, as indicated in 2335 [RFC3264], Section 6, and further processing for this m= section can 2336 be skipped: 2338 o The associated RtpTransceiver has been stopped. 2340 o None of the offered media formats are supported and, if 2341 applicable, allowed by codec preferences. 2343 o The bundle policy is "max-bundle", and this is not the first m= 2344 section or in the same bundle group as the first m= section. 2346 o The bundle policy is "balanced", and this is not the first m= 2347 section for this media type or in the same bundle group as the 2348 first m= section for this media type. 2350 o This m= section is in a bundle group, and the group's offerer 2351 tagged m= section is being rejected due to one of the above 2352 reasons. This requires all m= sections in the bundle group to be 2353 rejected, as specified in 2354 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 7.3.3. 2356 Otherwise, each m= section in the answer should then be generated as 2357 specified in [RFC3264], Section 6.1. For the m= line itself, the 2358 following rules must be followed: 2360 o The port value would normally be set to the port of the default 2361 ICE candidate for this m= section, but given that no candidates 2362 are available yet, the "dummy" port value of 9 (Discard) MUST be 2363 used, as indicated in [I-D.ietf-ice-trickle], Section 5.1. 2365 o The field MUST be set to exactly match the field 2366 for the corresponding m= line in the offer. 2368 o If codec preferences have been set for the associated transceiver, 2369 media formats MUST be generated in the corresponding order, 2370 regardless of what was offered, and MUST exclude any codecs not 2371 present in the codec preferences. 2373 o Otherwise, the media formats on the m= line MUST be generated in 2374 the same order as those offered in the current remote description, 2375 excluding any currently unsupported formats. Any currently 2376 available media formats that are not present in the current remote 2377 description MUST be added after all existing formats. 2379 o In either case, the media formats in the answer MUST include at 2380 least one format that is present in the offer, but MAY include 2381 formats that are locally supported but not present in the offer, 2382 as mentioned in [RFC3264], Section 6.1. If no common format 2383 exists, the m= section is rejected as described above. 2385 The m= line MUST be followed immediately by a "c=" line, as specified 2386 in [RFC4566], Section 5.7. Again, as no candidates are available 2387 yet, the "c=" line must contain the "dummy" value "IN IP4 0.0.0.0", 2388 as defined in [I-D.ietf-ice-trickle], Section 5.1. 2390 If the offer supports bundle, all m= sections to be bundled must use 2391 the same ICE credentials and candidates; all m= sections not being 2392 bundled must use unique ICE credentials and candidates. Each m= 2393 section MUST contain the following attributes (which are of attribute 2394 types other than IDENTICAL and TRANSPORT): 2396 o If and only if present in the offer, an "a=mid" line, as specified 2397 in [RFC5888], Section 9.1. The "mid" value MUST match that 2398 specified in the offer. 2400 o A direction attribute, determined by applying the rules regarding 2401 the offered direction specified in [RFC3264], Section 6.1, and 2402 then intersecting with the direction of the associated 2403 RtpTransceiver. For example, in the case where an m= section is 2404 offered as "sendonly", and the local transceiver is set to 2405 "sendrecv", the result in the answer is a "recvonly" direction. 2407 o For each media format on the m= line, "a=rtpmap" and "a=fmtp" 2408 lines, as specified in [RFC4566], Section 6, and [RFC3264], 2409 Section 6.1. 2411 o If "rtx" is present in the offer, for each primary codec where RTP 2412 retransmission should be used, a corresponding "a=rtpmap" line 2413 indicating "rtx" with the clock rate of the primary codec and an 2414 "a=fmtp" line that references the payload type of the primary 2415 codec, as specified in [RFC4588], Section 8.1. 2417 o For each supported FEC mechanism, "a=rtpmap" and "a=fmtp" lines, 2418 as specified in [RFC4566], Section 6. The FEC mechanisms that 2419 MUST be supported are specified in [I-D.ietf-rtcweb-fec], 2420 Section 6, and specific usage for each media type is outlined in 2421 Sections 4 and 5. 2423 o If this m= section is for media with configurable durations of 2424 media per packet, e.g., audio, an "a=maxptime" line, as described 2425 in Section 5.2. 2427 o If this m= section is for video media, and there are known 2428 limitations on the size of images which can be decoded, an 2429 "a=imageattr" line, as specified in Section 3.6. 2431 o For each supported RTP header extension that is present in the 2432 offer, an "a=extmap" line, as specified in [RFC5285], Section 5. 2433 The list of header extensions that SHOULD/MUST be supported is 2434 specified in [I-D.ietf-rtcweb-rtp-usage], Section 5.2. Any header 2435 extensions that require encryption MUST be specified as indicated 2436 in [RFC6904], Section 4. 2438 o For each supported RTCP feedback mechanism that is present in the 2439 offer, an "a=rtcp-fb" line, as specified in [RFC4585], 2440 Section 4.2. The list of RTCP feedback mechanisms that SHOULD/ 2441 MUST be supported is specified in [I-D.ietf-rtcweb-rtp-usage], 2442 Section 5.1. 2444 o If the RtpTransceiver has a sendrecv or sendonly direction: 2446 * For each MediaStream that was associated with the transceiver 2447 when it was created via addTrack or addTransceiver, an "a=msid" 2448 line, as specified in [I-D.ietf-mmusic-msid], Section 2, but 2449 omitting the "appdata" field. 2451 Each m= section which is not bundled into another m= section, MUST 2452 contain the following attributes (which are of category IDENTICAL or 2453 TRANSPORT): 2455 o "a=ice-ufrag" and "a=ice-pwd" lines, as specified in 2456 [I-D.ietf-mmusic-ice-sip-sdp], Section 4.4. 2458 o For each desired digest algorithm, one or more "a=fingerprint" 2459 lines for each of the endpoint's certificates, as specified in 2460 [RFC8122], Section 5. 2462 o An "a=setup" line, as specified in [RFC4145], Section 4, and 2463 clarified for use in DTLS-SRTP scenarios in [RFC5763], Section 5. 2464 The role value in the answer MUST be "active" or "passive". When 2465 the offer contains the "actpass" value, as will always be the case 2466 with JSEP endpoints, the answerer SHOULD use the "active" role. 2467 Offers from non-JSEP endpoints MAY send other values for 2468 "a=setup", in which case the answer MUST use a value consistent 2469 with the value in the offer. 2471 o An "a=tls-id" line, as specified in [I-D.ietf-mmusic-dtls-sdp], 2472 Section 5.3. 2474 o If present in the offer, an "a=rtcp-mux" line, as specified in 2475 [RFC5761], Section 5.1.3. Otherwise, an "a=rtcp" line, as 2476 specified in [RFC3605], Section 2.1, containing the dummy value "9 2477 IN IP4 0.0.0.0" (because no candidates have yet been gathered). 2479 o If present in the offer, an "a=rtcp-rsize" line, as specified in 2480 [RFC5506], Section 5. 2482 If a data channel m= section has been offered, a m= section MUST also 2483 be generated for data. The field MUST be set to 2484 "application" and the and fields MUST be set to exactly 2485 match the fields in the offer. 2487 Within the data m= section, an "a=mid" line MUST be generated and 2488 included as described above, along with an "a=sctp-port" line 2489 referencing the SCTP port number, as defined in 2490 [I-D.ietf-mmusic-sctp-sdp], Section 5.1, and, if appropriate, an 2491 "a=max-message-size" line, as defined in [I-D.ietf-mmusic-sctp-sdp], 2492 Section 6.1. 2494 As discussed above, the following attributes of category IDENTICAL or 2495 TRANSPORT are included only if the data m= section is not bundled 2496 into another m= section: 2498 o "a=ice-ufrag" 2500 o "a=ice-pwd" 2502 o "a=fingerprint" 2504 o "a=setup" 2506 o "a=tls-id" 2508 Note that if media m= sections are bundled into a data m= section, 2509 then certain TRANSPORT and IDENTICAL attributes may also appear in 2510 the data m= section even if they would otherwise only be appropriate 2511 for a media m= section (e.g., "a=rtcp-mux"). 2513 If "a=group" attributes with semantics of "BUNDLE" are offered, 2514 corresponding session-level "a=group" attributes MUST be added as 2515 specified in [RFC5888]. These attributes MUST have semantics 2516 "BUNDLE", and MUST include the all mid identifiers from the offered 2517 bundle groups that have not been rejected. Note that regardless of 2518 the presence of "a=bundle-only" in the offer, no m= sections in the 2519 answer should have an "a=bundle-only" line. 2521 Attributes that are common between all m= sections MAY be moved to 2522 session-level, if explicitly defined to be valid at session-level. 2524 The attributes prohibited in the creation of offers are also 2525 prohibited in the creation of answers. 2527 5.3.2. Subsequent Answers 2529 When createAnswer is called a second (or later) time, or is called 2530 after a local description has already been installed, the processing 2531 is somewhat different than for an initial answer. 2533 If the previous answer was not applied using setLocalDescription, 2534 meaning the PeerConnection is still in the "have-remote-offer" state, 2535 the steps for generating an initial answer should be followed, 2536 subject to the following restriction: 2538 o The fields of the "o=" line MUST stay the same except for the 2539 field, which MUST increment if the session 2540 description changes in any way from the previously generated 2541 answer. 2543 If any session description was previously supplied to 2544 setLocalDescription, an answer is generated by following the steps in 2545 the "have-remote-offer" state above, along with these exceptions: 2547 o The "s=" and "t=" lines MUST stay the same. 2549 o Each "m=" and c=" line MUST be filled in with the port and address 2550 of the default candidate for the m= section, as described in 2551 [I-D.ietf-mmusic-ice-sip-sdp], Section 3.2.1.2. Note that in 2552 certain cases, the m= line protocol may not match that of the 2553 default candidate, because the m= line protocol value MUST match 2554 what was supplied in the offer, as described above. 2556 o Each "a=ice-ufrag" and "a=ice-pwd" line MUST stay the same, unless 2557 the m= section is restarting, in which case new ICE credentials 2558 must be created as specified in [I-D.ietf-mmusic-ice-sip-sdp], 2559 Section 3.4.1.1.1. If the m= section is bundled into another m= 2560 section, it still MUST NOT contain any ICE credentials. 2562 o Each "a=tls-id" line MUST stay the same unless the offerer's 2563 "a=tls-id" line changed, in which case a new "a=tls-id" value MUST 2564 be created, as described in [I-D.ietf-mmusic-dtls-sdp], 2565 Section 5.2. 2567 o Each "a=setup" line MUST use an "active" or "passive" role value 2568 consistent with the existing DTLS association, if the association 2569 is being continued by the offerer. 2571 o RTCP multiplexing must be used, and an "a=rtcp-mux" line inserted 2572 if and only if the m= section previously used RTCP multiplexing. 2574 o If the m= section is not bundled into another m= section and RTCP 2575 multiplexing is not active, an "a=rtcp" attribute line MUST be 2576 filled in with the port and address of the default RTCP candidate. 2577 If no RTCP candidates have yet been gathered, dummy values MUST be 2578 used, as described in the initial answer section above. 2580 o If the m= section is not bundled into another m= section, for each 2581 candidate that has been gathered during the most recent gathering 2582 phase (see Section 3.5.1), an "a=candidate" line MUST be added, as 2583 defined in [I-D.ietf-mmusic-ice-sip-sdp], Section 4.1. If 2584 candidate gathering for the section has completed, an "a=end-of- 2585 candidates" attribute MUST be added, as described in 2586 [I-D.ietf-ice-trickle], Section 9.3. If the m= section is bundled 2587 into another m= section, both "a=candidate" and "a=end-of- 2588 candidates" MUST be omitted. 2590 o For RtpTransceivers that are not stopped, the "a=msid" line(s) 2591 MUST stay the same, regardless of changes to the transceiver's 2592 direction or track. If no "a=msid" line is present in the current 2593 description, "a=msid" line(s) MUST be generated according to the 2594 same rules as for an initial answer. 2596 5.3.3. Options Handling 2598 The createAnswer method takes as a parameter an RTCAnswerOptions 2599 object. The set of parameters for RTCAnswerOptions is different than 2600 those supported in RTCOfferOptions; the IceRestart option is 2601 unnecessary, as ICE credentials will automatically be changed for all 2602 m= sections where the offerer chose to perform ICE restart. 2604 The following options are supported in RTCAnswerOptions. 2606 5.3.3.1. VoiceActivityDetection 2608 Silence suppression in the answer is handled as described in 2609 Section 5.2.3.2, with one exception: if support for silence 2610 suppression was not indicated in the offer, the 2611 VoiceActivityDetection parameter has no effect, and the answer should 2612 be generated as if VoiceActivityDetection was set to false. This is 2613 done on a per-codec basis (e.g., if the offerer somehow offered 2614 support for CN but set "usedtx=0" for Opus, setting 2615 VoiceActivityDetection to true would result in an answer with CN 2616 codecs and "usedtx=0"). The impact of this rule is that an answerer 2617 will not try to use silence suppression with any endpoint that does 2618 not offer it, making silence suppression support bilateral even with 2619 non-JSEP endpoints. 2621 5.4. Modifying an Offer or Answer 2623 The SDP returned from createOffer or createAnswer MUST NOT be changed 2624 before passing it to setLocalDescription. If precise control over 2625 the SDP is needed, the aforementioned createOffer/createAnswer 2626 options or RtpTransceiver APIs MUST be used. 2628 After calling setLocalDescription with an offer or answer, the 2629 application MAY modify the SDP to reduce its capabilities before 2630 sending it to the far side, as long as it follows the rules above 2631 that define a valid JSEP offer or answer. Likewise, an application 2632 that has received an offer or answer from a peer MAY modify the 2633 received SDP, subject to the same constraints, before calling 2634 setRemoteDescription. 2636 As always, the application is solely responsible for what it sends to 2637 the other party, and all incoming SDP will be processed by the JSEP 2638 implementation to the extent of its capabilities. It is an error to 2639 assume that all SDP is well-formed; however, one should be able to 2640 assume that any implementation of this specification will be able to 2641 process, as a remote offer or answer, unmodified SDP coming from any 2642 other implementation of this specification. 2644 5.5. Processing a Local Description 2646 When a SessionDescription is supplied to setLocalDescription, the 2647 following steps MUST be performed: 2649 o If the description is of type "rollback", follow the processing 2650 defined in Section 5.7 and skip the processing described in the 2651 rest of this section. 2653 o Otherwise, the type of the SessionDescription is checked against 2654 the current state of the PeerConnection: 2656 * If the type is "offer", the PeerConnection state MUST be either 2657 "stable" or "have-local-offer". 2659 * If the type is "pranswer" or "answer", the PeerConnection state 2660 MUST be either "have-remote-offer" or "have-local-pranswer". 2662 o If the type is not correct for the current state, processing MUST 2663 stop and an error MUST be returned. 2665 o The SessionDescription is then checked to ensure that its contents 2666 are identical to those generated in the last call to createOffer/ 2667 createAnswer, and thus have not been altered, as discussed in 2668 Section 5.4; otherwise, processing MUST stop and an error MUST be 2669 returned. 2671 o Next, the SessionDescription is parsed into a data structure, as 2672 described in Section 5.8 below. 2674 o Finally, the parsed SessionDescription is applied as described in 2675 Section 5.9 below. 2677 5.6. Processing a Remote Description 2679 When a SessionDescription is supplied to setRemoteDescription, the 2680 following steps MUST be performed: 2682 o If the description is of type "rollback", follow the processing 2683 defined in Section 5.7 and skip the processing described in the 2684 rest of this section. 2686 o Otherwise, the type of the SessionDescription is checked against 2687 the current state of the PeerConnection: 2689 * If the type is "offer", the PeerConnection state MUST be either 2690 "stable" or "have-remote-offer". 2692 * If the type is "pranswer" or "answer", the PeerConnection state 2693 MUST be either "have-local-offer" or "have-remote-pranswer". 2695 o If the type is not correct for the current state, processing MUST 2696 stop and an error MUST be returned. 2698 o Next, the SessionDescription is parsed into a data structure, as 2699 described in Section 5.8 below. If parsing fails for any reason, 2700 processing MUST stop and an error MUST be returned. 2702 o Finally, the parsed SessionDescription is applied as described in 2703 Section 5.10 below. 2705 5.7. Processing a Rollback 2707 A rollback may be performed if the PeerConnection is in any state 2708 except for "stable". This means that both offers and provisional 2709 answers can be rolled back. Rollback can only be used to cancel 2710 proposed changes; there is no support for rolling back from a stable 2711 state to a previous stable state. If a rollback is attempted in the 2712 "stable" state, processing MUST stop and an error MUST be returned. 2713 Note that this implies that once the answerer has performed 2714 setLocalDescription with his answer, this cannot be rolled back. 2716 The effect of rollback MUST be the same regardless of whether 2717 setLocalDescription or setRemoteDescription is called. 2719 In order to process rollback, a JSEP implementation abandons the 2720 current offer/answer transaction, sets the signaling state to 2721 "stable", and sets the pending local and/or remote description (see 2722 Section 4.1.12 and Section 4.1.14) to null. Any resources or 2723 candidates that were allocated by the abandoned local description are 2724 discarded; any media that is received is processed according to the 2725 previous local and remote descriptions. 2727 A rollback disassociates any RtpTransceivers that were associated 2728 with m= sections by the application of the rolled-back session 2729 description (see Section 5.10 and Section 5.9). This means that some 2730 RtpTransceivers that were previously associated will no longer be 2731 associated with any m= section; in such cases, the value of the 2732 RtpTransceiver's mid property MUST be set to null, and the mapping 2733 between the transceiver and its m= section index MUST be discarded. 2734 RtpTransceivers that were created by applying a remote offer that was 2735 subsequently rolled back MUST be stopped and removed from the 2736 PeerConnection. However, a RtpTransceiver MUST NOT be removed if a 2737 track was attached to the RtpTransceiver via the addTrack method. 2738 This is so that an application may call addTrack, then call 2739 setRemoteDescription with an offer, then roll back that offer, then 2740 call createOffer and have a m= section for the added track appear in 2741 the generated offer. 2743 5.8. Parsing a Session Description 2745 The SDP contained in the session description object consists of a 2746 sequence of text lines, each containing a key-value expression, as 2747 described in [RFC4566], Section 5. The SDP is read, line-by-line, 2748 and converted to a data structure that contains the deserialized 2749 information. However, SDP allows many types of lines, not all of 2750 which are relevant to JSEP applications. For each line, the 2751 implementation will first ensure it is syntactically correct 2752 according to its defining ABNF, check that it conforms to [RFC4566] 2753 and [RFC3264] semantics, and then either parse and store or discard 2754 the provided value, as described below. 2756 If any line is not well-formed, or cannot be parsed as described, the 2757 parser MUST stop with an error and reject the session description, 2758 even if the value is to be discarded. This ensures that 2759 implementations do not accidentally misinterpret ambiguous SDP. 2761 5.8.1. Session-Level Parsing 2763 First, the session-level lines are checked and parsed. These lines 2764 MUST occur in a specific order, and with a specific syntax, as 2765 defined in [RFC4566], Section 5. Note that while the specific line 2766 types (e.g. "v=", "c=") MUST occur in the defined order, lines of the 2767 same type (typically "a=") can occur in any order. 2769 The following non-attribute lines are not meaningful in the JSEP 2770 context and MAY be discarded once they have been checked. 2772 The "c=" line MUST be checked for syntax but its value is only 2773 used for ICE mismatch detection, as defined in [RFC8445], 2774 Section 5.4. Note that JSEP implementations should never 2775 encounter this condition because ICE is required for WebRTC. 2777 The "i=", "u=", "e=", "p=", "t=", "r=", "z=", and "k=" lines are 2778 not used by this specification; they MUST be checked for syntax 2779 but their values are not used. 2781 The remaining non-attribute lines are processed as follows: 2783 The "v=" line MUST have a version of 0, as specified in [RFC4566], 2784 Section 5.1. 2786 The "o=" line MUST be parsed as specified in [RFC4566], 2787 Section 5.2. 2789 The "b=" line, if present, MUST be parsed as specified in 2790 [RFC4566], Section 5.8, and the bwtype and bandwidth values 2791 stored. 2793 Finally, the attribute lines are processed. Specific processing MUST 2794 be applied for the following session-level attribute ("a=") lines: 2796 o Any "a=group" lines are parsed as specified in [RFC5888], 2797 Section 5, and the group's semantics and mids are stored. 2799 o If present, a single "a=ice-lite" line is parsed as specified in 2800 [I-D.ietf-mmusic-ice-sip-sdp], Section 4.3, and a value indicating 2801 the presence of ice-lite is stored. 2803 o If present, a single "a=ice-ufrag" line is parsed as specified in 2804 [I-D.ietf-mmusic-ice-sip-sdp], Section 4.4, and the ufrag value is 2805 stored. 2807 o If present, a single "a=ice-pwd" line is parsed as specified in 2808 [I-D.ietf-mmusic-ice-sip-sdp], Section 4.4, and the password value 2809 is stored. 2811 o If present, a single "a=ice-options" line is parsed as specified 2812 in [I-D.ietf-mmusic-ice-sip-sdp], Section 4.6, and the set of 2813 specified options is stored. 2815 o Any "a=fingerprint" lines are parsed as specified in [RFC8122], 2816 Section 5, and the set of fingerprint and algorithm values is 2817 stored. 2819 o If present, a single "a=setup" line is parsed as specified in 2820 [RFC4145], Section 4, and the setup value is stored. 2822 o If present, a single "a=tls-id" line is parsed as specified in 2823 [I-D.ietf-mmusic-dtls-sdp] Section 5, and the tls-id value is 2824 stored. 2826 o Any "a=identity" lines are parsed and the identity values stored 2827 for subsequent verification, as specified 2828 [I-D.ietf-rtcweb-security-arch], Section 5. 2830 o Any "a=extmap" lines are parsed as specified in [RFC5285], 2831 Section 5, and their values are stored. 2833 Other attributes that are not relevant to JSEP may also be present, 2834 and implementations SHOULD process any that they recognize. As 2835 required by [RFC4566], Section 5.13, unknown attribute lines MUST be 2836 ignored. 2838 Once all the session-level lines have been parsed, processing 2839 continues with the lines in m= sections. 2841 5.8.2. Media Section Parsing 2843 Like the session-level lines, the media section lines MUST occur in 2844 the specific order and with the specific syntax defined in [RFC4566], 2845 Section 5. 2847 The "m=" line itself MUST be parsed as described in [RFC4566], 2848 Section 5.14, and the media, port, proto, and fmt values stored. 2850 Following the "m=" line, specific processing MUST be applied for the 2851 following non-attribute lines: 2853 o As with the "c=" line at the session level, the "c=" line MUST be 2854 parsed according to [RFC4566], Section 5.7, but its value is not 2855 used. 2857 o The "b=" line, if present, MUST be parsed as specified in 2858 [RFC4566], Section 5.8, and the bwtype and bandwidth values 2859 stored. 2861 Specific processing MUST also be applied for the following attribute 2862 lines: 2864 o If present, a single "a=ice-ufrag" line is parsed as specified in 2865 [I-D.ietf-mmusic-ice-sip-sdp], Section 4.4, and the ufrag value is 2866 stored. 2868 o If present, a single "a=ice-pwd" line is parsed as specified in 2869 [I-D.ietf-mmusic-ice-sip-sdp], Section 4.4, and the password value 2870 is stored. 2872 o If present, a single "a=ice-options" line is parsed as specified 2873 in [I-D.ietf-mmusic-ice-sip-sdp], Section 4.6, and the set of 2874 specified options is stored. 2876 o Any "a=candidate" attributes MUST be parsed as specified in 2877 [I-D.ietf-mmusic-ice-sip-sdp], Section 4.1, and their values 2878 stored. 2880 o Any "a=remote-candidates" attributes MUST be parsed as specified 2881 in [I-D.ietf-mmusic-ice-sip-sdp], Section 4.2, but their values 2882 are ignored. 2884 o If present, a single "a=end-of-candidates" attribute MUST be 2885 parsed as specified in [I-D.ietf-ice-trickle], Section 8.2, and 2886 its presence or absence flagged and stored. 2888 o Any "a=fingerprint" lines are parsed as specified in [RFC8122], 2889 Section 5, and the set of fingerprint and algorithm values is 2890 stored. 2892 If the "m=" proto value indicates use of RTP, as described in 2893 Section 5.1.2 above, the following attribute lines MUST be processed: 2895 o The "m=" fmt value MUST be parsed as specified in [RFC4566], 2896 Section 5.14, and the individual values stored. 2898 o Any "a=rtpmap" or "a=fmtp" lines MUST be parsed as specified in 2899 [RFC4566], Section 6, and their values stored. 2901 o If present, a single "a=ptime" line MUST be parsed as described in 2902 [RFC4566], Section 6, and its value stored. 2904 o If present, a single "a=maxptime" line MUST be parsed as described 2905 in [RFC4566], Section 6, and its value stored. 2907 o If present, a single direction attribute line (e.g. "a=sendrecv") 2908 MUST be parsed as described in [RFC4566], Section 6, and its value 2909 stored. 2911 o Any "a=ssrc" attributes MUST be parsed as specified in [RFC5576], 2912 Section 4.1, and their values stored. 2914 o Any "a=extmap" attributes MUST be parsed as specified in 2915 [RFC5285], Section 5, and their values stored. 2917 o Any "a=rtcp-fb" attributes MUST be parsed as specified in 2918 [RFC4585], Section 4.2., and their values stored. 2920 o If present, a single "a=rtcp-mux" attribute MUST be parsed as 2921 specified in [RFC5761], Section 5.1.3, and its presence or absence 2922 flagged and stored. 2924 o If present, a single "a=rtcp-mux-only" attribute MUST be parsed as 2925 specified in [I-D.ietf-mmusic-mux-exclusive], Section 3, and its 2926 presence or absence flagged and stored. 2928 o If present, a single "a=rtcp-rsize" attribute MUST be parsed as 2929 specified in [RFC5506], Section 5, and its presence or absence 2930 flagged and stored. 2932 o If present, a single "a=rtcp" attribute MUST be parsed as 2933 specified in [RFC3605], Section 2.1, but its value is ignored, as 2934 this information is superfluous when using ICE. 2936 o If present, "a=msid" attributes MUST be parsed as specified in 2937 [I-D.ietf-mmusic-msid], Section 3.2, and their values stored, 2938 ignoring any "appdata" field. If no "a=msid" attributes are 2939 present, a random msid-id value is generated for a "default" 2940 MediaStream for the session, if not already present, and this 2941 value is stored. 2943 o Any "a=imageattr" attributes MUST be parsed as specified in 2944 [RFC6236], Section 3, and their values stored. 2946 o Any "a=rid" lines MUST be parsed as specified in 2947 [I-D.ietf-mmusic-rid], Section 10, and their values stored. 2949 o If present, a single "a=simulcast" line MUST be parsed as 2950 specified in [I-D.ietf-mmusic-sdp-simulcast], and its values 2951 stored. 2953 Otherwise, if the "m=" proto value indicates use of SCTP, the 2954 following attribute lines MUST be processed: 2956 o The "m=" fmt value MUST be parsed as specified in 2957 [I-D.ietf-mmusic-sctp-sdp], Section 4.3, and the application 2958 protocol value stored. 2960 o An "a=sctp-port" attribute MUST be present, and it MUST be parsed 2961 as specified in [I-D.ietf-mmusic-sctp-sdp], Section 5.2, and the 2962 value stored. 2964 o If present, a single "a=max-message-size" attribute MUST be parsed 2965 as specified in [I-D.ietf-mmusic-sctp-sdp], Section 6, and the 2966 value stored. Otherwise, use the specified default. 2968 Other attributes that are not relevant to JSEP may also be present, 2969 and implementations SHOULD process any that they recognize. As 2970 required by [RFC4566], Section 5.13, unknown attribute lines MUST be 2971 ignored. 2973 5.8.3. Semantics Verification 2975 Assuming parsing completes successfully, the parsed description is 2976 then evaluated to ensure internal consistency as well as proper 2977 support for mandatory features. Specifically, the following checks 2978 are performed: 2980 o For each m= section, valid values for each of the mandatory-to-use 2981 features enumerated in Section 5.1.1 MUST be present. These 2982 values MAY either be present at the media level, or inherited from 2983 the session level. 2985 * ICE ufrag and password values, which MUST comply with the size 2986 limits specified in [I-D.ietf-mmusic-ice-sip-sdp], Section 4.4. 2988 * tls-id value, which MUST be set according to 2989 [I-D.ietf-mmusic-dtls-sdp], Section 5. If this is a re-offer 2990 or a response to a re-offer and the tls-id value is different 2991 from that presently in use, the DTLS connection is not being 2992 continued and the remote description MUST be part of an ICE 2993 restart, together with new ufrag and password values. 2995 * DTLS setup value, which MUST be set according to the rules 2996 specified in [RFC5763], Section 5 and MUST be consistent with 2997 the selected role of the current DTLS connection, if one exists 2998 and is being continued. 3000 * DTLS fingerprint values, where at least one fingerprint MUST be 3001 present. 3003 o All RID values referenced in an "a=simulcast" line MUST exist as 3004 "a=rid" lines. 3006 o Each m= section is also checked to ensure prohibited features are 3007 not used. 3009 o If the RTP/RTCP multiplexing policy is "require", each m= section 3010 MUST contain an "a=rtcp-mux" attribute. If an m= section contains 3011 an "a=rtcp-mux-only" attribute, that section MUST also contain an 3012 "a=rtcp-mux" attribute. 3014 o If an m= section was present in the previous answer, the state of 3015 RTP/RTCP multiplexing MUST match what was previously negotiated. 3017 If this session description is of type "pranswer" or "answer", the 3018 following additional checks are applied: 3020 o The session description must follow the rules defined in 3021 [RFC3264], Section 6, including the requirement that the number of 3022 m= sections MUST exactly match the number of m= sections in the 3023 associated offer. 3025 o For each m= section, the media type and protocol values MUST 3026 exactly match the media type and protocol values in the 3027 corresponding m= section in the associated offer. 3029 If any of the preceding checks failed, processing MUST stop and an 3030 error MUST be returned. 3032 5.9. Applying a Local Description 3034 The following steps are performed at the media engine level to apply 3035 a local description. If an error is returned, the session MUST be 3036 restored to the state it was in before performing these steps. 3038 First, m= sections are processed. For each m= section, the following 3039 steps MUST be performed; if any parameters are out of bounds, or 3040 cannot be applied, processing MUST stop and an error MUST be 3041 returned. 3043 o If this m= section is new, begin gathering candidates for it, as 3044 defined in [RFC8445], Section 5.1.1, unless it is definitively 3045 being bundled (either this is an offer and the m= section is 3046 marked bundle-only, or it is an answer and the m= section is 3047 bundled into into another m= section.) 3049 o Or, if the ICE ufrag and password values have changed, trigger the 3050 ICE agent to start an ICE restart as described in [RFC8445], 3051 Section 9, and begin gathering new candidates for the m= section. 3052 If this description is an answer, also start checks on that media 3053 section. 3055 o If the m= section proto value indicates use of RTP: 3057 * If there is no RtpTransceiver associated with this m= section, 3058 find one and associate it with this m= section according to the 3059 following steps. Note that this situation will only occur when 3060 applying an offer. 3062 + Find the RtpTransceiver that corresponds to this m= section, 3063 using the mapping between transceivers and m= section 3064 indices established when creating the offer. 3066 + Set the value of this RtpTransceiver's mid property to the 3067 MID of the m= section. 3069 * If RTCP mux is indicated, prepare to demux RTP and RTCP from 3070 the RTP ICE component, as specified in [RFC5761], 3071 Section 5.1.3. 3073 * For each specified RTP header extension, establish a mapping 3074 between the extension ID and URI, as described in [RFC5285], 3075 Section 6. 3077 * If the MID header extension is supported, prepare to demux RTP 3078 streams intended for this m= section based on the MID header 3079 extension, as described in 3080 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 15. 3082 * For each specified media format, establish a mapping between 3083 the payload type and the actual media format, as described in 3084 [RFC3264], Section 6.1. In addition, prepare to demux RTP 3085 streams intended for this m= section based on the media formats 3086 supported by this m= section, as described in 3087 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 10.2. 3089 * For each specified "rtx" media format, establish a mapping 3090 between the RTX payload type and its associated primary payload 3091 type, as described in [RFC4588], Sections 8.6 and 8.7. 3093 * If the directional attribute is of type "sendrecv" or 3094 "recvonly", enable receipt and decoding of media. 3096 Finally, if this description is of type "pranswer" or "answer", 3097 follow the processing defined in Section 5.11 below. 3099 5.10. Applying a Remote Description 3101 The following steps are performed to apply a remote description. If 3102 an error is returned, the session MUST be restored to the state it 3103 was in before performing these steps. 3105 If the answer contains any "a=ice-options" attributes where "trickle" 3106 is listed as an attribute, update the PeerConnection canTrickle 3107 property to be true. Otherwise, set this property to false. 3109 The following steps MUST be performed for attributes at the session 3110 level; if any parameters are out of bounds, or cannot be applied, 3111 processing MUST stop and an error MUST be returned. 3113 o For any specified "CT" bandwidth value, set this as the limit for 3114 the maximum total bitrate for all m= sections, as specified in 3115 [RFC4566], Section 5.8. Within this overall limit, the 3116 implementation can dynamically decide how to best allocate the 3117 available bandwidth between m= sections, respecting any specific 3118 limits that have been specified for individual m= sections. 3120 o For any specified "RR" or "RS" bandwidth values, handle as 3121 specified in [RFC3556], Section 2. 3123 o Any "AS" bandwidth value MUST be ignored, as the meaning of this 3124 construct at the session level is not well defined. 3126 For each m= section, the following steps MUST be performed; if any 3127 parameters are out of bounds, or cannot be applied, processing MUST 3128 stop and an error MUST be returned. 3130 o If the ICE ufrag or password changed from the previous remote 3131 description: 3133 * If the description is of type "offer", the implementation MUST 3134 note that an ICE restart is needed, as described in 3135 [I-D.ietf-mmusic-ice-sip-sdp], Section 3.4.1.1.1 3137 * If the description is of type "answer" or "pranswer", then 3138 check to see if the current local description is an ICE 3139 restart, and if not, generate an error. If the PeerConnection 3140 state is "have-remote-pranswer", and the ICE ufrag or password 3141 changed from the previous provisional answer, then signal the 3142 ICE agent to discard any previous ICE check list state for the 3143 m= section. Finally, signal the ICE agent to begin checks. 3145 o If the current local description indicates an ICE restart, and 3146 either the ICE ufrag or password has not changed from the previous 3147 remote description, as prescribed by [RFC8445], Section 9, 3148 generate an error. 3150 o Configure the ICE components associated with this media section to 3151 use the supplied ICE remote ufrag and password for their 3152 connectivity checks. 3154 o Pair any supplied ICE candidates with any gathered local 3155 candidates, as described in [RFC8445], Section 6.1.2, and start 3156 connectivity checks with the appropriate credentials. 3158 o If an "a=end-of-candidates" attribute is present, process the end- 3159 of-candidates indication as described in [I-D.ietf-ice-trickle], 3160 Section 11. 3162 o If the m= section proto value indicates use of RTP: 3164 * If the m= section is being recycled (see Section 5.2.2), 3165 dissociate the currently associated RtpTransceiver by setting 3166 its mid property to null, and discard the mapping between the 3167 transceiver and its m= section index. 3169 * If the m= section is not associated with any RtpTransceiver 3170 (possibly because it was dissociated in the previous step), 3171 either find an RtpTransceiver or create one according to the 3172 following steps: 3174 + If the m= section is sendrecv or recvonly, and there are 3175 RtpTransceivers of the same type that were added to the 3176 PeerConnection by addTrack and are not associated with any 3177 m= section and are not stopped, find the first (according to 3178 the canonical order described in Section 5.2.1) such 3179 RtpTransceiver. 3181 + If no RtpTransceiver was found in the previous step, create 3182 one with a recvonly direction. 3184 + Associate the found or created RtpTransceiver with the m= 3185 section by setting the value of the RtpTransceiver's mid 3186 property to the MID of the m= section, and establish a 3187 mapping between the transceiver and the index of the m= 3188 section. If the m= section does not include a MID (i.e., 3189 the remote endpoint does not support the MID extension), 3190 generate a value for the RtpTransceiver mid property, 3191 following the guidance for "a=mid" mentioned in 3192 Section 5.2.1. 3194 * For each specified media format that is also supported by the 3195 local implementation, establish a mapping between the specified 3196 payload type and the media format, as described in [RFC3264], 3197 Section 6.1. Specifically, this means that the implementation 3198 records the payload type to be used in outgoing RTP packets 3199 when sending each specified media format, as well as the 3200 relative preference for each format that is indicated in their 3201 ordering. If any indicated media format is not supported by 3202 the local implementation, it MUST be ignored. 3204 * For each specified "rtx" media format, establish a mapping 3205 between the RTX payload type and its associated primary payload 3206 type, as described in [RFC4588], Section 4. If any referenced 3207 primary payload types are not present, this MUST result in an 3208 error. Note that RTX payload types may refer to primary 3209 payload types which are not supported by the local media 3210 implementation, in which case, the RTX payload type MUST also 3211 be ignored. 3213 * For each specified fmtp parameter that is supported by the 3214 local implementation, enable them on the associated media 3215 formats. 3217 * For each specified SSRC that is signaled in the m= section, 3218 prepare to demux RTP streams intended for this m= section using 3219 that SSRC, as described in 3220 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 10.2. 3222 * For each specified RTP header extension that is also supported 3223 by the local implementation, establish a mapping between the 3224 extension ID and URI, as described in [RFC5285], Section 5. 3225 Specifically, this means that the implementation records the 3226 extension ID to be used in outgoing RTP packets when sending 3227 each specified header extension. If any indicated RTP header 3228 extension is not supported by the local implementation, it MUST 3229 be ignored. 3231 * For each specified RTCP feedback mechanism that is supported by 3232 the local implementation, enable them on the associated media 3233 formats. 3235 * For any specified "TIAS" bandwidth value, set this value as a 3236 constraint on the maximum RTP bitrate to be used when sending 3237 media, as specified in [RFC3890]. If a "TIAS" value is not 3238 present, but an "AS" value is specified, generate a "TIAS" 3239 value using this formula: 3241 TIAS = AS * 1000 * 0.95 - (50 * 40 * 8) 3243 The 50 is based on 50 packets per second, the 40 is based on an 3244 estimate of total header size, the 1000 changes the unit from 3245 kbps to bps (as required by TIAS), and the 0.95 is to allocate 3246 5% to RTCP. "TIAS" is used in preference to "AS" because it 3247 provides more accurate control of bandwidth. 3249 * For any "RR" or "RS" bandwidth values, handle as specified in 3250 [RFC3556], Section 2. 3252 * Any specified "CT" bandwidth value MUST be ignored, as the 3253 meaning of this construct at the media level is not well 3254 defined. 3256 * If the m= section is of type audio: 3258 + For each specified "CN" media format, configure silence 3259 suppression for all supported media formats with the same 3260 clockrate, as described in [RFC3389], Section 5, except for 3261 formats that have their own internal silence suppression 3262 mechanisms. Silence suppression for such formats (e.g., 3263 Opus) is controlled via fmtp parameters, as discussed in 3264 Section 5.2.3.2. 3266 + For each specified "telephone-event" media format, enable 3267 DTMF transmission for all supported media formats with the 3268 same clockrate, as described in [RFC4733], Section 2.5.1.2. 3269 If there are any supported media formats that do not have a 3270 corresponding telephone-event format, disable DTMF 3271 transmission for those formats. 3273 + For any specified "ptime" value, configure the available 3274 media formats to use the specified packet size when sending. 3275 If the specified size is not supported for a media format, 3276 use the next closest value instead. 3278 Finally, if this description is of type "pranswer" or "answer", 3279 follow the processing defined in Section 5.11 below. 3281 5.11. Applying an Answer 3283 In addition to the steps mentioned above for processing a local or 3284 remote description, the following steps are performed when processing 3285 a description of type "pranswer" or "answer". 3287 For each m= section, the following steps MUST be performed: 3289 o If the m= section has been rejected (i.e. port is set to zero in 3290 the answer), stop any reception or transmission of media for this 3291 section, and, unless a non-rejected m= section is bundled with 3292 this m= section, discard any associated ICE components, as 3293 described in [I-D.ietf-mmusic-ice-sip-sdp], Section 3.4.3.1. 3295 o If the remote DTLS fingerprint has been changed or the tls-id has 3296 changed, tear down the DTLS connection. This includes the case 3297 when the PeerConnection state is "have-remote-pranswer". If a 3298 DTLS connection needs to be torn down but the answer does not 3299 indicate an ICE restart or, in the case of "have-remote-pranswer", 3300 new ICE credentials, an error MUST be generated. If an ICE 3301 restart is performed without a change in tls-id or fingerprint, 3302 then the same DTLS connection is continued over the new ICE 3303 channel. Note that although JSEP requires that answerers change 3304 the tls-id value if and only if the offerer does, non-JSEP 3305 answerers are permitted to change the tls-id as long as the offer 3306 contained an ICE restart. Thus, JSEP implementations which 3307 process DTLS data prior to receiving an answer MUST be prepared to 3308 receive either a ClientHello or data from the previous DTLS 3309 connection. 3311 o If no valid DTLS connection exists, prepare to start a DTLS 3312 connection, using the specified roles and fingerprints, on any 3313 underlying ICE components, once they are active. 3315 o If the m= section proto value indicates use of RTP: 3317 * If the m= section references RTCP feedback mechanisms that were 3318 not present in the corresponding m= section in the offer, this 3319 indicates a negotiation problem and MUST result in an error. 3320 However, new media formats and new RTP header extension values 3321 are permitted in the answer, as described in [RFC3264], 3322 Section 7, and [RFC5285], Section 6. 3324 * If the m= section has RTCP mux enabled, discard the RTCP ICE 3325 component, if one exists, and begin or continue muxing RTCP 3326 over the RTP ICE component, as specified in [RFC5761], 3327 Section 5.1.3. Otherwise, prepare to transmit RTCP over the 3328 RTCP ICE component; if no RTCP ICE component exists, because 3329 RTCP mux was previously enabled, this MUST result in an error. 3331 * If the m= section has reduced-size RTCP enabled, configure the 3332 RTCP transmission for this m= section to use reduced-size RTCP, 3333 as specified in [RFC5506]. 3335 * If the directional attribute in the answer indicates that the 3336 JSEP implementation should be sending media ("sendonly" for 3337 local answers, "recvonly" for remote answers, or "sendrecv" for 3338 either type of answer), choose the media format to send as the 3339 most preferred media format from the remote description that is 3340 also locally supported, as discussed in [RFC3264], Sections 6.1 3341 and 7, and start transmitting RTP media using that format once 3342 the underlying transport layers have been established. If an 3343 SSRC has not already been chosen for this outgoing RTP stream, 3344 choose a random one. If media is already being transmitted, 3345 the same SSRC SHOULD be used unless the clockrate of the new 3346 codec is different, in which case a new SSRC MUST be chosen, as 3347 specified in [RFC7160], Section 3.1. 3349 * The payload type mapping from the remote description is used to 3350 determine payload types for the outgoing RTP streams, including 3351 the payload type for the send media format chosen above. Any 3352 RTP header extensions that were negotiated should be included 3353 in the outgoing RTP streams, using the extension mapping from 3354 the remote description; if the RID header extension has been 3355 negotiated, and RID values are specified, include the RID 3356 header extension in the outgoing RTP streams, as indicated in 3357 [I-D.ietf-mmusic-rid], Section 4. 3359 * If the m= section is of type audio, and silence suppression was 3360 configured for the send media format as a result of processing 3361 the remote description, and is also enabled for that format in 3362 the local description, use silence suppression for outgoing 3363 media, in accordance with the guidance in Section 5.2.3.2. If 3364 these conditions are not met, silence suppression MUST NOT be 3365 used for outgoing media. 3367 * If simulcast has been negotiated, send the number of Source RTP 3368 Streams as specified in [I-D.ietf-mmusic-sdp-simulcast], 3369 Section 6.2.2. 3371 * If the send media format chosen above has a corresponding "rtx" 3372 media format, or a FEC mechanism has been negotiated, establish 3373 a Redundancy RTP Stream with a random SSRC for each Source RTP 3374 Stream, and start or continue transmitting RTX/FEC packets as 3375 needed. 3377 * If the send media format chosen above has a corresponding "red" 3378 media format of the same clockrate, allow redundant encoding 3379 using the specified format for resiliency purposes, as 3380 discussed in [I-D.ietf-rtcweb-fec], Section 3.2. Note that 3381 unlike RTX or FEC media formats, the "red" format is 3382 transmitted on the Source RTP Stream, not the Redundancy RTP 3383 Stream. 3385 * Enable the RTCP feedback mechanisms referenced in the media 3386 section for all Source RTP Streams using the specified media 3387 formats. Specifically, begin or continue sending the requested 3388 feedback types and reacting to received feedback, as specified 3389 in [RFC4585], Section 4.2. When sending RTCP feedback, follow 3390 the rules and recommendations from [RFC8108] Section 5.4.1, to 3391 select which SSRC to use. 3393 * If the directional attribute in the answer indicates that the 3394 JSEP implementation should not be sending media ("recvonly" for 3395 local answers, "sendonly" for remote answers, or "inactive" for 3396 either type of answer) stop transmitting all RTP media, but 3397 continue sending RTCP, as described in [RFC3264], Section 5.1. 3399 o If the m= section proto value indicates use of SCTP: 3401 * If an SCTP association exists, and the remote SCTP port has 3402 changed, discard the existing SCTP association. This includes 3403 the case when the PeerConnection state is "have-remote- 3404 pranswer". 3406 * If no valid SCTP association exists, prepare to initiate a SCTP 3407 association over the associated ICE component and DTLS 3408 connection, using the local SCTP port value from the local 3409 description, and the remote SCTP port value from the remote 3410 description, as described in [I-D.ietf-mmusic-sctp-sdp], 3411 Section 10.2. 3413 If the answer contains valid bundle groups, discard any ICE 3414 components for the m= sections that will be bundled onto the primary 3415 ICE components in each bundle, and begin muxing these m= sections 3416 accordingly, as described in 3417 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 8.2. 3419 If the description is of type "answer", and there are still remaining 3420 candidates in the ICE candidate pool, discard them. 3422 6. Processing RTP/RTCP 3424 When bundling, associating incoming RTP/RTCP with the proper m= 3425 section is defined in [I-D.ietf-mmusic-sdp-bundle-negotiation], 3426 Section 10.2. When not bundling, the proper m= section is clear from 3427 the ICE component over which the RTP/RTCP is received. 3429 Once the proper m= section(s) are known, RTP/RTCP is delivered to the 3430 RtpTransceiver(s) associated with the m= section(s) and further 3431 processing of the RTP/RTCP is done at the RtpTransceiver level. This 3432 includes using RID [I-D.ietf-mmusic-rid] to distinguish between 3433 multiple Encoded Streams, as well as determine which Source RTP 3434 stream should be repaired by a given Redundancy RTP stream. 3436 7. Examples 3438 Note that this example section shows several SDP fragments. To 3439 format in 72 columns, some of the lines in SDP have been split into 3440 multiple lines, where leading whitespace indicates that a line is a 3441 continuation of the previous line. In addition, some blank lines 3442 have been added to improve readability but are not valid in SDP. 3444 More examples of SDP for WebRTC call flows, including examples with 3445 IPv6 addresses, can be found in [I-D.ietf-rtcweb-sdp]. 3447 7.1. Simple Example 3449 This section shows a very simple example that sets up a minimal audio 3450 / video call between two JSEP endpoints without using trickle ICE. 3451 The example in the following section provides a more detailed example 3452 of what could happen in a JSEP session. 3454 The code flow below shows Alice's endpoint initiating the session to 3455 Bob's endpoint. The messages from the JavaScript application in 3456 Alice's browser to the JavaScript in Bob's browser, abbreviated as 3457 AliceJS and BobJS respectively, are assumed to flow over some 3458 signaling protocol via a web server. The JavaScript on both Alice's 3459 side and Bob's side waits for all candidates before sending the offer 3460 or answer, so the offers and answers are complete; trickle ICE is not 3461 used. The user agents (JSEP implementations) in Alice and Bob's 3462 browsers, abbreviated as AliceUA and BobUA respectively, are using 3463 the default bundle policy of "balanced", and the default RTCP mux 3464 policy of "require". 3466 // set up local media state 3467 AliceJS->AliceUA: create new PeerConnection 3468 AliceJS->AliceUA: addTrack with two tracks: audio and video 3469 AliceJS->AliceUA: createOffer to get offer 3470 AliceJS->AliceUA: setLocalDescription with offer 3471 AliceUA->AliceJS: multiple onicecandidate events with candidates 3473 // wait for ICE gathering to complete 3474 AliceUA->AliceJS: onicecandidate event with null candidate 3475 AliceJS->AliceUA: get |offer-A1| from pendingLocalDescription 3477 // |offer-A1| is sent over signaling protocol to Bob 3478 AliceJS->WebServer: signaling with |offer-A1| 3479 WebServer->BobJS: signaling with |offer-A1| 3481 // |offer-A1| arrives at Bob 3482 BobJS->BobUA: create a PeerConnection 3483 BobJS->BobUA: setRemoteDescription with |offer-A1| 3484 BobUA->BobJS: ontrack events for audio and video tracks 3486 // Bob accepts call 3487 BobJS->BobUA: addTrack with local tracks 3488 BobJS->BobUA: createAnswer 3489 BobJS->BobUA: setLocalDescription with answer 3490 BobUA->BobJS: multiple onicecandidate events with candidates 3492 // wait for ICE gathering to complete 3493 BobUA->BobJS: onicecandidate event with null candidate 3494 BobJS->BobUA: get |answer-A1| from currentLocalDescription 3496 // |answer-A1| is sent over signaling protocol to Alice 3497 BobJS->WebServer: signaling with |answer-A1| 3498 WebServer->AliceJS: signaling with |answer-A1| 3500 // |answer-A1| arrives at Alice 3501 AliceJS->AliceUA: setRemoteDescription with |answer-A1| 3502 AliceUA->AliceJS: ontrack events for audio and video tracks 3504 // media flows 3505 BobUA->AliceUA: media sent from Bob to Alice 3506 AliceUA->BobUA: media sent from Alice to Bob 3508 The SDP for |offer-A1| looks like: 3510 v=0 3511 o=- 4962303333179871722 1 IN IP4 0.0.0.0 3512 s=- 3513 t=0 0 3514 a=ice-options:trickle ice2 3515 a=group:BUNDLE a1 v1 3516 a=group:LS a1 v1 3518 m=audio 10100 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3519 c=IN IP4 203.0.113.100 3520 a=mid:a1 3521 a=sendrecv 3522 a=rtpmap:96 opus/48000/2 3523 a=rtpmap:0 PCMU/8000 3524 a=rtpmap:8 PCMA/8000 3525 a=rtpmap:97 telephone-event/8000 3526 a=rtpmap:98 telephone-event/48000 3527 a=fmtp:97 0-15 3528 a=fmtp:98 0-15 3529 a=maxptime:120 3530 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3531 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3532 a=msid:47017fee-b6c1-4162-929c-a25110252400 3533 a=ice-ufrag:ETEn 3534 a=ice-pwd:OtSK0WpNtpUjkY4+86js7ZQl 3535 a=fingerprint:sha-256 3536 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04: 3537 BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3538 a=setup:actpass 3539 a=tls-id:91bbf309c0990a6bec11e38ba2933cee 3540 a=rtcp:10101 IN IP4 203.0.113.100 3541 a=rtcp-mux 3542 a=rtcp-rsize 3543 a=candidate:1 1 udp 2113929471 203.0.113.100 10100 typ host 3544 a=candidate:1 2 udp 2113929470 203.0.113.100 10101 typ host 3545 a=end-of-candidates 3547 m=video 10102 UDP/TLS/RTP/SAVPF 100 101 102 103 3548 c=IN IP4 203.0.113.100 3549 a=mid:v1 3550 a=sendrecv 3551 a=rtpmap:100 VP8/90000 3552 a=rtpmap:101 H264/90000 3553 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 3554 a=rtpmap:102 rtx/90000 3555 a=fmtp:102 apt=100 3556 =rtpmap:103 rtx/90000 3557 a=fmtp:103 apt=101 3558 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3559 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 3560 a=rtcp-fb:100 ccm fir 3561 a=rtcp-fb:100 nack 3562 a=rtcp-fb:100 nack pli 3563 a=msid:47017fee-b6c1-4162-929c-a25110252400 3564 a=ice-ufrag:BGKk 3565 a=ice-pwd:mqyWsAjvtKwTGnvhPztQ9mIf 3566 a=fingerprint:sha-256 3567 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04: 3568 BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3569 a=setup:actpass 3570 a=tls-id:91bbf309c0990a6bec11e38ba2933cee 3571 a=rtcp:10103 IN IP4 203.0.113.100 3572 a=rtcp-mux 3573 a=rtcp-rsize 3574 a=candidate:1 1 udp 2113929471 203.0.113.100 10102 typ host 3575 a=candidate:1 2 udp 2113929470 203.0.113.100 10103 typ host 3576 a=end-of-candidates 3578 The SDP for |answer-A1| looks like: 3580 v=0 3581 o=- 6729291447651054566 1 IN IP4 0.0.0.0 3582 s=- 3583 t=0 0 3584 a=ice-options:trickle ice2 3585 a=group:BUNDLE a1 v1 3586 a=group:LS a1 v1 3588 m=audio 10200 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3589 c=IN IP4 203.0.113.200 3590 a=mid:a1 3591 a=sendrecv 3592 a=rtpmap:96 opus/48000/2 3593 a=rtpmap:0 PCMU/8000 3594 a=rtpmap:8 PCMA/8000 3595 a=rtpmap:97 telephone-event/8000 3596 a=rtpmap:98 telephone-event/48000 3597 a=fmtp:97 0-15 3598 a=fmtp:98 0-15 3599 a=maxptime:120 3600 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3601 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3602 a=msid:61317484-2ed4-49d7-9eb7-1414322a7aae 3603 a=ice-ufrag:6sFv 3604 a=ice-pwd:cOTZKZNVlO9RSGsEGM63JXT2 3605 a=fingerprint:sha-256 3606 6B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35: 3607 DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3608 a=setup:active 3609 a=tls-id:eec3392ab83e11ceb6a0990c903fbb19 3610 a=rtcp-mux 3611 a=rtcp-rsize 3612 a=candidate:1 1 udp 2113929471 203.0.113.200 10200 typ host 3613 a=end-of-candidates 3615 m=video 10200 UDP/TLS/RTP/SAVPF 100 101 102 103 3616 c=IN IP4 203.0.113.200 3617 a=mid:v1 3618 a=sendrecv 3619 a=rtpmap:100 VP8/90000 3620 a=rtpmap:101 H264/90000 3621 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 3622 a=rtpmap:102 rtx/90000 3623 a=fmtp:102 apt=100 3624 =rtpmap:103 rtx/90000 3625 a=fmtp:103 apt=101 3626 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3627 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 3628 a=rtcp-fb:100 ccm fir 3629 a=rtcp-fb:100 nack 3630 a=rtcp-fb:100 nack pli 3631 a=msid:61317484-2ed4-49d7-9eb7-1414322a7aae 3633 7.2. Detailed Example 3635 This section shows a more involved example of a session between two 3636 JSEP endpoints. Trickle ICE is used in full trickle mode, with a 3637 bundle policy of "max-bundle", an RTCP mux policy of "require", and a 3638 single TURN server. Initially, both Alice and Bob establish an audio 3639 channel and a data channel. Later, Bob adds two video flows, one for 3640 his video feed, and one for screensharing, both supporting FEC, and 3641 with the video feed configured for simulcast. Alice accepts these 3642 video flows, but does not add video flows of her own, so they are 3643 handled as recvonly. Alice also specifies a maximum video decoder 3644 resolution. 3646 // set up local media state 3647 AliceJS->AliceUA: create new PeerConnection 3648 AliceJS->AliceUA: addTrack with an audio track 3649 AliceJS->AliceUA: createDataChannel to get data channel 3650 AliceJS->AliceUA: createOffer to get |offer-B1| 3651 AliceJS->AliceUA: setLocalDescription with |offer-B1| 3652 // |offer-B1| is sent over signaling protocol to Bob 3653 AliceJS->WebServer: signaling with |offer-B1| 3654 WebServer->BobJS: signaling with |offer-B1| 3656 // |offer-B1| arrives at Bob 3657 BobJS->BobUA: create a PeerConnection 3658 BobJS->BobUA: setRemoteDescription with |offer-B1| 3659 BobUA->BobJS: ontrack with audio track from Alice 3661 // candidates are sent to Bob 3662 AliceUA->AliceJS: onicecandidate (host) |offer-B1-candidate-1| 3663 AliceJS->WebServer: signaling with |offer-B1-candidate-1| 3664 AliceUA->AliceJS: onicecandidate (srflx) |offer-B1-candidate-2| 3665 AliceJS->WebServer: signaling with |offer-B1-candidate-2| 3666 AliceUA->AliceJS: onicecandidate (relay) |offer-B1-candidate-3| 3667 AliceJS->WebServer: signaling with |offer-B1-candidate-3| 3669 WebServer->BobJS: signaling with |offer-B1-candidate-1| 3670 BobJS->BobUA: addIceCandidate with |offer-B1-candidate-1| 3671 WebServer->BobJS: signaling with |offer-B1-candidate-2| 3672 BobJS->BobUA: addIceCandidate with |offer-B1-candidate-2| 3673 WebServer->BobJS: signaling with |offer-B1-candidate-3| 3674 BobJS->BobUA: addIceCandidate with |offer-B1-candidate-3| 3676 // Bob accepts call 3677 BobJS->BobUA: addTrack with local audio 3678 BobJS->BobUA: createDataChannel to get data channel 3679 BobJS->BobUA: createAnswer to get |answer-B1| 3680 BobJS->BobUA: setLocalDescription with |answer-B1| 3682 // |answer-B1| is sent to Alice 3683 BobJS->WebServer: signaling with |answer-B1| 3684 WebServer->AliceJS: signaling with |answer-B1| 3685 AliceJS->AliceUA: setRemoteDescription with |answer-B1| 3686 AliceUA->AliceJS: ontrack event with audio track from Bob 3688 // candidates are sent to Alice 3689 BobUA->BobJS: onicecandidate (host) |answer-B1-candidate-1| 3690 BobJS->WebServer: signaling with |answer-B1-candidate-1| 3691 BobUA->BobJS: onicecandidate (srflx) |answer-B1-candidate-2| 3692 BobJS->WebServer: signaling with |answer-B1-candidate-2| 3693 BobUA->BobJS: onicecandidate (relay) |answer-B1-candidate-3| 3694 BobJS->WebServer: signaling with |answer-B1-candidate-3| 3696 WebServer->AliceJS: signaling with |answer-B1-candidate-1| 3697 AliceJS->AliceUA: addIceCandidate with |answer-B1-candidate-1| 3698 WebServer->AliceJS: signaling with |answer-B1-candidate-2| 3699 AliceJS->AliceUA: addIceCandidate with |answer-B1-candidate-2| 3700 WebServer->AliceJS: signaling with |answer-B1-candidate-3| 3701 AliceJS->AliceUA: addIceCandidate with |answer-B1-candidate-3| 3703 // data channel opens 3704 BobUA->BobJS: ondatachannel event 3705 AliceUA->AliceJS: ondatachannel event 3706 BobUA->BobJS: onopen 3707 AliceUA->AliceJS: onopen 3709 // media is flowing between endpoints 3710 BobUA->AliceUA: audio+data sent from Bob to Alice 3711 AliceUA->BobUA: audio+data sent from Alice to Bob 3713 // some time later Bob adds two video streams 3714 // note, no candidates exchanged, because of bundle 3715 BobJS->BobUA: addTrack with first video stream 3716 BobJS->BobUA: addTrack with second video stream 3717 BobJS->BobUA: createOffer to get |offer-B2| 3718 BobJS->BobUA: setLocalDescription with |offer-B2| 3720 // |offer-B2| is sent to Alice 3721 BobJS->WebServer: signaling with |offer-B2| 3722 WebServer->AliceJS: signaling with |offer-B2| 3723 AliceJS->AliceUA: setRemoteDescription with |offer-B2| 3724 AliceUA->AliceJS: ontrack event with first video track 3725 AliceUA->AliceJS: ontrack event with second video track 3726 AliceJS->AliceUA: createAnswer to get |answer-B2| 3727 AliceJS->AliceUA: setLocalDescription with |answer-B2| 3729 // |answer-B2| is sent over signaling protocol to Bob 3730 AliceJS->WebServer: signaling with |answer-B2| 3731 WebServer->BobJS: signaling with |answer-B2| 3732 BobJS->BobUA: setRemoteDescription with |answer-B2| 3734 // media is flowing between endpoints 3735 BobUA->AliceUA: audio+video+data sent from Bob to Alice 3736 AliceUA->BobUA: audio+video+data sent from Alice to Bob 3738 The SDP for |offer-B1| looks like: 3740 v=0 3741 o=- 4962303333179871723 1 IN IP4 0.0.0.0 3742 s=- 3743 t=0 0 3744 a=ice-options:trickle ice2 3745 a=group:BUNDLE a1 d1 3747 m=audio 9 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3748 c=IN IP4 0.0.0.0 3749 a=mid:a1 3750 a=sendrecv 3751 a=rtpmap:96 opus/48000/2 3752 a=rtpmap:0 PCMU/8000 3753 a=rtpmap:8 PCMA/8000 3754 a=rtpmap:97 telephone-event/8000 3755 a=rtpmap:98 telephone-event/48000 3756 a=fmtp:97 0-15 3757 a=fmtp:98 0-15 3758 a=maxptime:120 3759 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3760 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3761 a=msid:57017fee-b6c1-4162-929c-a25110252400 3762 a=ice-ufrag:ATEn 3763 a=ice-pwd:AtSK0WpNtpUjkY4+86js7ZQl 3764 a=fingerprint:sha-256 3765 29:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04: 3766 BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3767 a=setup:actpass 3768 a=tls-id:17f0f4ba8a5f1213faca591b58ba52a7 3769 a=rtcp-mux 3770 a=rtcp-mux-only 3771 a=rtcp-rsize 3773 m=application 0 UDP/DTLS/SCTP webrtc-datachannel 3774 c=IN IP4 0.0.0.0 3775 a=mid:d1 3776 a=sctp-port:5000 3777 a=max-message-size:65536 3778 a=bundle-only 3780 |offer-B1-candidate-1| looks like: 3782 ufrag ATEn 3783 index 0 3784 mid a1 3785 attr candidate:1 1 udp 2113929471 203.0.113.100 10100 typ host 3787 |offer-B1-candidate-2| looks like: 3789 ufrag ATEn 3790 index 0 3791 mid a1 3792 attr candidate:1 1 udp 1845494015 198.51.100.100 11100 typ srflx 3793 raddr 203.0.113.100 rport 10100 3795 |offer-B1-candidate-3| looks like: 3797 ufrag ATEn 3798 index 0 3799 mid a1 3800 attr candidate:1 1 udp 255 192.0.2.100 12100 typ relay 3801 raddr 198.51.100.100 rport 11100 3803 The SDP for |answer-B1| looks like: 3805 v=0 3806 o=- 7729291447651054566 1 IN IP4 0.0.0.0 3807 s=- 3808 t=0 0 3809 a=ice-options:trickle ice2 3810 a=group:BUNDLE a1 d1 3812 m=audio 9 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3813 c=IN IP4 0.0.0.0 3814 a=mid:a1 3815 a=sendrecv 3816 a=rtpmap:96 opus/48000/2 3817 a=rtpmap:0 PCMU/8000 3818 a=rtpmap:8 PCMA/8000 3819 a=rtpmap:97 telephone-event/8000 3820 a=rtpmap:98 telephone-event/48000 3821 a=fmtp:97 0-15 3822 a=fmtp:98 0-15 3823 a=maxptime:120 3824 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3825 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3826 a=msid:71317484-2ed4-49d7-9eb7-1414322a7aae 3827 a=ice-ufrag:7sFv 3828 a=ice-pwd:dOTZKZNVlO9RSGsEGM63JXT2 3829 a=fingerprint:sha-256 3830 7B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35: 3831 DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3832 a=setup:active 3833 a=tls-id:7a25ab85b195acaf3121f5a8ab4f0f71 3834 a=rtcp-mux 3835 a=rtcp-mux-only 3836 a=rtcp-rsize 3838 m=application 9 UDP/DTLS/SCTP webrtc-datachannel 3839 c=IN IP4 0.0.0.0 3840 a=mid:d1 3841 a=sctp-port:5000 3842 a=max-message-size:65536 3844 |answer-B1-candidate-1| looks like: 3846 ufrag 7sFv 3847 index 0 3848 mid a1 3849 attr candidate:1 1 udp 2113929471 203.0.113.200 10200 typ host 3850 |answer-B1-candidate-2| looks like: 3852 ufrag 7sFv 3853 index 0 3854 mid a1 3855 attr candidate:1 1 udp 1845494015 198.51.100.200 11200 typ srflx 3856 raddr 203.0.113.200 rport 10200 3858 |answer-B1-candidate-3| looks like: 3860 ufrag 7sFv 3861 index 0 3862 mid a1 3863 attr candidate:1 1 udp 255 192.0.2.200 12200 typ relay 3864 raddr 198.51.100.200 rport 11200 3866 The SDP for |offer-B2| is shown below. In addition to the new m= 3867 sections for video, both of which are offering FEC, and one of which 3868 is offering simulcast, note the increment of the version number in 3869 the o= line, changes to the c= line, indicating the local candidate 3870 that was selected, and the inclusion of gathered candidates as 3871 a=candidate lines. 3873 v=0 3874 o=- 7729291447651054566 2 IN IP4 0.0.0.0 3875 s=- 3876 t=0 0 3877 a=ice-options:trickle ice2 3878 a=group:BUNDLE a1 d1 v1 v2 3879 a=group:LS a1 v1 3881 m=audio 12200 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3882 c=IN IP4 192.0.2.200 3883 a=mid:a1 3884 a=sendrecv 3885 a=rtpmap:96 opus/48000/2 3886 a=rtpmap:0 PCMU/8000 3887 a=rtpmap:8 PCMA/8000 3888 a=rtpmap:97 telephone-event/8000 3889 a=rtpmap:98 telephone-event/48000 3890 a=fmtp:97 0-15 3891 a=fmtp:98 0-15 3892 a=maxptime:120 3893 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3894 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3895 a=msid:71317484-2ed4-49d7-9eb7-1414322a7aae 3896 a=ice-ufrag:7sFv 3897 a=ice-pwd:dOTZKZNVlO9RSGsEGM63JXT2 3898 a=fingerprint:sha-256 3899 7B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35: 3900 DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3901 a=setup:actpass 3902 a=tls-id:7a25ab85b195acaf3121f5a8ab4f0f71 3903 a=rtcp-mux 3904 a=rtcp-mux-only 3905 a=rtcp-rsize 3906 a=candidate:1 1 udp 2113929471 203.0.113.200 10200 typ host 3907 a=candidate:1 1 udp 1845494015 198.51.100.200 11200 typ srflx 3908 raddr 203.0.113.200 rport 10200 3909 a=candidate:1 1 udp 255 192.0.2.200 12200 typ relay 3910 raddr 198.51.100.200 rport 11200 3911 a=end-of-candidates 3913 m=application 12200 UDP/DTLS/SCTP webrtc-datachannel 3914 c=IN IP4 192.0.2.200 3915 a=mid:d1 3916 a=sctp-port:5000 3917 a=max-message-size:65536 3919 m=video 12200 UDP/TLS/RTP/SAVPF 100 101 102 103 104 3920 c=IN IP4 192.0.2.200 3921 a=mid:v1 3922 a=sendrecv 3923 a=rtpmap:100 VP8/90000 3924 a=rtpmap:101 H264/90000 3925 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 3926 a=rtpmap:102 rtx/90000 3927 a=fmtp:102 apt=100 3928 =rtpmap:103 rtx/90000 3929 a=fmtp:103 apt=101 3930 a=rtpmap:104 flexfec/90000 3931 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3932 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 3933 a=rtcp-fb:100 ccm fir 3934 a=rtcp-fb:100 nack 3935 a=rtcp-fb:100 nack pli 3936 a=msid:71317484-2ed4-49d7-9eb7-1414322a7aae 3937 a=rid:1 send 3938 a=rid:2 send 3939 a=rid:3 send 3940 a=simulcast:send 1;2;3 3941 m=video 12200 UDP/TLS/RTP/SAVPF 100 101 102 103 104 3942 c=IN IP4 192.0.2.200 3943 a=mid:v2 3944 a=sendrecv 3945 a=rtpmap:100 VP8/90000 3946 a=rtpmap:101 H264/90000 3947 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 3948 a=rtpmap:102 rtx/90000 3949 a=fmtp:102 apt=100 3950 =rtpmap:103 rtx/90000 3951 a=fmtp:103 apt=101 3952 a=rtpmap:104 flexfec/90000 3953 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3954 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 3955 a=rtcp-fb:100 ccm fir 3956 a=rtcp-fb:100 nack 3957 a=rtcp-fb:100 nack pli 3958 a=msid:81317484-2ed4-49d7-9eb7-1414322a7aae 3960 The SDP for |answer-B2| is shown below. In addition to the 3961 acceptance of the video m= sections, the use of a=recvonly to 3962 indicate one-way video, and the use of a=imageattr to limit the 3963 received resolution, note the use of setup:passive to maintain the 3964 existing DTLS roles. 3966 v=0 3967 o=- 4962303333179871723 2 IN IP4 0.0.0.0 3968 s=- 3969 t=0 0 3970 a=ice-options:trickle ice2 3971 a=group:BUNDLE a1 d1 v1 v2 3972 a=group:LS a1 v1 3974 m=audio 12100 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3975 c=IN IP4 192.0.2.100 3976 a=mid:a1 3977 a=sendrecv 3978 a=rtpmap:96 opus/48000/2 3979 a=rtpmap:0 PCMU/8000 3980 a=rtpmap:8 PCMA/8000 3981 a=rtpmap:97 telephone-event/8000 3982 a=rtpmap:98 telephone-event/48000 3983 a=fmtp:97 0-15 3984 a=fmtp:98 0-15 3985 a=maxptime:120 3986 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3987 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3988 a=msid:57017fee-b6c1-4162-929c-a25110252400 3989 a=ice-ufrag:ATEn 3990 a=ice-pwd:AtSK0WpNtpUjkY4+86js7ZQl 3991 a=fingerprint:sha-256 3992 29:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04: 3993 BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3994 a=setup:passive 3995 a=tls-id:17f0f4ba8a5f1213faca591b58ba52a7 3996 a=rtcp-mux 3997 a=rtcp-mux-only 3998 a=rtcp-rsize 3999 a=candidate:1 1 udp 2113929471 203.0.113.100 10100 typ host 4000 a=candidate:1 1 udp 1845494015 198.51.100.100 11100 typ srflx 4001 raddr 203.0.113.100 rport 10100 4002 a=candidate:1 1 udp 255 192.0.2.100 12100 typ relay 4003 raddr 198.51.100.100 rport 11100 4004 a=end-of-candidates 4006 m=application 12100 UDP/DTLS/SCTP webrtc-datachannel 4007 c=IN IP4 192.0.2.100 4008 a=mid:d1 4009 a=sctp-port:5000 4010 a=max-message-size:65536 4012 m=video 12100 UDP/TLS/RTP/SAVPF 100 101 102 103 4013 c=IN IP4 192.0.2.100 4014 a=mid:v1 4015 a=recvonly 4016 a=rtpmap:100 VP8/90000 4017 a=rtpmap:101 H264/90000 4018 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 4019 a=rtpmap:102 rtx/90000 4020 a=fmtp:102 apt=100 4021 =rtpmap:103 rtx/90000 4022 a=fmtp:103 apt=101 4023 a=imageattr:100 recv [x=[48:1920],y=[48:1080],q=1.0] 4024 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4025 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 4026 a=rtcp-fb:100 ccm fir 4027 a=rtcp-fb:100 nack 4028 a=rtcp-fb:100 nack pli 4030 m=video 12100 UDP/TLS/RTP/SAVPF 100 101 102 103 4031 c=IN IP4 192.0.2.100 4032 a=mid:v2 4033 a=recvonly 4034 a=rtpmap:100 VP8/90000 4035 a=rtpmap:101 H264/90000 4036 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 4037 a=rtpmap:102 rtx/90000 4038 a=fmtp:102 apt=100 4039 =rtpmap:103 rtx/90000 4040 a=fmtp:103 apt=101 4041 a=imageattr:100 recv [x=[48:1920],y=[48:1080],q=1.0] 4042 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4043 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 4044 a=rtcp-fb:100 ccm fir 4045 a=rtcp-fb:100 nack 4046 a=rtcp-fb:100 nack pli 4048 7.3. Early Transport Warmup Example 4050 This example demonstrates the early warmup technique described in 4051 Section 4.1.8.1. Here, Alice's endpoint sends an offer to Bob's 4052 endpoint to start an audio/video call. Bob immediately responds with 4053 an answer that accepts the audio/video m= sections, but marks them as 4054 sendonly (from his perspective), meaning that Alice will not yet send 4055 media. This allows the JSEP implementation to start negotiating ICE 4056 and DTLS immediately. Bob's endpoint then prompts him to answer the 4057 call, and when he does, his endpoint sends a second offer which 4058 enables the audio and video m= sections, and thereby bidirectional 4059 media transmission. The advantage of such a flow is that as soon as 4060 the first answer is received, the implementation can proceed with ICE 4061 and DTLS negotiation and establish the session transport. If the 4062 transport setup completes before the second offer is sent, then media 4063 can be transmitted immediately by the callee immediately upon 4064 answering the call, minimizing perceived post-dial-delay. The second 4065 offer/answer exchange can also change the preferred codecs or other 4066 session parameters. 4068 This example also makes use of the "relay" ICE candidate policy 4069 described in Section 3.5.3 to minimize the ICE gathering and checking 4070 needed. 4072 // set up local media state 4073 AliceJS->AliceUA: create new PeerConnection with "relay" ICE policy 4074 AliceJS->AliceUA: addTrack with two tracks: audio and video 4075 AliceJS->AliceUA: createOffer to get |offer-C1| 4076 AliceJS->AliceUA: setLocalDescription with |offer-C1| 4078 // |offer-C1| is sent over signaling protocol to Bob 4079 AliceJS->WebServer: signaling with |offer-C1| 4080 WebServer->BobJS: signaling with |offer-C1| 4081 // |offer-C1| arrives at Bob 4082 BobJS->BobUA: create new PeerConnection with "relay" ICE policy 4083 BobJS->BobUA: setRemoteDescription with |offer-C1| 4084 BobUA->BobJS: ontrack events for audio and video 4086 // a relay candidate is sent to Bob 4087 AliceUA->AliceJS: onicecandidate (relay) |offer-C1-candidate-1| 4088 AliceJS->WebServer: signaling with |offer-C1-candidate-1| 4090 WebServer->BobJS: signaling with |offer-C1-candidate-1| 4091 BobJS->BobUA: addIceCandidate with |offer-C1-candidate-1| 4093 // Bob prepares an early answer to warmup the transport 4094 BobJS->BobUA: addTransceiver with null audio and video tracks 4095 BobJS->BobUA: transceiver.setDirection(sendonly) for both 4096 BobJS->BobUA: createAnswer 4097 BobJS->BobUA: setLocalDescription with answer 4099 // |answer-C1| is sent over signaling protocol to Alice 4100 BobJS->WebServer: signaling with |answer-C1| 4101 WebServer->AliceJS: signaling with |answer-C1| 4103 // |answer-C1| (sendonly) arrives at Alice 4104 AliceJS->AliceUA: setRemoteDescription with |answer-C1| 4105 AliceUA->AliceJS: ontrack events for audio and video 4107 // a relay candidate is sent to Alice 4108 BobUA->BobJS: onicecandidate (relay) |answer-B1-candidate-1| 4109 BobJS->WebServer: signaling with |answer-B1-candidate-1| 4111 WebServer->AliceJS: signaling with |answer-B1-candidate-1| 4112 AliceJS->AliceUA: addIceCandidate with |answer-B1-candidate-1| 4114 // ICE and DTLS establish while call is ringing 4116 // Bob accepts call, starts media, and sends new offer 4117 BobJS->BobUA: transceiver.setTrack with audio and video tracks 4118 BobUA->AliceUA: media sent from Bob to Alice 4119 BobJS->BobUA: transceiver.setDirection(sendrecv) for both 4120 transceivers 4121 BobJS->BobUA: createOffer 4122 BobJS->BobUA: setLocalDescription with offer 4124 // |offer-C2| is sent over signaling protocol to Alice 4125 BobJS->WebServer: signaling with |offer-C2| 4126 WebServer->AliceJS: signaling with |offer-C2| 4128 // |offer-C2| (sendrecv) arrives at Alice 4129 AliceJS->AliceUA: setRemoteDescription with |offer-C2| 4130 AliceJS->AliceUA: createAnswer 4131 AliceJS->AliceUA: setLocalDescription with |answer-C2| 4132 AliceUA->BobUA: media sent from Alice to Bob 4134 // |answer-C2| is sent over signaling protocol to Bob 4135 AliceJS->WebServer: signaling with |answer-C2| 4136 WebServer->BobJS: signaling with |answer-C2| 4137 BobJS->BobUA: setRemoteDescription with |answer-C2| 4139 The SDP for |offer-C1| looks like: 4141 v=0 4142 o=- 1070771854436052752 1 IN IP4 0.0.0.0 4143 s=- 4144 t=0 0 4145 a=ice-options:trickle ice2 4146 a=group:BUNDLE a1 v1 4147 a=group:LS a1 v1 4149 m=audio 9 UDP/TLS/RTP/SAVPF 96 0 8 97 98 4150 c=IN IP4 0.0.0.0 4151 a=mid:a1 4152 a=sendrecv 4153 a=rtpmap:96 opus/48000/2 4154 a=rtpmap:0 PCMU/8000 4155 a=rtpmap:8 PCMA/8000 4156 a=rtpmap:97 telephone-event/8000 4157 a=rtpmap:98 telephone-event/48000 4158 a=fmtp:97 0-15 4159 a=fmtp:98 0-15 4160 a=maxptime:120 4161 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4162 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 4163 a=msid:bbce3ba6-abfc-ac63-d00a-e15b286f8fce 4164 a=ice-ufrag:4ZcD 4165 a=ice-pwd:ZaaG6OG7tCn4J/lehAGz+HHD 4166 a=fingerprint:sha-256 4167 C4:68:F8:77:6A:44:F1:98:6D:7C:9F:47:EB:E3:34:A4: 4168 0A:AA:2D:49:08:28:70:2E:1F:AE:18:7D:4E:3E:66:BF 4169 a=setup:actpass 4170 a=tls-id:9e5b948ade9c3d41de6617b68f769e55 4171 a=rtcp-mux 4172 a=rtcp-mux-only 4173 a=rtcp-rsize 4174 m=video 0 UDP/TLS/RTP/SAVPF 100 101 102 103 4175 c=IN IP4 0.0.0.0 4176 a=mid:v1 4177 a=sendrecv 4178 a=rtpmap:100 VP8/90000 4179 a=rtpmap:101 H264/90000 4180 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 4181 a=rtpmap:102 rtx/90000 4182 a=fmtp:102 apt=100 4183 =rtpmap:103 rtx/90000 4184 a=fmtp:103 apt=101 4185 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4186 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 4187 a=rtcp-fb:100 ccm fir 4188 a=rtcp-fb:100 nack 4189 a=rtcp-fb:100 nack pli 4190 a=msid:bbce3ba6-abfc-ac63-d00a-e15b286f8fce 4191 a=bundle-only 4193 |offer-C1-candidate-1| looks like: 4195 ufrag 4ZcD 4196 index 0 4197 mid a1 4198 attr candidate:1 1 udp 255 192.0.2.100 12100 typ relay 4199 raddr 0.0.0.0 rport 0 4201 The SDP for |answer-C1| looks like: 4203 v=0 4204 o=- 6386516489780559513 1 IN IP4 0.0.0.0 4205 s=- 4206 t=0 0 4207 a=ice-options:trickle ice2 4208 a=group:BUNDLE a1 v1 4209 a=group:LS a1 v1 4211 m=audio 9 UDP/TLS/RTP/SAVPF 96 0 8 97 98 4212 c=IN IP4 0.0.0.0 4213 a=mid:a1 4214 a=sendonly 4215 a=rtpmap:96 opus/48000/2 4216 a=rtpmap:0 PCMU/8000 4217 a=rtpmap:8 PCMA/8000 4218 a=rtpmap:97 telephone-event/8000 4219 a=rtpmap:98 telephone-event/48000 4220 a=fmtp:97 0-15 4221 a=fmtp:98 0-15 4222 a=maxptime:120 4223 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4224 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 4225 a=msid:751f239e-4ae0-c549-aa3d-890de772998b 4226 a=ice-ufrag:TpaA 4227 a=ice-pwd:t2Ouhc67y8JcCaYZxUUTgKw/ 4228 a=fingerprint:sha-256 4229 A2:F3:A5:6D:4C:8C:1E:B2:62:10:4A:F6:70:61:C4:FC: 4230 3C:E0:01:D6:F3:24:80:74:DA:7C:3E:50:18:7B:CE:4D 4231 a=setup:active 4232 a=tls-id:55e967f86b7166ed14d3c9eda849b5e9 4233 a=rtcp-mux 4234 a=rtcp-mux-only 4235 a=rtcp-rsize 4237 m=video 9 UDP/TLS/RTP/SAVPF 100 101 102 103 4238 c=IN IP4 0.0.0.0 4239 a=mid:v1 4240 a=sendonly 4241 a=rtpmap:100 VP8/90000 4242 a=rtpmap:101 H264/90000 4243 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 4244 a=rtpmap:102 rtx/90000 4245 a=fmtp:102 apt=100 4246 =rtpmap:103 rtx/90000 4247 a=fmtp:103 apt=101 4248 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4249 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 4250 a=rtcp-fb:100 ccm fir 4251 a=rtcp-fb:100 nack 4252 a=rtcp-fb:100 nack pli 4253 a=msid:751f239e-4ae0-c549-aa3d-890de772998b 4255 |answer-C1-candidate-1| looks like: 4257 ufrag TpaA 4258 index 0 4259 mid a1 4260 attr candidate:1 1 udp 255 192.0.2.200 12200 typ relay 4261 raddr 0.0.0.0 rport 0 4263 The SDP for |offer-C2| looks like: 4265 v=0 4266 o=- 6386516489780559513 2 IN IP4 0.0.0.0 4267 s=- 4268 t=0 0 4269 a=ice-options:trickle ice2 4270 a=group:BUNDLE a1 v1 4271 a=group:LS a1 v1 4273 m=audio 12200 UDP/TLS/RTP/SAVPF 96 0 8 97 98 4274 c=IN IP4 192.0.2.200 4275 a=mid:a1 4276 a=sendrecv 4277 a=rtpmap:96 opus/48000/2 4278 a=rtpmap:0 PCMU/8000 4279 a=rtpmap:8 PCMA/8000 4280 a=rtpmap:97 telephone-event/8000 4281 a=rtpmap:98 telephone-event/48000 4282 a=fmtp:97 0-15 4283 a=fmtp:98 0-15 4284 a=maxptime:120 4285 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4286 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 4287 a=msid:751f239e-4ae0-c549-aa3d-890de772998b 4288 a=ice-ufrag:TpaA 4289 a=ice-pwd:t2Ouhc67y8JcCaYZxUUTgKw/ 4290 a=fingerprint:sha-256 4291 A2:F3:A5:6D:4C:8C:1E:B2:62:10:4A:F6:70:61:C4:FC: 4292 3C:E0:01:D6:F3:24:80:74:DA:7C:3E:50:18:7B:CE:4D 4293 a=setup:actpass 4294 a=tls-id:55e967f86b7166ed14d3c9eda849b5e9 4295 a=rtcp-mux 4296 a=rtcp-mux-only 4297 a=rtcp-rsize 4298 a=candidate:1 1 udp 255 192.0.2.200 12200 typ relay 4299 raddr 0.0.0.0 rport 0 4300 a=end-of-candidates 4302 m=video 12200 UDP/TLS/RTP/SAVPF 100 101 102 103 4303 c=IN IP4 192.0.2.200 4304 a=mid:v1 4305 a=sendrecv 4306 a=rtpmap:100 VP8/90000 4307 a=rtpmap:101 H264/90000 4308 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 4309 a=rtpmap:102 rtx/90000 4310 a=fmtp:102 apt=100 4311 =rtpmap:103 rtx/90000 4312 a=fmtp:103 apt=101 4313 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4314 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 4315 a=rtcp-fb:100 ccm fir 4316 a=rtcp-fb:100 nack 4317 a=rtcp-fb:100 nack pli 4318 a=msid:751f239e-4ae0-c549-aa3d-890de772998b 4320 The SDP for |answer-C2| looks like: 4322 v=0 4323 o=- 1070771854436052752 2 IN IP4 0.0.0.0 4324 s=- 4325 t=0 0 4326 a=ice-options:trickle ice2 4327 a=group:BUNDLE a1 v1 4328 a=group:LS a1 v1 4330 m=audio 12100 UDP/TLS/RTP/SAVPF 96 0 8 97 98 4331 c=IN IP4 192.0.2.100 4332 a=mid:a1 4333 a=sendrecv 4334 a=rtpmap:96 opus/48000/2 4335 a=rtpmap:0 PCMU/8000 4336 a=rtpmap:8 PCMA/8000 4337 a=rtpmap:97 telephone-event/8000 4338 a=rtpmap:98 telephone-event/48000 4339 a=fmtp:97 0-15 4340 a=fmtp:98 0-15 4341 a=maxptime:120 4342 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4343 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 4344 a=msid:bbce3ba6-abfc-ac63-d00a-e15b286f8fce 4345 a=ice-ufrag:4ZcD 4346 a=ice-pwd:ZaaG6OG7tCn4J/lehAGz+HHD 4347 a=fingerprint:sha-256 4348 C4:68:F8:77:6A:44:F1:98:6D:7C:9F:47:EB:E3:34:A4: 4349 0A:AA:2D:49:08:28:70:2E:1F:AE:18:7D:4E:3E:66:BF 4350 a=setup:passive 4351 a=tls-id:9e5b948ade9c3d41de6617b68f769e55 4352 a=rtcp-mux 4353 a=rtcp-mux-only 4354 a=rtcp-rsize 4355 a=candidate:1 1 udp 255 192.0.2.100 12100 typ relay 4356 raddr 0.0.0.0 rport 0 4357 a=end-of-candidates 4359 m=video 12100 UDP/TLS/RTP/SAVPF 100 101 102 103 4360 c=IN IP4 192.0.2.100 4361 a=mid:v1 4362 a=sendrecv 4363 a=rtpmap:100 VP8/90000 4364 a=rtpmap:101 H264/90000 4365 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 4366 a=rtpmap:102 rtx/90000 4367 a=fmtp:102 apt=100 4368 =rtpmap:103 rtx/90000 4369 a=fmtp:103 apt=101 4370 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4371 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 4372 a=rtcp-fb:100 ccm fir 4373 a=rtcp-fb:100 nack 4374 a=rtcp-fb:100 nack pli 4375 a=msid:bbce3ba6-abfc-ac63-d00a-e15b286f8fce 4377 8. Security Considerations 4379 The IETF has published separate documents 4380 [I-D.ietf-rtcweb-security-arch] [I-D.ietf-rtcweb-security] describing 4381 the security architecture for WebRTC as a whole. The remainder of 4382 this section describes security considerations for this document. 4384 While formally the JSEP interface is an API, it is better to think of 4385 it as an Internet protocol, with the application JavaScript being 4386 untrustworthy from the perspective of the JSEP implementation. Thus, 4387 the threat model of [RFC3552] applies. In particular, JavaScript can 4388 call the API in any order and with any inputs, including malicious 4389 ones. This is particularly relevant when we consider the SDP which 4390 is passed to setLocalDescription(). While correct API usage requires 4391 that the application pass in SDP which was derived from createOffer() 4392 or createAnswer(), there is no guarantee that applications do so. 4393 The JSEP implementation MUST be prepared for the JavaScript to pass 4394 in bogus data instead. 4396 Conversely, the application programmer needs to be aware that the 4397 JavaScript does not have complete control of endpoint behavior. One 4398 case that bears particular mention is that editing ICE candidates out 4399 of the SDP or suppressing trickled candidates does not have the 4400 expected behavior: implementations will still perform checks from 4401 those candidates even if they are not sent to the other side. Thus, 4402 for instance, it is not possible to prevent the remote peer from 4403 learning your public IP address by removing server reflexive 4404 candidates. Applications which wish to conceal their public IP 4405 address should instead configure the ICE agent to use only relay 4406 candidates. 4408 9. IANA Considerations 4410 This document requires no actions from IANA. 4412 10. Acknowledgements 4414 Harald Alvestrand, Taylor Brandstetter, Suhas Nandakumar, and Peter 4415 Thatcher provided significant text for this draft. Bernard Aboba, 4416 Adam Bergkvist, Dan Burnett, Ben Campbell, Alissa Cooper, Richard 4417 Ejzak, Stefan Hakansson, Ted Hardie, Christer Holmberg Andrew Hutton, 4418 Randell Jesup, Matthew Kaufman, Anant Narayanan, Adam Roach, Robert 4419 Sparks, Neil Stratford, Martin Thomson, Sean Turner, and Magnus 4420 Westerlund all provided valuable feedback on this proposal. 4422 11. References 4424 11.1. Normative References 4426 [I-D.ietf-avtext-rid] 4427 Roach, A., Nandakumar, S., and P. Thatcher, "RTP Stream 4428 Identifier Source Description (SDES)", draft-ietf-avtext- 4429 rid-09 (work in progress), October 2016. 4431 [I-D.ietf-ice-trickle] 4432 Ivov, E., Rescorla, E., Uberti, J., and P. Saint-Andre, 4433 "Trickle ICE: Incremental Provisioning of Candidates for 4434 the Interactive Connectivity Establishment (ICE) 4435 Protocol", draft-ietf-ice-trickle-21 (work in progress), 4436 April 2018. 4438 [I-D.ietf-mmusic-dtls-sdp] 4439 Holmberg, C. and R. Shpount, "Session Description Protocol 4440 (SDP) Offer/Answer Considerations for Datagram Transport 4441 Layer Security (DTLS) and Transport Layer Security (TLS)", 4442 draft-ietf-mmusic-dtls-sdp-32 (work in progress), October 4443 2017. 4445 [I-D.ietf-mmusic-ice-sip-sdp] 4446 Petit-Huguenin, M., Nandakumar, S., and A. Keranen, 4447 "Session Description Protocol (SDP) Offer/Answer 4448 procedures for Interactive Connectivity Establishment 4449 (ICE)", draft-ietf-mmusic-ice-sip-sdp-24 (work in 4450 progress), November 2018. 4452 [I-D.ietf-mmusic-msid] 4453 Alvestrand, H., "WebRTC MediaStream Identification in the 4454 Session Description Protocol", draft-ietf-mmusic-msid-17 4455 (work in progress), December 2018. 4457 [I-D.ietf-mmusic-mux-exclusive] 4458 Holmberg, C., "Indicating Exclusive Support of RTP/RTCP 4459 Multiplexing using SDP", draft-ietf-mmusic-mux- 4460 exclusive-12 (work in progress), May 2017. 4462 [I-D.ietf-mmusic-rid] 4463 Roach, A., "RTP Payload Format Restrictions", draft-ietf- 4464 mmusic-rid-15 (work in progress), May 2018. 4466 [I-D.ietf-mmusic-sctp-sdp] 4467 Holmberg, C., Shpount, R., Loreto, S., and G. Camarillo, 4468 "Session Description Protocol (SDP) Offer/Answer 4469 Procedures For Stream Control Transmission Protocol (SCTP) 4470 over Datagram Transport Layer Security (DTLS) Transport.", 4471 draft-ietf-mmusic-sctp-sdp-26 (work in progress), April 4472 2017. 4474 [I-D.ietf-mmusic-sdp-bundle-negotiation] 4475 Holmberg, C., Alvestrand, H., and C. Jennings, 4476 "Negotiating Media Multiplexing Using the Session 4477 Description Protocol (SDP)", draft-ietf-mmusic-sdp-bundle- 4478 negotiation-54 (work in progress), December 2018. 4480 [I-D.ietf-mmusic-sdp-mux-attributes] 4481 Nandakumar, S., "A Framework for SDP Attributes when 4482 Multiplexing", draft-ietf-mmusic-sdp-mux-attributes-17 4483 (work in progress), February 2018. 4485 [I-D.ietf-mmusic-sdp-simulcast] 4486 Burman, B., Westerlund, M., Nandakumar, S., and M. Zanaty, 4487 "Using Simulcast in SDP and RTP Sessions", draft-ietf- 4488 mmusic-sdp-simulcast-13 (work in progress), June 2018. 4490 [I-D.ietf-rtcweb-fec] 4491 Uberti, J., "WebRTC Forward Error Correction 4492 Requirements", draft-ietf-rtcweb-fec-08 (work in 4493 progress), March 2018. 4495 [I-D.ietf-rtcweb-rtp-usage] 4496 Perkins, C., Westerlund, M., and J. Ott, "Web Real-Time 4497 Communication (WebRTC): Media Transport and Use of RTP", 4498 draft-ietf-rtcweb-rtp-usage-26 (work in progress), March 4499 2016. 4501 [I-D.ietf-rtcweb-security] 4502 Rescorla, E., "Security Considerations for WebRTC", draft- 4503 ietf-rtcweb-security-11 (work in progress), February 2019. 4505 [I-D.ietf-rtcweb-security-arch] 4506 Rescorla, E., "WebRTC Security Architecture", draft-ietf- 4507 rtcweb-security-arch-18 (work in progress), February 2019. 4509 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 4510 Requirement Levels", BCP 14, RFC 2119, 4511 DOI 10.17487/RFC2119, March 1997, 4512 . 4514 [RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, 4515 A., Peterson, J., Sparks, R., Handley, M., and E. 4516 Schooler, "SIP: Session Initiation Protocol", RFC 3261, 4517 DOI 10.17487/RFC3261, June 2002, 4518 . 4520 [RFC3264] Rosenberg, J. and H. Schulzrinne, "An Offer/Answer Model 4521 with Session Description Protocol (SDP)", RFC 3264, 4522 DOI 10.17487/RFC3264, June 2002, 4523 . 4525 [RFC3552] Rescorla, E. and B. Korver, "Guidelines for Writing RFC 4526 Text on Security Considerations", BCP 72, RFC 3552, 4527 DOI 10.17487/RFC3552, July 2003, 4528 . 4530 [RFC3605] Huitema, C., "Real Time Control Protocol (RTCP) attribute 4531 in Session Description Protocol (SDP)", RFC 3605, 4532 DOI 10.17487/RFC3605, October 2003, 4533 . 4535 [RFC3711] Baugher, M., McGrew, D., Naslund, M., Carrara, E., and K. 4536 Norrman, "The Secure Real-time Transport Protocol (SRTP)", 4537 RFC 3711, DOI 10.17487/RFC3711, March 2004, 4538 . 4540 [RFC3890] Westerlund, M., "A Transport Independent Bandwidth 4541 Modifier for the Session Description Protocol (SDP)", 4542 RFC 3890, DOI 10.17487/RFC3890, September 2004, 4543 . 4545 [RFC4145] Yon, D. and G. Camarillo, "TCP-Based Media Transport in 4546 the Session Description Protocol (SDP)", RFC 4145, 4547 DOI 10.17487/RFC4145, September 2005, 4548 . 4550 [RFC4566] Handley, M., Jacobson, V., and C. Perkins, "SDP: Session 4551 Description Protocol", RFC 4566, DOI 10.17487/RFC4566, 4552 July 2006, . 4554 [RFC4585] Ott, J., Wenger, S., Sato, N., Burmeister, C., and J. Rey, 4555 "Extended RTP Profile for Real-time Transport Control 4556 Protocol (RTCP)-Based Feedback (RTP/AVPF)", RFC 4585, 4557 DOI 10.17487/RFC4585, July 2006, 4558 . 4560 [RFC5124] Ott, J. and E. Carrara, "Extended Secure RTP Profile for 4561 Real-time Transport Control Protocol (RTCP)-Based Feedback 4562 (RTP/SAVPF)", RFC 5124, DOI 10.17487/RFC5124, February 4563 2008, . 4565 [RFC5285] Singer, D. and H. Desineni, "A General Mechanism for RTP 4566 Header Extensions", RFC 5285, DOI 10.17487/RFC5285, July 4567 2008, . 4569 [RFC5761] Perkins, C. and M. Westerlund, "Multiplexing RTP Data and 4570 Control Packets on a Single Port", RFC 5761, 4571 DOI 10.17487/RFC5761, April 2010, 4572 . 4574 [RFC5888] Camarillo, G. and H. Schulzrinne, "The Session Description 4575 Protocol (SDP) Grouping Framework", RFC 5888, 4576 DOI 10.17487/RFC5888, June 2010, 4577 . 4579 [RFC6236] Johansson, I. and K. Jung, "Negotiation of Generic Image 4580 Attributes in the Session Description Protocol (SDP)", 4581 RFC 6236, DOI 10.17487/RFC6236, May 2011, 4582 . 4584 [RFC6347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 4585 Security Version 1.2", RFC 6347, DOI 10.17487/RFC6347, 4586 January 2012, . 4588 [RFC6716] Valin, JM., Vos, K., and T. Terriberry, "Definition of the 4589 Opus Audio Codec", RFC 6716, DOI 10.17487/RFC6716, 4590 September 2012, . 4592 [RFC6904] Lennox, J., "Encryption of Header Extensions in the Secure 4593 Real-time Transport Protocol (SRTP)", RFC 6904, 4594 DOI 10.17487/RFC6904, April 2013, 4595 . 4597 [RFC7160] Petit-Huguenin, M. and G. Zorn, Ed., "Support for Multiple 4598 Clock Rates in an RTP Session", RFC 7160, 4599 DOI 10.17487/RFC7160, April 2014, 4600 . 4602 [RFC7587] Spittka, J., Vos, K., and JM. Valin, "RTP Payload Format 4603 for the Opus Speech and Audio Codec", RFC 7587, 4604 DOI 10.17487/RFC7587, June 2015, 4605 . 4607 [RFC7742] Roach, A., "WebRTC Video Processing and Codec 4608 Requirements", RFC 7742, DOI 10.17487/RFC7742, March 2016, 4609 . 4611 [RFC7850] Nandakumar, S., "Registering Values of the SDP 'proto' 4612 Field for Transporting RTP Media over TCP under Various 4613 RTP Profiles", RFC 7850, DOI 10.17487/RFC7850, April 2016, 4614 . 4616 [RFC7874] Valin, JM. and C. Bran, "WebRTC Audio Codec and Processing 4617 Requirements", RFC 7874, DOI 10.17487/RFC7874, May 2016, 4618 . 4620 [RFC8108] Lennox, J., Westerlund, M., Wu, Q., and C. Perkins, 4621 "Sending Multiple RTP Streams in a Single RTP Session", 4622 RFC 8108, DOI 10.17487/RFC8108, March 2017, 4623 . 4625 [RFC8122] Lennox, J. and C. Holmberg, "Connection-Oriented Media 4626 Transport over the Transport Layer Security (TLS) Protocol 4627 in the Session Description Protocol (SDP)", RFC 8122, 4628 DOI 10.17487/RFC8122, March 2017, 4629 . 4631 [RFC8445] Keranen, A., Holmberg, C., and J. Rosenberg, "Interactive 4632 Connectivity Establishment (ICE): A Protocol for Network 4633 Address Translator (NAT) Traversal", RFC 8445, 4634 DOI 10.17487/RFC8445, July 2018, 4635 . 4637 11.2. Informative References 4639 [I-D.ietf-mmusic-trickle-ice-sip] 4640 Ivov, E., Stach, T., Marocco, E., and C. Holmberg, "A 4641 Session Initiation Protocol (SIP) Usage for Incremental 4642 Provisioning of Candidates for the Interactive 4643 Connectivity Establishment (Trickle ICE)", draft-ietf- 4644 mmusic-trickle-ice-sip-18 (work in progress), June 2018. 4646 [I-D.ietf-rtcweb-ip-handling] 4647 Uberti, J., "WebRTC IP Address Handling Requirements", 4648 draft-ietf-rtcweb-ip-handling-11 (work in progress), 4649 November 2018. 4651 [I-D.ietf-rtcweb-sdp] 4652 Nandakumar, S. and C. Jennings, "Annotated Example SDP for 4653 WebRTC", draft-ietf-rtcweb-sdp-11 (work in progress), 4654 October 2018. 4656 [RFC3389] Zopf, R., "Real-time Transport Protocol (RTP) Payload for 4657 Comfort Noise (CN)", RFC 3389, DOI 10.17487/RFC3389, 4658 September 2002, . 4660 [RFC3556] Casner, S., "Session Description Protocol (SDP) Bandwidth 4661 Modifiers for RTP Control Protocol (RTCP) Bandwidth", 4662 RFC 3556, DOI 10.17487/RFC3556, July 2003, 4663 . 4665 [RFC3960] Camarillo, G. and H. Schulzrinne, "Early Media and Ringing 4666 Tone Generation in the Session Initiation Protocol (SIP)", 4667 RFC 3960, DOI 10.17487/RFC3960, December 2004, 4668 . 4670 [RFC4568] Andreasen, F., Baugher, M., and D. Wing, "Session 4671 Description Protocol (SDP) Security Descriptions for Media 4672 Streams", RFC 4568, DOI 10.17487/RFC4568, July 2006, 4673 . 4675 [RFC4588] Rey, J., Leon, D., Miyazaki, A., Varsa, V., and R. 4676 Hakenberg, "RTP Retransmission Payload Format", RFC 4588, 4677 DOI 10.17487/RFC4588, July 2006, 4678 . 4680 [RFC4733] Schulzrinne, H. and T. Taylor, "RTP Payload for DTMF 4681 Digits, Telephony Tones, and Telephony Signals", RFC 4733, 4682 DOI 10.17487/RFC4733, December 2006, 4683 . 4685 [RFC5245] Rosenberg, J., "Interactive Connectivity Establishment 4686 (ICE): A Protocol for Network Address Translator (NAT) 4687 Traversal for Offer/Answer Protocols", RFC 5245, 4688 DOI 10.17487/RFC5245, April 2010, 4689 . 4691 [RFC5506] Johansson, I. and M. Westerlund, "Support for Reduced-Size 4692 Real-Time Transport Control Protocol (RTCP): Opportunities 4693 and Consequences", RFC 5506, DOI 10.17487/RFC5506, April 4694 2009, . 4696 [RFC5576] Lennox, J., Ott, J., and T. Schierl, "Source-Specific 4697 Media Attributes in the Session Description Protocol 4698 (SDP)", RFC 5576, DOI 10.17487/RFC5576, June 2009, 4699 . 4701 [RFC5763] Fischl, J., Tschofenig, H., and E. Rescorla, "Framework 4702 for Establishing a Secure Real-time Transport Protocol 4703 (SRTP) Security Context Using Datagram Transport Layer 4704 Security (DTLS)", RFC 5763, DOI 10.17487/RFC5763, May 4705 2010, . 4707 [RFC5764] McGrew, D. and E. Rescorla, "Datagram Transport Layer 4708 Security (DTLS) Extension to Establish Keys for the Secure 4709 Real-time Transport Protocol (SRTP)", RFC 5764, 4710 DOI 10.17487/RFC5764, May 2010, 4711 . 4713 [RFC6464] Lennox, J., Ed., Ivov, E., and E. Marocco, "A Real-time 4714 Transport Protocol (RTP) Header Extension for Client-to- 4715 Mixer Audio Level Indication", RFC 6464, 4716 DOI 10.17487/RFC6464, December 2011, 4717 . 4719 [RFC6544] Rosenberg, J., Keranen, A., Lowekamp, B., and A. Roach, 4720 "TCP Candidates with Interactive Connectivity 4721 Establishment (ICE)", RFC 6544, DOI 10.17487/RFC6544, 4722 March 2012, . 4724 [TS26.114] 4725 3GPP TS 26.114 V12.8.0, "3rd Generation Partnership 4726 Project; Technical Specification Group Services and System 4727 Aspects; IP Multimedia Subsystem (IMS); Multimedia 4728 Telephony; Media handling and interaction (Release 12)", 4729 December 2014, . 4731 [W3C.webrtc] 4732 Bergkvist, A., Burnett, D., Jennings, C., Narayanan, A., 4733 Aboba, B., and T. Brandstetter, "WebRTC 1.0: Real-time 4734 Communication Between Browsers", World Wide Web Consortium 4735 WD WD-webrtc-20170515, May 2017, 4736 . 4738 Appendix A. Appendix A 4740 For the syntax validation performed in Section 5.8, the following 4741 list of ABNF definitions is used: 4743 +------------------------+------------------------------------------+ 4744 | Attribute | Reference | 4745 +------------------------+------------------------------------------+ 4746 | ptime | [RFC4566] Section 9 | 4747 | maxptime | [RFC4566] Section 9 | 4748 | rtpmap | [RFC4566] Section 9 | 4749 | recvonly | [RFC4566] Section 9 | 4750 | sendrecv | [RFC4566] Section 9 | 4751 | sendonly | [RFC4566] Section 9 | 4752 | inactive | [RFC4566] Section 9 | 4753 | framerate | [RFC4566] Section 9 | 4754 | fmtp | [RFC4566] Section 9 | 4755 | quality | [RFC4566] Section 9 | 4756 | rtcp | [RFC3605] Section 2.1 | 4757 | setup | [RFC4145] Sections 3, 4, and 5 | 4758 | connection | [RFC4145] Sections 3, 4, and 5 | 4759 | fingerprint | [RFC8122] Section 5 | 4760 | rtcp-fb | [RFC4585] Section 4.2 | 4761 | extmap | [RFC5285] Section 7 | 4762 | mid | [RFC5888] Sections 4 and 5 | 4763 | group | [RFC5888] Sections 4 and 5 | 4764 | imageattr | [RFC6236] Section 3.1 | 4765 | extmap (encrypt | [RFC6904] Section 4 | 4766 | option) | | 4767 | candidate | [I-D.ietf-mmusic-ice-sip-sdp] Section | 4768 | | 4.1 | 4769 | remote-candidates | [I-D.ietf-mmusic-ice-sip-sdp] Section | 4770 | | 4.2 | 4771 | ice-lite | [I-D.ietf-mmusic-ice-sip-sdp] Section | 4772 | | 4.3 | 4773 | ice-ufrag | [I-D.ietf-mmusic-ice-sip-sdp] Section | 4774 | | 4.4 | 4775 | ice-pwd | [I-D.ietf-mmusic-ice-sip-sdp] Section | 4776 | | 4.4 | 4777 | ice-options | [I-D.ietf-mmusic-ice-sip-sdp] Section | 4778 | | 4.6 | 4779 | msid | [I-D.ietf-mmusic-msid] Section 2 | 4780 | rid | [I-D.ietf-mmusic-rid] Section 10 | 4781 | simulcast | [I-D.ietf-mmusic-sdp-simulcast] Section | 4782 | | 6.1 | 4783 | tls-id | [I-D.ietf-mmusic-dtls-sdp] Section 4 | 4784 +------------------------+------------------------------------------+ 4786 Table 1: SDP ABNF References 4788 Appendix B. Change log 4790 Note to RFC Editor: Please remove this section before publication. 4792 Changes in draft-26: 4794 o Update guidance on generation of the m= proto value to be 4795 consistent with ice-sip-sdp. 4797 Changes in draft-25: 4799 o Remove MSID track ID from offers and answers. 4801 o Add note about rejecting all m= sections in a BUNDLE group. 4803 o Update ICE references to RFC 8445 and mention ice2. 4805 Changes in draft-24: 4807 o Clarify that rounding is permitted when trying to maintain aspect 4808 ratio. 4810 o Update tls-id handling to match what is specified in dtls-sdp. 4812 Changes in draft-23: 4814 o Clarify rollback handling, and treat it similarly to other 4815 setLocal/setRemote usages. 4817 o Adopt a first-fit policy for handling multiple remote a=imageattr 4818 attributes. 4820 o Clarify that a session description with zero m= sections is legal. 4822 Changes in draft-22: 4824 o Clarify currentDirection versus direction. 4826 o Correct session-id text so that it aligns with RFC 3264. 4828 o Clarify that generated ICE candidate objects must have all four 4829 fields. 4831 o Make rollback work from any state besides stable and regardless of 4832 whether setLocalDescription or setRemoteDescription is used. 4834 o Allow modifying SDP before sending or after receiving either 4835 offers or answers (previously this was forbidden for answers). 4837 o Provide rationale for several design choices. 4839 Changes in draft-21: 4841 o Change dtls-id to tls-id to match MMUSIC draft. 4843 o Replace regular expression for proto field with a list and clarify 4844 that the answer must exactly match the offer. 4846 o Remove text about how to error check on setLocal because local 4847 descriptions cannot be changed. 4849 o Rework silence suppression support to always require that both 4850 sides agree to silence suppression or none is used. 4852 o Remove instructions to parse "a=ssrc-group". 4854 o Allow the addition of new codecs in answers and in subsequent 4855 offers. 4857 o Clarify imageattr processing. Replace use of [x=0,y=0] with 4858 direction indicators. 4860 o Document when early media can occur. 4862 o Fix ICE default port handling when bundle-only is used. 4864 o Forbid duplicating IDENTICAL/TRANSPORT attributes when you are 4865 bundling. 4867 o Clarify the number of components to gather when bundle is 4868 involved. 4870 o Explicitly state that PTs and SSRCs are to be used for demuxing. 4872 o Update guidance on "a=setup" line. This should now match the 4873 MMUSIC draft. 4875 o Update guidance on certificate/digest matching to conform to 4876 RFC8122. 4878 o Update examples. 4880 Changes in draft-20: 4882 o Remove Appendix-B. 4884 Changes in draft-19: 4886 o Examples are now machine-generated for correctness, and use IETF- 4887 approved example IP addresses. 4889 o Add early transport warmup example, and add missing attributes to 4890 existing examples. 4892 o Only send "a=rtcp-mux-only" and "a=bundle-only" on new m= 4893 sections. 4895 o Update references. 4897 o Add coverage of a=identity. 4899 o Explain the lipsync group algorithm more thoroughly. 4901 o Remove unnecessary list of MTI specs. 4903 o Allow codecs which weren't offered to appear in answers and which 4904 weren't selected to appear in subsequent offers. 4906 o Codec preferences now are applied on both initial and subsequent 4907 offers and answers. 4909 o Clarify a=msid handling for recvonly m= sections. 4911 o Clarify behavior of attributes for bundle-only data channels. 4913 o Allow media attributes to appear in data m= sections when all the 4914 media m= sections are bundle-only. 4916 o Use consistent terminology for JSEP implementations. 4918 o Describe how to handle failed API calls. 4920 o Some cleanup on routing rules. 4922 Changes in draft-18: 4924 o Update demux algorithm and move it to an appendix in preparation 4925 for merging it into BUNDLE. 4927 o Clarify why we can't handle an incoming offer to send simulcast. 4929 o Expand IceCandidate object text. 4931 o Further document use of ICE candidate pool. 4933 o Document removeTrack. 4935 o Update requirements to only accept the last generated offer/answer 4936 as an argument to setLocalDescription. 4938 o Allow round pixels. 4940 o Fix code around default timing when AVPF is not specified. 4942 o Clean up terminology around m= line and m=section. 4944 o Provide a more realistic example for minimum decoder capabilities. 4946 o Document behavior when rtcp-mux policy is require but rtcp-mux 4947 attribute not provided. 4949 o Expanded discussion of RtpSender and RtpReceiver. 4951 o Add RtpTransceiver.currentDirection and document setDirection. 4953 o Require imageattr x=0, y=0 to indicate that there are no valid 4954 resolutions. 4956 o Require a privacy-preserving MID/RID construction. 4958 o Require support for RFC 3556 bandwidth modifiers. 4960 o Update maxptime description. 4962 o Note that endpoints may encounter extra codecs in answers and 4963 subsequent offers from non-JSEP peers. 4965 o Update references. 4967 Changes in draft-17: 4969 o Split createOffer and createAnswer sections to clearly indicate 4970 attributes which always appear and which only appear when not 4971 bundled into another m= section. 4973 o Add descriptions of RtpTransceiver methods. 4975 o Describe how to process RTCP feedback attributes. 4977 o Clarify transceiver directions and their interaction with 3264. 4979 o Describe setCodecPreferences. 4981 o Update RTP demux algorithm. Include RTCP. 4983 o Update requirements for when a=rtcp is included, limiting to cases 4984 where it is needed for backward compatibility. 4986 o Clarify SAR handling. 4988 o Updated addTrack matching algorithm. 4990 o Remove a=ssrc requirements. 4992 o Handle a=setup in reoffers. 4994 o Discuss how RTX/FEC should be handled. 4996 o Discuss how telephone-event should be handled. 4998 o Discuss how CN/DTX should be handled. 5000 o Add missing references to ABNF table. 5002 Changes in draft-16: 5004 o Update addIceCandidate to indicate ICE generation and allow per-m= 5005 section end-of-candidates. 5007 o Update fingerprint handling to use draft-ietf-mmusic-4572-update. 5009 o Update text around SDP processing of RTP header extensions and 5010 payload formats. 5012 o Add sections on simulcast, addTransceiver, and createDataChannel. 5014 o Clarify text to ensure that the session ID is a positive 63 bit 5015 integer. 5017 o Clarify SDP processing for direction indication. 5019 o Describe SDP processing for rtcp-mux-only. 5021 o Specify how SDP session version in o= line. 5023 o Require that when doing an re-offer, the capabilities of the new 5024 session are mostly required to be a subset of the previously 5025 negotiated session. 5027 o Clarified ICE restart interaction with bundle-only. 5029 o Remove support for changing SDP before calling 5030 setLocalDescription. 5032 o Specify algorithm for demuxing RTP based on MID, PT, and SSRC. 5034 o Clarify rules for rejecting m= lines when bundle policy is 5035 balanced or max-bundle. 5037 Changes in draft-15: 5039 o Clarify text around codecs offered in subsequent transactions to 5040 refer to what's been negotiated. 5042 o Rewrite LS handling text to indicate edge cases and that we're 5043 living with them. 5045 o Require that answerer reject m= lines when there are no codecs in 5046 common. 5048 o Enforce max-bundle on offer processing. 5050 o Fix TIAS formula to handle bits vs. kilobits. 5052 o Describe addTrack algorithm. 5054 o Clean up references. 5056 Changes in draft-14: 5058 o Added discussion of RtpTransceivers + RtpSenders + RtpReceivers, 5059 and how they interact with createOffer/createAnswer. 5061 o Removed obsolete OfferToReceiveX options. 5063 o Explained how addIceCandidate can be used for end-of-candidates. 5065 Changes in draft-13: 5067 o Clarified which SDP lines can be ignored. 5069 o Clarified how to handle various received attributes. 5071 o Revised how attributes should be generated for bundled m= lines. 5073 o Remove unused references. 5075 o Remove text advocating use of unilateral PTs. 5077 o Trigger an ICE restart even if the ICE candidate policy is being 5078 made more strict. 5080 o Remove the 'public' ICE candidate policy. 5082 o Move open issues into GitHub issues. 5084 o Split local/remote description accessors into current/pending. 5086 o Clarify a=imageattr handling. 5088 o Add more detail on VoiceActivityDetection handling. 5090 o Reference draft-shieh-rtcweb-ip-handling. 5092 o Make it clear when an ICE restart should occur. 5094 o Resolve changes needed in references. 5096 o Remove MSID semantics. 5098 o ice-options are now at session level. 5100 o Default RTCP mux policy is now 'require'. 5102 Changes in draft-12: 5104 o Filled in sections on applying local and remote descriptions. 5106 o Discussed downscaling and upscaling to fulfill imageattr 5107 requirements. 5109 o Updated what SDP can be modified by the application. 5111 o Updated to latest datachannel SDP. 5113 o Allowed multiple fingerprint lines. 5115 o Switched back to IPv4 for dummy candidates. 5117 o Added additional clarity on ICE default candidates. 5119 Changes in draft-11: 5121 o Clarified handling of RTP CNAMEs. 5123 o Updated what SDP lines should be processed or ignored. 5125 o Specified how a=imageattr should be used. 5127 Changes in draft-10: 5129 o Described video size negotiation with imageattr. 5131 o Clarified rejection of sections that do not have mux-only. 5133 o Add handling of LS groups 5135 Changes in draft-09: 5137 o Don't return null for {local,remote}Description after close(). 5139 o Changed TCP/TLS to UDP/DTLS in RTP profile names. 5141 o Separate out bundle and mux policy. 5143 o Added specific references to FEC mechanisms. 5145 o Added canTrickle mechanism. 5147 o Added section on subsequent answers and, answer options. 5149 o Added text defining set{Local,Remote}Description behavior. 5151 Changes in draft-08: 5153 o Added new example section and removed old examples in appendix. 5155 o Fixed field handling. 5157 o Added text describing a=rtcp attribute. 5159 o Reworked handling of OfferToReceiveAudio and OfferToReceiveVideo 5160 per discussion at IETF 90. 5162 o Reworked trickle ICE handling and its impact on m= and c= lines 5163 per discussion at interim. 5165 o Added max-bundle-and-rtcp-mux policy. 5167 o Added description of maxptime handling. 5169 o Updated ICE candidate pool default to 0. 5171 o Resolved open issues around AppID/receiver-ID. 5173 o Reworked and expanded how changes to the ICE configuration are 5174 handled. 5176 o Some reference updates. 5178 o Editorial clarification. 5180 Changes in draft-07: 5182 o Expanded discussion of VAD and Opus DTX. 5184 o Added a security considerations section. 5186 o Rewrote the section on modifying SDP to require implementations to 5187 clearly indicate whether any given modification is allowed. 5189 o Clarified impact of IceRestart on CreateOffer in local-offer 5190 state. 5192 o Guidance on whether attributes should be defined at the media 5193 level or the session level. 5195 o Renamed "default" bundle policy to "balanced". 5197 o Removed default ICE candidate pool size and clarify how it works. 5199 o Defined a canonical order for assignment of MSTs to m= lines. 5201 o Removed discussion of rehydration. 5203 o Added Eric Rescorla as a draft editor. 5205 o Cleaned up references. 5207 o Editorial cleanup 5209 Changes in draft-06: 5211 o Reworked handling of m= line recycling. 5213 o Added handling of BUNDLE and bundle-only. 5215 o Clarified handling of rollback. 5217 o Added text describing the ICE Candidate Pool and its behavior. 5219 o Allowed OfferToReceiveX to create multiple recvonly m= sections. 5221 Changes in draft-05: 5223 o Fixed several issues identified in the createOffer/Answer sections 5224 during document review. 5226 o Updated references. 5228 Changes in draft-04: 5230 o Filled in sections on createOffer and createAnswer. 5232 o Added SDP examples. 5234 o Fixed references. 5236 Changes in draft-03: 5238 o Added text describing relationship to W3C specification 5240 Changes in draft-02: 5242 o Converted from nroff 5244 o Removed comparisons to old approaches abandoned by the working 5245 group 5247 o Removed stuff that has moved to W3C specification 5249 o Align SDP handling with W3C draft 5251 o Clarified section on forking. 5253 Changes in draft-01: 5255 o Added diagrams for architecture and state machine. 5257 o Added sections on forking and rehydration. 5259 o Clarified meaning of "pranswer" and "answer". 5261 o Reworked how ICE restarts and media directions are controlled. 5263 o Added list of parameters that can be changed in a description. 5265 o Updated suggested API and examples to match latest thinking. 5267 o Suggested API and examples have been moved to an appendix. 5269 Changes in draft -00: 5271 o Migrated from draft-uberti-rtcweb-jsep-02. 5273 Authors' Addresses 5275 Justin Uberti 5276 Google 5277 747 6th St S 5278 Kirkland, WA 98033 5279 USA 5281 Email: justin@uberti.name 5283 Cullen Jennings 5284 Cisco 5285 400 3rd Avenue SW 5286 Calgary, AB T2P 4H2 5287 Canada 5289 Email: fluffy@iii.ca 5291 Eric Rescorla (editor) 5292 Mozilla 5293 331 Evelyn Ave 5294 Mountain View, CA 94041 5295 USA 5297 Email: ekr@rtfm.com