idnits 2.17.1 draft-ietf-rtcweb-jsep-23.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 3764 has weird spacing: '... mid a1...' == Line 3765 has weird spacing: '... attr candi...' == Line 3771 has weird spacing: '... mid a1...' == Line 3772 has weird spacing: '... attr candi...' == Line 3779 has weird spacing: '... mid a1...' == (11 more instances...) -- The document date (September 1, 2017) is 2428 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) == Outdated reference: A later version (-21) exists of draft-ietf-ice-trickle-13 == Outdated reference: A later version (-32) exists of draft-ietf-mmusic-dtls-sdp-29 == Outdated reference: A later version (-17) exists of draft-ietf-mmusic-msid-16 == Outdated reference: A later version (-15) exists of draft-ietf-mmusic-rid-11 == Outdated reference: A later version (-54) exists of draft-ietf-mmusic-sdp-bundle-negotiation-39 == Outdated reference: A later version (-19) exists of draft-ietf-mmusic-sdp-mux-attributes-16 == Outdated reference: A later version (-14) exists of draft-ietf-mmusic-sdp-simulcast-10 == Outdated reference: A later version (-10) exists of draft-ietf-rtcweb-fec-06 == Outdated reference: A later version (-12) exists of draft-ietf-rtcweb-security-08 == Outdated reference: A later version (-20) exists of draft-ietf-rtcweb-security-arch-12 ** Obsolete normative reference: RFC 4566 (Obsoleted by RFC 8866) ** Obsolete normative reference: RFC 5245 (Obsoleted by RFC 8445, RFC 8839) ** Obsolete normative reference: RFC 5285 (Obsoleted by RFC 8285) ** Obsolete normative reference: RFC 6347 (Obsoleted by RFC 9147) == Outdated reference: A later version (-18) exists of draft-ietf-mmusic-trickle-ice-sip-08 == Outdated reference: A later version (-12) exists of draft-ietf-rtcweb-ip-handling-04 == Outdated reference: A later version (-14) exists of draft-ietf-rtcweb-sdp-06 Summary: 4 errors (**), 0 flaws (~~), 20 warnings (==), 2 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: March 5, 2018 Cisco 6 E. Rescorla, Ed. 7 Mozilla 8 September 1, 2017 10 JavaScript Session Establishment Protocol 11 draft-ietf-rtcweb-jsep-23 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 http://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 March 5, 2018. 37 Copyright Notice 39 Copyright (c) 2017 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 (http://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.6. Video Size Negotiation . . . . . . . . . . . . . . . . . 16 73 3.6.1. Creating an imageattr Attribute . . . . . . . . . . . 16 74 3.6.2. Interpreting imageattr Attributes . . . . . . . . . . 17 75 3.7. Simulcast . . . . . . . . . . . . . . . . . . . . . . . . 19 76 3.8. Interactions With Forking . . . . . . . . . . . . . . . . 20 77 3.8.1. Sequential Forking . . . . . . . . . . . . . . . . . 20 78 3.8.2. Parallel Forking . . . . . . . . . . . . . . . . . . 21 79 4. Interface . . . . . . . . . . . . . . . . . . . . . . . . . . 22 80 4.1. PeerConnection . . . . . . . . . . . . . . . . . . . . . 22 81 4.1.1. Constructor . . . . . . . . . . . . . . . . . . . . . 22 82 4.1.2. addTrack . . . . . . . . . . . . . . . . . . . . . . 24 83 4.1.3. removeTrack . . . . . . . . . . . . . . . . . . . . . 24 84 4.1.4. addTransceiver . . . . . . . . . . . . . . . . . . . 24 85 4.1.5. createDataChannel . . . . . . . . . . . . . . . . . . 25 86 4.1.6. createOffer . . . . . . . . . . . . . . . . . . . . . 25 87 4.1.7. createAnswer . . . . . . . . . . . . . . . . . . . . 26 88 4.1.8. SessionDescriptionType . . . . . . . . . . . . . . . 27 89 4.1.8.1. Use of Provisional Answers . . . . . . . . . . . 28 90 4.1.8.2. Rollback . . . . . . . . . . . . . . . . . . . . 28 91 4.1.9. setLocalDescription . . . . . . . . . . . . . . . . . 29 92 4.1.10. setRemoteDescription . . . . . . . . . . . . . . . . 29 93 4.1.11. currentLocalDescription . . . . . . . . . . . . . . . 30 94 4.1.12. pendingLocalDescription . . . . . . . . . . . . . . . 30 95 4.1.13. currentRemoteDescription . . . . . . . . . . . . . . 30 96 4.1.14. pendingRemoteDescription . . . . . . . . . . . . . . 30 97 4.1.15. canTrickleIceCandidates . . . . . . . . . . . . . . . 31 98 4.1.16. setConfiguration . . . . . . . . . . . . . . . . . . 31 99 4.1.17. addIceCandidate . . . . . . . . . . . . . . . . . . . 32 100 4.2. RtpTransceiver . . . . . . . . . . . . . . . . . . . . . 33 101 4.2.1. stop . . . . . . . . . . . . . . . . . . . . . . . . 33 102 4.2.2. stopped . . . . . . . . . . . . . . . . . . . . . . . 33 103 4.2.3. setDirection . . . . . . . . . . . . . . . . . . . . 33 104 4.2.4. direction . . . . . . . . . . . . . . . . . . . . . . 33 105 4.2.5. currentDirection . . . . . . . . . . . . . . . . . . 34 106 4.2.6. setCodecPreferences . . . . . . . . . . . . . . . . . 34 107 5. SDP Interaction Procedures . . . . . . . . . . . . . . . . . 34 108 5.1. Requirements Overview . . . . . . . . . . . . . . . . . . 34 109 5.1.1. Usage Requirements . . . . . . . . . . . . . . . . . 35 110 5.1.2. Profile Names and Interoperability . . . . . . . . . 35 111 5.2. Constructing an Offer . . . . . . . . . . . . . . . . . . 36 112 5.2.1. Initial Offers . . . . . . . . . . . . . . . . . . . 36 113 5.2.2. Subsequent Offers . . . . . . . . . . . . . . . . . . 43 114 5.2.3. Options Handling . . . . . . . . . . . . . . . . . . 47 115 5.2.3.1. IceRestart . . . . . . . . . . . . . . . . . . . 47 116 5.2.3.2. VoiceActivityDetection . . . . . . . . . . . . . 47 117 5.3. Generating an Answer . . . . . . . . . . . . . . . . . . 48 118 5.3.1. Initial Answers . . . . . . . . . . . . . . . . . . . 48 119 5.3.2. Subsequent Answers . . . . . . . . . . . . . . . . . 55 120 5.3.3. Options Handling . . . . . . . . . . . . . . . . . . 56 121 5.3.3.1. VoiceActivityDetection . . . . . . . . . . . . . 56 122 5.4. Modifying an Offer or Answer . . . . . . . . . . . . . . 56 123 5.5. Processing a Local Description . . . . . . . . . . . . . 57 124 5.6. Processing a Remote Description . . . . . . . . . . . . . 58 125 5.7. Processing a Rollback . . . . . . . . . . . . . . . . . . 58 126 5.8. Parsing a Session Description . . . . . . . . . . . . . . 59 127 5.8.1. Session-Level Parsing . . . . . . . . . . . . . . . . 59 128 5.8.2. Media Section Parsing . . . . . . . . . . . . . . . . 61 129 5.8.3. Semantics Verification . . . . . . . . . . . . . . . 64 130 5.9. Applying a Local Description . . . . . . . . . . . . . . 65 131 5.10. Applying a Remote Description . . . . . . . . . . . . . . 66 132 5.11. Applying an Answer . . . . . . . . . . . . . . . . . . . 70 133 6. Processing RTP/RTCP . . . . . . . . . . . . . . . . . . . . . 73 134 7. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 73 135 7.1. Simple Example . . . . . . . . . . . . . . . . . . . . . 74 136 7.2. Detailed Example . . . . . . . . . . . . . . . . . . . . 78 137 7.3. Early Transport Warmup Example . . . . . . . . . . . . . 88 138 8. Security Considerations . . . . . . . . . . . . . . . . . . . 95 139 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 96 140 10. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 96 141 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 96 142 11.1. Normative References . . . . . . . . . . . . . . . . . . 96 143 11.2. Informative References . . . . . . . . . . . . . . . . . 101 144 Appendix A. Appendix A . . . . . . . . . . . . . . . . . . . . . 103 145 Appendix B. Change log . . . . . . . . . . . . . . . . . . . . . 104 146 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 114 148 1. Introduction 150 This document describes how the W3C WEBRTC RTCPeerConnection 151 interface [W3C.webrtc] is used to control the setup, management and 152 teardown of a multimedia session. 154 1.1. General Design of JSEP 156 WebRTC call setup has been designed to focus on controlling the media 157 plane, leaving signaling plane behavior up to the application as much 158 as possible. The rationale is that different applications may prefer 159 to use different protocols, such as the existing SIP call signaling 160 protocol, or something custom to the particular application, perhaps 161 for a novel use case. In this approach, the key information that 162 needs to be exchanged is the multimedia session description, which 163 specifies the necessary transport and media configuration information 164 necessary to establish the media plane. 166 With these considerations in mind, this document describes the 167 JavaScript Session Establishment Protocol (JSEP) that allows for full 168 control of the signaling state machine from JavaScript. As described 169 above, JSEP assumes a model in which a JavaScript application 170 executes inside a runtime containing WebRTC APIs (the "JSEP 171 implementation"). The JSEP implementation is almost entirely 172 divorced from the core signaling flow, which is instead handled by 173 the JavaScript making use of two interfaces: (1) passing in local and 174 remote session descriptions and (2) interacting with the ICE state 175 machine. The combination of the JSEP implementation and the 176 JavaScript application is referred to throughout this document as a 177 "JSEP endpoint". 179 In this document, the use of JSEP is described as if it always occurs 180 between two JSEP endpoints. Note though in many cases it will 181 actually be between a JSEP endpoint and some kind of server, such as 182 a gateway or MCU. This distinction is invisible to the JSEP 183 endpoint; it just follows the instructions it is given via the API. 185 JSEP's handling of session descriptions is simple and 186 straightforward. Whenever an offer/answer exchange is needed, the 187 initiating side creates an offer by calling a createOffer() API. The 188 application then uses that offer to set up its local config via the 189 setLocalDescription() API. The offer is finally sent off to the 190 remote side over its preferred signaling mechanism (e.g., 191 WebSockets); upon receipt of that offer, the remote party installs it 192 using the setRemoteDescription() API. 194 To complete the offer/answer exchange, the remote party uses the 195 createAnswer() API to generate an appropriate answer, applies it 196 using the setLocalDescription() API, and sends the answer back to the 197 initiator over the signaling channel. When the initiator gets that 198 answer, it installs it using the setRemoteDescription() API, and 199 initial setup is complete. This process can be repeated for 200 additional offer/answer exchanges. 202 Regarding ICE [RFC5245], JSEP decouples the ICE state machine from 203 the overall signaling state machine, as the ICE state machine must 204 remain in the JSEP implementation, because only the implementation 205 has the necessary knowledge of candidates and other transport 206 information. Performing this separation provides additional 207 flexibility in protocols that decouple session descriptions from 208 transport. For instance, in traditional SIP, each offer or answer is 209 self-contained, including both the session descriptions and the 210 transport information. However, [I-D.ietf-mmusic-trickle-ice-sip] 211 allows SIP to be used with trickle ICE [I-D.ietf-ice-trickle], in 212 which the session description can be sent immediately and the 213 transport information can be sent when available. Sending transport 214 information separately can allow for faster ICE and DTLS startup, 215 since ICE checks can start as soon as any transport information is 216 available rather than waiting for all of it. JSEP's decoupling of 217 the ICE and signaling state machines allows it to accommodate either 218 model. 220 Through its abstraction of signaling, the JSEP approach does require 221 the application to be aware of the signaling process. While the 222 application does not need to understand the contents of session 223 descriptions to set up a call, the application must call the right 224 APIs at the right times, convert the session descriptions and ICE 225 information into the defined messages of its chosen signaling 226 protocol, and perform the reverse conversion on the messages it 227 receives from the other side. 229 One way to make life easier for the application is to provide a 230 JavaScript library that hides this complexity from the developer; 231 said library would implement a given signaling protocol along with 232 its state machine and serialization code, presenting a higher level 233 call-oriented interface to the application developer. For example, 234 libraries exist to adapt the JSEP API into an API suitable for a SIP 235 or XMPP. Thus, JSEP provides greater control for the experienced 236 developer without forcing any additional complexity on the novice 237 developer. 239 1.2. Other Approaches Considered 241 One approach that was considered instead of JSEP was to include a 242 lightweight signaling protocol. Instead of providing session 243 descriptions to the API, the API would produce and consume messages 244 from this protocol. While providing a more high-level API, this put 245 more control of signaling within the JSEP implementation, forcing it 246 to have to understand and handle concepts like signaling glare (see 247 [RFC3264], Section 4). 249 A second approach that was considered but not chosen was to decouple 250 the management of the media control objects from session 251 descriptions, instead offering APIs that would control each component 252 directly. This was rejected based on the argument that requiring 253 exposure of this level of complexity to the application programmer 254 would not be beneficial; it would result in an API where even a 255 simple example would require a significant amount of code to 256 orchestrate all the needed interactions, as well as creating a large 257 API surface that needed to be agreed upon and documented. In 258 addition, these API points could be called in any order, resulting in 259 a more complex set of interactions with the media subsystem than the 260 JSEP approach, which specifies how session descriptions are to be 261 evaluated and applied. 263 One variation on JSEP that was considered was to keep the basic 264 session description-oriented API, but to move the mechanism for 265 generating offers and answers out of the JSEP implementation. 266 Instead of providing createOffer/createAnswer methods within the 267 implementation, this approach would instead expose a getCapabilities 268 API which would provide the application with the information it 269 needed in order to generate its own session descriptions. This 270 increases the amount of work that the application needs to do; it 271 needs to know how to generate session descriptions from capabilities, 272 and especially how to generate the correct answer from an arbitrary 273 offer and the supported capabilities. While this could certainly be 274 addressed by using a library like the one mentioned above, it 275 basically forces the use of said library even for a simple example. 276 Providing createOffer/createAnswer avoids this problem. 278 2. Terminology 280 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 281 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 282 document are to be interpreted as described in [RFC2119]. 284 3. Semantics and Syntax 286 3.1. Signaling Model 288 JSEP does not specify a particular signaling model or state machine, 289 other than the generic need to exchange session descriptions in the 290 fashion described by [RFC3264] (offer/answer) in order for both sides 291 of the session to know how to conduct the session. JSEP provides 292 mechanisms to create offers and answers, as well as to apply them to 293 a session. However, the JSEP implementation is totally decoupled 294 from the actual mechanism by which these offers and answers are 295 communicated to the remote side, including addressing, 296 retransmission, forking, and glare handling. These issues are left 297 entirely up to the application; the application has complete control 298 over which offers and answers get handed to the implementation, and 299 when. 301 +-----------+ +-----------+ 302 | Web App |<--- App-Specific Signaling -->| Web App | 303 +-----------+ +-----------+ 304 ^ ^ 305 | SDP | SDP 306 V V 307 +-----------+ +-----------+ 308 | JSEP |<----------- Media ------------>| JSEP | 309 | Impl. | | Impl. | 310 +-----------+ +-----------+ 312 Figure 1: JSEP Signaling Model 314 3.2. Session Descriptions and State Machine 316 In order to establish the media plane, the JSEP implementation needs 317 specific parameters to indicate what to transmit to the remote side, 318 as well as how to handle the media that is received. These 319 parameters are determined by the exchange of session descriptions in 320 offers and answers, and there are certain details to this process 321 that must be handled in the JSEP APIs. 323 Whether a session description applies to the local side or the remote 324 side affects the meaning of that description. For example, the list 325 of codecs sent to a remote party indicates what the local side is 326 willing to receive, which, when intersected with the set of codecs 327 the remote side supports, specifies what the remote side should send. 328 However, not all parameters follow this rule; some parameters are 329 declarative and the remote side MUST either accept them or reject 330 them altogether. An example of such a parameter is the DTLS 331 fingerprints [RFC8122], which are calculated based on the local 332 certificate(s) offered, and are not subject to negotiation. 334 In addition, various RFCs put different conditions on the format of 335 offers versus answers. For example, an offer may propose an 336 arbitrary number of m= sections (i.e., media descriptions as 337 described in [RFC4566], Section 5.14), but an answer must contain the 338 exact same number as the offer. 340 Lastly, while the exact media parameters are only known only after an 341 offer and an answer have been exchanged, the offerer may receive ICE 342 checks, and possibly media (e.g., in the case of a re-offer after a 343 connection has been established) before it receives an answer. To 344 properly process incoming media in this case, the offerer's media 345 handler must be aware of the details of the offer before the answer 346 arrives. 348 Therefore, in order to handle session descriptions properly, the JSEP 349 implementation needs: 351 1. To know if a session description pertains to the local or remote 352 side. 354 2. To know if a session description is an offer or an answer. 356 3. To allow the offer to be specified independently of the answer. 358 JSEP addresses this by adding both setLocalDescription and 359 setRemoteDescription methods and having session description objects 360 contain a type field indicating the type of session description being 361 supplied. This satisfies the requirements listed above for both the 362 offerer, who first calls setLocalDescription(sdp [offer]) and then 363 later setRemoteDescription(sdp [answer]), as well as for the 364 answerer, who first calls setRemoteDescription(sdp [offer]) and then 365 later setLocalDescription(sdp [answer]). 367 During the offer/answer exchange, the outstanding offer is considered 368 to be "pending" at the offerer and the answerer, as it may either be 369 accepted or rejected. If this is a re-offer, each side will also 370 have "current" local and remote descriptions, which reflect the 371 result of the last offer/answer exchange. Sections Section 4.1.12, 372 Section 4.1.14, Section 4.1.11, and Section 4.1.13, provide more 373 detail on pending and current descriptions. 375 JSEP also allows for an answer to be treated as provisional by the 376 application. Provisional answers provide a way for an answerer to 377 communicate initial session parameters back to the offerer, in order 378 to allow the session to begin, while allowing a final answer to be 379 specified later. This concept of a final answer is important to the 380 offer/answer model; when such an answer is received, any extra 381 resources allocated by the caller can be released, now that the exact 382 session configuration is known. These "resources" can include things 383 like extra ICE components, TURN candidates, or video decoders. 384 Provisional answers, on the other hand, do no such deallocation; as a 385 result, multiple dissimilar provisional answers, with their own codec 386 choices, transport parameters, etc., can be received and applied 387 during call setup. Note that the final answer itself may be 388 different than any received provisional answers. 390 In [RFC3264], the constraint at the signaling level is that only one 391 offer can be outstanding for a given session, but at the media stack 392 level, a new offer can be generated at any point. For example, when 393 using SIP for signaling, if one offer is sent, then cancelled using a 394 SIP CANCEL, another offer can be generated even though no answer was 395 received for the first offer. To support this, the JSEP media layer 396 can provide an offer via the createOffer() method whenever the 397 JavaScript application needs one for the signaling. The answerer can 398 send back zero or more provisional answers, and finally end the 399 offer-answer exchange by sending a final answer. The state machine 400 for this is as follows: 402 setRemote(OFFER) setLocal(PRANSWER) 403 /-----\ /-----\ 404 | | | | 405 v | v | 406 +---------------+ | +---------------+ | 407 | |----/ | |----/ 408 | have- | setLocal(PRANSWER) | have- | 409 | remote-offer |------------------- >| local-pranswer| 410 | | | | 411 | | | | 412 +---------------+ +---------------+ 413 ^ | | 414 | | setLocal(ANSWER) | 415 setRemote(OFFER) | | 416 | V setLocal(ANSWER) | 417 +---------------+ | 418 | | | 419 | |<---------------------------+ 420 | stable | 421 | |<---------------------------+ 422 | | | 423 +---------------+ setRemote(ANSWER) | 424 ^ | | 425 | | setLocal(OFFER) | 426 setRemote(ANSWER) | | 427 | V | 428 +---------------+ +---------------+ 429 | | | | 430 | have- | setRemote(PRANSWER) |have- | 431 | local-offer |------------------- >|remote-pranswer| 432 | | | | 433 | |----\ | |----\ 434 +---------------+ | +---------------+ | 435 ^ | ^ | 436 | | | | 437 \-----/ \-----/ 438 setLocal(OFFER) setRemote(PRANSWER) 440 Figure 2: JSEP State Machine 442 Aside from these state transitions there is no other difference 443 between the handling of provisional ("pranswer") and final ("answer") 444 answers. 446 3.3. Session Description Format 448 JSEP's session descriptions use SDP syntax for their internal 449 representation. While this format is not optimal for manipulation 450 from JavaScript, it is widely accepted, and frequently updated with 451 new features; any alternate encoding of session descriptions would 452 have to keep pace with the changes to SDP, at least until the time 453 that this new encoding eclipsed SDP in popularity. 455 However, to provide for future flexibility, the SDP syntax is 456 encapsulated within a SessionDescription object, which can be 457 constructed from SDP, and be serialized out to SDP. If future 458 specifications agree on a JSON format for session descriptions, we 459 could easily enable this object to generate and consume that JSON. 461 As detailed below, most applications should be able to treat the 462 SessionDescriptions produced and consumed by these various API calls 463 as opaque blobs; that is, the application will not need to read or 464 change them. 466 3.4. Session Description Control 468 In order to give the application control over various common session 469 parameters, JSEP provides control surfaces which tell the JSEP 470 implementation how to generate session descriptions. This avoids the 471 need for JavaScript to modify session descriptions in most cases. 473 Changes to these objects result in changes to the session 474 descriptions generated by subsequent createOffer/Answer calls. 476 3.4.1. RtpTransceivers 478 RtpTransceivers allow the application to control the RTP media 479 associated with one m= section. Each RtpTransceiver has an RtpSender 480 and an RtpReceiver, which an application can use to control the 481 sending and receiving of RTP media. The application may also modify 482 the RtpTransceiver directly, for instance, by stopping it. 484 RtpTransceivers generally have a 1:1 mapping with m= sections, 485 although there may be more RtpTransceivers than m= sections when 486 RtpTransceivers are created but not yet associated with a m= section, 487 or if RtpTransceivers have been stopped and disassociated from m= 488 sections. An RtpTransceiver is said to be associated with an m= 489 section if its mid property is non-null; otherwise it is said to be 490 disassociated. The associated m= section is determined using a 491 mapping between transceivers and m= section indices, formed when 492 creating an offer or applying a remote offer. 494 An RtpTransceiver is never associated with more than one m= section, 495 and once a session description is applied, a m= section is always 496 associated with exactly one RtpTransceiver. However, in certain 497 cases where a m= section has been rejected, as discussed in 498 Section 5.2.2 below, that m= section will be "recycled" and 499 associated with a new RtpTransceiver with a new mid value. 501 RtpTransceivers can be created explicitly by the application or 502 implicitly by calling setRemoteDescription with an offer that adds 503 new m= sections. 505 3.4.2. RtpSenders 507 RtpSenders allow the application to control how RTP media is sent. 508 An RtpSender is conceptually responsible for the outgoing RTP 509 stream(s) described by an m= section. This includes encoding the 510 attached MediaStreamTrack, sending RTP media packets, and generating/ 511 processing RTCP for the outgoing RTP streams(s). 513 3.4.3. RtpReceivers 515 RtpReceivers allow the application to inspect how RTP media is 516 received. An RtpReceiver is conceptually responsible for the 517 incoming RTP stream(s) described by an m= section. This includes 518 processing received RTP media packets, decoding the incoming 519 stream(s) to produce a remote MediaStreamTrack, and generating/ 520 processing RTCP for the incoming RTP stream(s). 522 3.5. ICE 524 3.5.1. ICE Gathering Overview 526 JSEP gathers ICE candidates as needed by the application. Collection 527 of ICE candidates is referred to as a gathering phase, and this is 528 triggered either by the addition of a new or recycled m= section to 529 the local session description, or new ICE credentials in the 530 description, indicating an ICE restart. Use of new ICE credentials 531 can be triggered explicitly by the application, or implicitly by the 532 JSEP implementation in response to changes in the ICE configuration. 534 When the ICE configuration changes in a way that requires a new 535 gathering phase, a 'needs-ice-restart' bit is set. When this bit is 536 set, calls to the createOffer API will generate new ICE credentials. 537 This bit is cleared by a call to the setLocalDescription API with new 538 ICE credentials from either an offer or an answer, i.e., from either 539 a local- or remote-initiated ICE restart. 541 When a new gathering phase starts, the ICE agent will notify the 542 application that gathering is occurring through an event. Then, when 543 each new ICE candidate becomes available, the ICE agent will supply 544 it to the application via an additional event; these candidates will 545 also automatically be added to the current and/or pending local 546 session description. Finally, when all candidates have been 547 gathered, an event will be dispatched to signal that the gathering 548 process is complete. 550 Note that gathering phases only gather the candidates needed by 551 new/recycled/restarting m= sections; other m= sections continue to 552 use their existing candidates. Also, if an m= section is bundled 553 (either by a successful bundle negotiation or by being marked as 554 bundle-only), then candidates will be gathered and exchanged for that 555 m= section if and only if its MID is a BUNDLE-tag, as described in 556 [I-D.ietf-mmusic-sdp-bundle-negotiation]. 558 3.5.2. ICE Candidate Trickling 560 Candidate trickling is a technique through which a caller may 561 incrementally provide candidates to the callee after the initial 562 offer has been dispatched; the semantics of "Trickle ICE" are defined 563 in [I-D.ietf-ice-trickle]. This process allows the callee to begin 564 acting upon the call and setting up the ICE (and perhaps DTLS) 565 connections immediately, without having to wait for the caller to 566 gather all possible candidates. This results in faster media setup 567 in cases where gathering is not performed prior to initiating the 568 call. 570 JSEP supports optional candidate trickling by providing APIs, as 571 described above, that provide control and feedback on the ICE 572 candidate gathering process. Applications that support candidate 573 trickling can send the initial offer immediately and send individual 574 candidates when they get the notified of a new candidate; 575 applications that do not support this feature can simply wait for the 576 indication that gathering is complete, and then create and send their 577 offer, with all the candidates, at this time. 579 Upon receipt of trickled candidates, the receiving application will 580 supply them to its ICE agent. This triggers the ICE agent to start 581 using the new remote candidates for connectivity checks. 583 3.5.2.1. ICE Candidate Format 585 In JSEP, ICE candidates are abstracted by an IceCandidate object, and 586 as with session descriptions, SDP syntax is used for the internal 587 representation. 589 The candidate details are specified in an IceCandidate field, using 590 the same SDP syntax as the "candidate-attribute" field defined in 591 [RFC5245], Section 15.1. Note that this field does not contain an 592 "a=" prefix, as indicated in the following example: 594 candidate:1 1 UDP 1694498815 192.0.2.33 10000 typ host 596 The IceCandidate object contains a field to indicate which ICE ufrag 597 it is associated with, as defined in [RFC5245], Section 15.4. This 598 value is used to determine which session description (and thereby 599 which gathering phase) this IceCandidate belongs to, which helps 600 resolve ambiguities during ICE restarts. If this field is absent in 601 a received IceCandidate (perhaps when communicating with a non-JSEP 602 endpoint), the most recently received session description is assumed. 604 The IceCandidate object also contains fields to indicate which m= 605 section it is associated with, which can be identified in one of two 606 ways, either by a m= section index, or a MID. The m= section index 607 is a zero-based index, with index N referring to the N+1th m= section 608 in the session description referenced by this IceCandidate. The MID 609 is a "media stream identification" value, as defined in [RFC5888], 610 Section 4, which provides a more robust way to identify the m= 611 section in the session description, using the MID of the associated 612 RtpTransceiver object (which may have been locally generated by the 613 answerer when interacting with a non-JSEP endpoint that does not 614 support the MID attribute, as discussed in Section 5.10 below). If 615 the MID field is present in a received IceCandidate, it MUST be used 616 for identification; otherwise, the m= section index is used instead. 618 When creating an IceCandidate object, JSEP implementations MUST 619 populate each of the candidate, ufrag, m= section index, and MID 620 fields. Implementations MUST also be prepared to receive objects 621 with some fields missing, as mentioned above. 623 3.5.3. ICE Candidate Policy 625 Typically, when gathering ICE candidates, the JSEP implementation 626 will gather all possible forms of initial candidates - host, server 627 reflexive, and relay. However, in certain cases, applications may 628 want to have more specific control over the gathering process, due to 629 privacy or related concerns. For example, one may want to only use 630 relay candidates, to leak as little location information as possible 631 (keeping in mind that this choice comes with corresponding 632 operational costs). To accomplish this, JSEP allows the application 633 to restrict which ICE candidates are used in a session. Note that 634 this filtering is applied on top of any restrictions the 635 implementation chooses to enforce regarding which IP addresses are 636 permitted for the application, as discussed in 637 [I-D.ietf-rtcweb-ip-handling]. 639 There may also be cases where the application wants to change which 640 types of candidates are used while the session is active. A prime 641 example is where a callee may initially want to use only relay 642 candidates, to avoid leaking location information to an arbitrary 643 caller, but then change to use all candidates (for lower operational 644 cost) once the user has indicated they want to take the call. For 645 this scenario, the JSEP implementation MUST allow the candidate 646 policy to be changed in mid-session, subject to the aforementioned 647 interactions with local policy. 649 To administer the ICE candidate policy, the JSEP implementation will 650 determine the current setting at the start of each gathering phase. 651 Then, during the gathering phase, the implementation MUST NOT expose 652 candidates disallowed by the current policy to the application, use 653 them as the source of connectivity checks, or indirectly expose them 654 via other fields, such as the raddr/rport attributes for other ICE 655 candidates. Later, if a different policy is specified by the 656 application, the application can apply it by kicking off a new 657 gathering phase via an ICE restart. 659 3.5.4. ICE Candidate Pool 661 JSEP applications typically inform the JSEP implementation to begin 662 ICE gathering via the information supplied to setLocalDescription, as 663 the local description indicates the number of ICE components which 664 will be needed and for which candidates must be gathered. However, 665 to accelerate cases where the application knows the number of ICE 666 components to use ahead of time, it may ask the implementation to 667 gather a pool of potential ICE candidates to help ensure rapid media 668 setup. 670 When setLocalDescription is eventually called, and the JSEP 671 implementation goes to gather the needed ICE candidates, it SHOULD 672 start by checking if any candidates are available in the pool. If 673 there are candidates in the pool, they SHOULD be handed to the 674 application immediately via the ICE candidate event. If the pool 675 becomes depleted, either because a larger-than-expected number of ICE 676 components is used, or because the pool has not had enough time to 677 gather candidates, the remaining candidates are gathered as usual. 678 This only occurs for the first offer/answer exchange, after which the 679 candidate pool is emptied and no longer used. 681 One example of where this concept is useful is an application that 682 expects an incoming call at some point in the future, and wants to 683 minimize the time it takes to establish connectivity, to avoid 684 clipping of initial media. By pre-gathering candidates into the 685 pool, it can exchange and start sending connectivity checks from 686 these candidates almost immediately upon receipt of a call. Note 687 though that by holding on to these pre-gathered candidates, which 688 will be kept alive as long as they may be needed, the application 689 will consume resources on the STUN/TURN servers it is using. 691 3.6. Video Size Negotiation 693 Video size negotiation is the process through which a receiver can 694 use the "a=imageattr" SDP attribute [RFC6236] to indicate what video 695 frame sizes it is capable of receiving. A receiver may have hard 696 limits on what its video decoder can process, or it may have some 697 maximum set by policy. By specifying these limits in an 698 "a=imageattr" attribute, JSEP endpoints can attempt to ensure that 699 the remote sender transmits video at an acceptable resolution. 700 However, when communicating with a non-JSEP endpoint that does not 701 understand this attribute, any signaled limits may be exceeded, and 702 the JSEP implementation MUST handle this gracefully, e.g., by 703 discarding the video. 705 Note that certain codecs support transmission of samples with aspect 706 ratios other than 1.0 (i.e., non-square pixels). JSEP 707 implementations will not transmit non-square pixels, but SHOULD 708 receive and render such video with the correct aspect ratio. 709 However, sample aspect ratio has no impact on the size negotiation 710 described below; all dimensions are measured in pixels, whether 711 square or not. 713 3.6.1. Creating an imageattr Attribute 715 The receiver will first intersect any known local limits (e.g., 716 hardware decoder capababilities, local policy) to determine the 717 absolute minimum and maximum sizes it can receive. If there are no 718 known local limits, the "a=imageattr" attribute SHOULD be omitted. 719 If these local limits preclude receiving any video, i.e., the 720 degenerate case of no permitted resolutions, the "a=imageattr" 721 attribute MUST be omitted, and the m= section MUST be marked as 722 sendonly/inactive, as appropriate. 724 Otherwise, an "a=imageattr" attribute is created with "recv" 725 direction, and the resulting resolution space formed from the 726 aforementioned intersection is used to specify its minimum and 727 maximum x= and y= values. 729 The rules here express a single set of preferences, and therefore, 730 the "a=imageattr" q= value is not important. It SHOULD be set to 731 1.0. 733 The "a=imageattr" field is payload type specific. When all video 734 codecs supported have the same capabilities, use of a single 735 attribute, with the wildcard payload type (*), is RECOMMENDED. 736 However, when the supported video codecs have different limitations, 737 specific "a=imageattr" attributes MUST be inserted for each payload 738 type. 740 As an example, consider a system with a multiformat video decoder, 741 which is capable of decoding any resolution from 48x48 to 720p, In 742 this case, the implementation would generate this attribute: 744 a=imageattr:* recv [x=[48:1280],y=[48:720],q=1.0] 746 This declaration indicates that the receiver is capable of decoding 747 any image resolution from 48x48 up to 1280x720 pixels. 749 3.6.2. Interpreting imageattr Attributes 751 [RFC6236] defines "a=imageattr" to be an advisory field. This means 752 that it does not absolutely constrain the video formats that the 753 sender can use, but gives an indication of the preferred values. 755 This specification prescribes more specific behavior. When a 756 MediaStreamTrack, which is producing video of a certain resolution 757 (the "track resolution"), is attached to a RtpSender, which is 758 encoding the track video at the same or lower resolution(s) (the 759 "encoder resolutions"), and a remote description is applied that 760 references the sender and contains valid "a=imageattr recv" 761 attributes, it MUST follow the rules below to ensure the sender does 762 not transmit a resolution that would exceed the size criteria 763 specified in the attributes. These rules MUST be followed as long as 764 the attributes remain present in the remote description, including 765 cases in which the track changes its resolution, or is replaced with 766 a different track. 768 Depending on how the RtpSender is configured, it may be producing a 769 single encoding at a certain resolution, or, if simulcast Section 3.7 770 has been negotiated, multiple encodings, each at their own specific 771 resolution. In addition, depending on the configuration, each 772 encoding may have the flexibility to reduce resolution when needed, 773 or may be locked to a specific output resolution. 775 For each encoding being produced by the RtpSender, the set of 776 "a=imageattr recv" attributes in the corresponding m= section of the 777 remote description is processed to determine what should be 778 transmitted. Only attributes that reference the media format 779 selected for the encoding are considered; each such attribute is 780 evaluated individually, starting with the attribute with the highest 781 "q=" value. If multiple attributes have the same "q=" value, they 782 are evaluated in the order they appear in their containing m= 783 section. Note that while JSEP endpoints will include at most one 784 "a=imageattr recv" attribute per media format, JSEP endpoints may 785 receive session descriptions from non-JSEP endpoints with m= sections 786 that contain multiple such attributes. 788 For each "a=imageattr recv" attribute, the following rules are 789 applied. If this processing is successful, the encoding is 790 transmitted accordingly, and no further attributes are considered for 791 that encoding. Otherwise, the next attribute is evaluated, in the 792 aforementioned order. If none of the supplied attributes can be 793 processed successfully, the encoding MUST NOT be transmitted, and an 794 error SHOULD be raised to the application. 796 o The limits from the attribute are compared to the encoder 797 resolution. Only the specific limits mentioned below are 798 considered; any other values, such as picture aspect ratio, MUST 799 be ignored. When considering a MediaStreamTrack that is producing 800 rotated video, the unrotated resolution MUST be used for the 801 checks. This is required regardless of whether the receiver 802 supports performing receive-side rotation (e.g., through CVO 803 [TS26.114]), as it significantly simplifies the matching logic. 805 o If the attribute includes a "sar=" (sample aspect ratio) value set 806 to something other than "1.0", indicating the receiver wants to 807 receive non-square pixels, this cannot be satisfied and the 808 attribute MUST NOT be used. 810 o If the encoder resolution exceeds the maximum size permitted by 811 the attribute, and the encoder is allowed to adjust its 812 resolution, the encoder SHOULD apply downscaling in order to 813 satisfy the limits, although the downscaling MUST NOT change the 814 picture aspect ratio of the encoding. For example, if the encoder 815 resolution is 1280x720, and the attribute specified a maximum of 816 640x480, the expected output resolution would be 640x360. If 817 downscaling cannot be applied, the attribute MUST NOT be used. 819 o If the encoder resolution is less than the minimum size permitted 820 by the attribute, the attribute MUST NOT be used; the encoder MUST 821 NOT apply upscaling. JSEP implementations SHOULD avoid this 822 situation by allowing receipt of arbitrarily small resolutions, 823 perhaps via fallback to a software decoder. 825 o If the encoder resolution is within the maximum and minimum sizes, 826 no action is needed. 828 3.7. Simulcast 830 JSEP supports simulcast transmission of a MediaStreamTrack, where 831 multiple encodings of the source media can be transmitted within the 832 context of a single m= section. The current JSEP API is designed to 833 allow applications to send simulcasted media but only to receive a 834 single encoding. This allows for multi-user scenarios where each 835 sending client sends multiple encodings to a server, which then, for 836 each receiving client, chooses the appropriate encoding to forward. 838 Applications request support for simulcast by configuring multiple 839 encodings on an RtpSender. Upon generation of an offer or answer, 840 these encodings are indicated via SDP markings on the corresponding 841 m= section, as described below. Receivers that understand simulcast 842 and are willing to receive it will also include SDP markings to 843 indicate their support, and JSEP endpoints will use these markings to 844 determine whether simulcast is permitted for a given RtpSender. If 845 simulcast support is not negotiated, the RtpSender will only use the 846 first configured encoding. 848 Note that the exact simulcast parameters are up to the sending 849 application. While the aforementioned SDP markings are provided to 850 ensure the remote side can receive and demux multiple simulcast 851 encodings, the specific resolutions and bitrates to be used for each 852 encoding are purely a send-side decision in JSEP. 854 JSEP currently does not provide a mechanism to configure receipt of 855 simulcast. This means that if simulcast is offered by the remote 856 endpoint, the answer generated by a JSEP endpoint will not indicate 857 support for receipt of simulcast, and as such the remote endpoint 858 will only send a single encoding per m= section. 860 In addition, JSEP does not provide a mechanism to handle an incoming 861 offer requesting simulcast from the JSEP endpoint. This means that 862 setting up simulcast in the case where the JSEP endpoint receives the 863 initial offer requires out-of-band signaling or SDP inspection. 864 However, in the case where the JSEP endpoint sets up simulcast in its 865 in initial offer, any established simulcast streams will continue to 866 work upon receipt of an incoming re-offer. Future versions of this 867 specification may add additional APIs to handle the incoming initial 868 offer scenario. 870 When using JSEP to transmit multiple encodings from a RtpSender, the 871 techniques from [I-D.ietf-mmusic-sdp-simulcast] and 872 [I-D.ietf-mmusic-rid] are used. Specifically, when multiple 873 encodings have been configured for a RtpSender, the m= section for 874 the RtpSender will include an "a=simulcast" attribute, as defined in 875 [I-D.ietf-mmusic-sdp-simulcast], Section 6.2, with a "send" simulcast 876 stream description that lists each desired encoding, and no "recv" 877 simulcast stream description. The m= section will also include an 878 "a=rid" attribute for each encoding, as specified in 879 [I-D.ietf-mmusic-rid], Section 4; the use of RID identifiers allows 880 the individual encodings to be disambiguated even though they are all 881 part of the same m= section. 883 3.8. Interactions With Forking 885 Some call signaling systems allow various types of forking where an 886 SDP Offer may be provided to more than one device. For example, SIP 887 [RFC3261] defines both a "Parallel Search" and "Sequential Search". 888 Although these are primarily signaling level issues that are outside 889 the scope of JSEP, they do have some impact on the configuration of 890 the media plane that is relevant. When forking happens at the 891 signaling layer, the JavaScript application responsible for the 892 signaling needs to make the decisions about what media should be sent 893 or received at any point of time, as well as which remote endpoint it 894 should communicate with; JSEP is used to make sure the media engine 895 can make the RTP and media perform as required by the application. 896 The basic operations that the applications can have the media engine 897 do are: 899 o Start exchanging media with a given remote peer, but keep all the 900 resources reserved in the offer. 902 o Start exchanging media with a given remote peer, and free any 903 resources in the offer that are not being used. 905 3.8.1. Sequential Forking 907 Sequential forking involves a call being dispatched to multiple 908 remote callees, where each callee can accept the call, but only one 909 active session ever exists at a time; no mixing of received media is 910 performed. 912 JSEP handles sequential forking well, allowing the application to 913 easily control the policy for selecting the desired remote endpoint. 914 When an answer arrives from one of the callees, the application can 915 choose to apply it either as a provisional answer, leaving open the 916 possibility of using a different answer in the future, or apply it as 917 a final answer, ending the setup flow. 919 In a "first-one-wins" situation, the first answer will be applied as 920 a final answer, and the application will reject any subsequent 921 answers. In SIP parlance, this would be ACK + BYE. 923 In a "last-one-wins" situation, all answers would be applied as 924 provisional answers, and any previous call leg will be terminated. 925 At some point, the application will end the setup process, perhaps 926 with a timer; at this point, the application could reapply the 927 pending remote description as a final answer. 929 3.8.2. Parallel Forking 931 Parallel forking involves a call being dispatched to multiple remote 932 callees, where each callee can accept the call, and multiple 933 simultaneous active signaling sessions can be established as a 934 result. If multiple callees send media at the same time, the 935 possibilities for handling this are described in [RFC3960], 936 Section 3.1. Most SIP devices today only support exchanging media 937 with a single device at a time, and do not try to mix multiple early 938 media audio sources, as that could result in a confusing situation. 939 For example, consider having a European ringback tone mixed together 940 with the North American ringback tone - the resulting sound would not 941 be like either tone, and would confuse the user. If the signaling 942 application wishes to only exchange media with one of the remote 943 endpoints at a time, then from a media engine point of view, this is 944 exactly like the sequential forking case. 946 In the parallel forking case where the JavaScript application wishes 947 to simultaneously exchange media with multiple peers, the flow is 948 slightly more complex, but the JavaScript application can follow the 949 strategy that [RFC3960] describes using UPDATE. The UPDATE approach 950 allows the signaling to set up a separate media flow for each peer 951 that it wishes to exchange media with. In JSEP, this offer used in 952 the UPDATE would be formed by simply creating a new PeerConnection 953 (see Section 4.1) and making sure that the same local media streams 954 have been added into this new PeerConnection. Then the new 955 PeerConnection object would produce a SDP offer that could be used by 956 the signaling to perform the UPDATE strategy discussed in [RFC3960]. 958 As a result of sharing the media streams, the application will end up 959 with N parallel PeerConnection sessions, each with a local and remote 960 description and their own local and remote addresses. The media flow 961 from these sessions can be managed using setDirection (see 962 Section 4.2.3), or the application can choose to play out the media 963 from all sessions mixed together. Of course, if the application 964 wants to only keep a single session, it can simply terminate the 965 sessions that it no longer needs. 967 4. Interface 969 This section details the basic operations that must be present to 970 implement JSEP functionality. The actual API exposed in the W3C API 971 may have somewhat different syntax, but should map easily to these 972 concepts. 974 4.1. PeerConnection 976 4.1.1. Constructor 978 The PeerConnection constructor allows the application to specify 979 global parameters for the media session, such as the STUN/TURN 980 servers and credentials to use when gathering candidates, as well as 981 the initial ICE candidate policy and pool size, and also the bundle 982 policy to use. 984 If an ICE candidate policy is specified, it functions as described in 985 Section 3.5.3, causing the JSEP implementation to only surface the 986 permitted candidates (including any implementation-internal 987 filtering) to the application, and only use those candidates for 988 connectivity checks. The set of available policies is as follows: 990 all: All candidates permitted by implementation policy will be 991 gathered and used. 993 relay: All candidates except relay candidates will be filtered out. 994 This obfuscates the location information that might be ascertained 995 by the remote peer from the received candidates. Depending on how 996 the application deploys and chooses relay servers, this could 997 obfuscate location to a metro or possibly even global level. 999 The default ICE candidate policy MUST be set to "all" as this is 1000 generally the desired policy, and also typically reduces use of 1001 application TURN server resources significantly. 1003 If a size is specified for the ICE candidate pool, this indicates the 1004 number of ICE components to pre-gather candidates for. Because pre- 1005 gathering results in utilizing STUN/TURN server resources for 1006 potentially long periods of time, this must only occur upon 1007 application request, and therefore the default candidate pool size 1008 MUST be zero. 1010 The application can specify its preferred policy regarding use of 1011 bundle, the multiplexing mechanism defined in 1012 [I-D.ietf-mmusic-sdp-bundle-negotiation]. Regardless of policy, the 1013 application will always try to negotiate bundle onto a single 1014 transport, and will offer a single bundle group across all m= 1015 sections; use of this single transport is contingent upon the 1016 answerer accepting bundle. However, by specifying a policy from the 1017 list below, the application can control exactly how aggressively it 1018 will try to bundle media streams together, which affects how it will 1019 interoperate with a non-bundle-aware endpoint. When negotiating with 1020 a non-bundle-aware endpoint, only the streams not marked as bundle- 1021 only streams will be established. 1023 The set of available policies is as follows: 1025 balanced: The first m= section of each type (audio, video, or 1026 application) will contain transport parameters, which will allow 1027 an answerer to unbundle that section. The second and any 1028 subsequent m= section of each type will be marked bundle-only. 1029 The result is that if there are N distinct media types, then 1030 candidates will be gathered for for N media streams. This policy 1031 balances desire to multiplex with the need to ensure basic audio 1032 and video can still be negotiated in legacy cases. When acting as 1033 answerer, if there is no bundle group in the offer, the 1034 implementation will reject all but the first m= section of each 1035 type. 1037 max-compat: All m= sections will contain transport parameters; none 1038 will be marked as bundle-only. This policy will allow all streams 1039 to be received by non-bundle-aware endpoints, but require separate 1040 candidates to be gathered for each media stream. 1042 max-bundle: Only the first m= section will contain transport 1043 parameters; all streams other than the first will be marked as 1044 bundle-only. This policy aims to minimize candidate gathering and 1045 maximize multiplexing, at the cost of less compatibility with 1046 legacy endpoints. When acting as answerer, the implementation 1047 will reject any m= sections other than the first m= section, 1048 unless they are in the same bundle group as that m= section. 1050 As it provides the best tradeoff between performance and 1051 compatibility with legacy endpoints, the default bundle policy MUST 1052 be set to "balanced". 1054 The application can specify its preferred policy regarding use of 1055 RTP/RTCP multiplexing [RFC5761] using one of the following policies: 1057 negotiate: The JSEP implementation will gather both RTP and RTCP 1058 candidates but also will offer "a=rtcp-mux", thus allowing for 1059 compatibility with either multiplexing or non-multiplexing 1060 endpoints. 1062 require: The JSEP implementation will only gather RTP candidates and 1063 will insert an "a=rtcp-mux-only" indication into any new m= 1064 sections in offers it generates. This halves the number of 1065 candidates that the offerer needs to gather. Applying a 1066 description with an m= section that does not contain an "a=rtcp- 1067 mux" attribute will cause an error to be returned. 1069 The default multiplexing policy MUST be set to "require". 1070 Implementations MAY choose to reject attempts by the application to 1071 set the multiplexing policy to "negotiate". 1073 4.1.2. addTrack 1075 The addTrack method adds a MediaStreamTrack to the PeerConnection, 1076 using the MediaStream argument to associate the track with other 1077 tracks in the same MediaStream, so that they can be added to the same 1078 "LS" group when creating an offer or answer. Adding tracks to the 1079 same "LS" group indicates that the playback of these tracks should be 1080 synchronized for proper lip sync, as described in [RFC5888], 1081 Section 7. addTrack attempts to minimize the number of transceivers 1082 as follows: If the PeerConnection is in the "have-remote-offer" 1083 state, the track will be attached to the first compatible transceiver 1084 that was created by the most recent call to setRemoteDescription() 1085 and does not have a local track. Otherwise, a new transceiver will 1086 be created, as described in Section 4.1.4. 1088 4.1.3. removeTrack 1090 The removeTrack method removes a MediaStreamTrack from the 1091 PeerConnection, using the RtpSender argument to indicate which sender 1092 should have its track removed. The sender's track is cleared, and 1093 the sender stops sending. Future calls to createOffer will mark the 1094 m= section associated with the sender as recvonly (if 1095 transceiver.direction is sendrecv) or as inactive (if 1096 transceiver.direction is sendonly). 1098 4.1.4. addTransceiver 1100 The addTransceiver method adds a new RtpTransceiver to the 1101 PeerConnection. If a MediaStreamTrack argument is provided, then the 1102 transceiver will be configured with that media type and the track 1103 will be attached to the transceiver. Otherwise, the application MUST 1104 explicitly specify the type; this mode is useful for creating 1105 recvonly transceivers as well as for creating transceivers to which a 1106 track can be attached at some later point. 1108 At the time of creation, the application can also specify a 1109 transceiver direction attribute, a set of MediaStreams which the 1110 transceiver is associated with (allowing LS group assignments), and a 1111 set of encodings for the media (used for simulcast as described in 1112 Section 3.7). 1114 4.1.5. createDataChannel 1116 The createDataChannel method creates a new data channel and attaches 1117 it to the PeerConnection. If no data channel currently exists for 1118 this PeerConnection, then a new offer/answer exchange is required. 1119 All data channels on a given PeerConnection share the same SCTP/DTLS 1120 association and therefore the same m= section, so subsequent creation 1121 of data channels does not have any impact on the JSEP state. 1123 The createDataChannel method also includes a number of arguments 1124 which are used by the PeerConnection (e.g., maxPacketLifetime) but 1125 are not reflected in the SDP and do not affect the JSEP state. 1127 4.1.6. createOffer 1129 The createOffer method generates a blob of SDP that contains a 1130 [RFC3264] offer with the supported configurations for the session, 1131 including descriptions of the media added to this PeerConnection, the 1132 codec/RTP/RTCP options supported by this implementation, and any 1133 candidates that have been gathered by the ICE agent. An options 1134 parameter may be supplied to provide additional control over the 1135 generated offer. This options parameter allows an application to 1136 trigger an ICE restart, for the purpose of reestablishing 1137 connectivity. 1139 In the initial offer, the generated SDP will contain all desired 1140 functionality for the session (functionality that is supported but 1141 not desired by default may be omitted); for each SDP line, the 1142 generation of the SDP will follow the process defined for generating 1143 an initial offer from the document that specifies the given SDP line. 1144 The exact handling of initial offer generation is detailed in 1145 Section 5.2.1 below. 1147 In the event createOffer is called after the session is established, 1148 createOffer will generate an offer to modify the current session 1149 based on any changes that have been made to the session, e.g., adding 1150 or stopping RtpTransceivers, or requesting an ICE restart. For each 1151 existing stream, the generation of each SDP line must follow the 1152 process defined for generating an updated offer from the RFC that 1153 specifies the given SDP line. For each new stream, the generation of 1154 the SDP must follow the process of generating an initial offer, as 1155 mentioned above. If no changes have been made, or for SDP lines that 1156 are unaffected by the requested changes, the offer will only contain 1157 the parameters negotiated by the last offer-answer exchange. The 1158 exact handling of subsequent offer generation is detailed in 1159 Section 5.2.2. below. 1161 Session descriptions generated by createOffer must be immediately 1162 usable by setLocalDescription; if a system has limited resources 1163 (e.g. a finite number of decoders), createOffer should return an 1164 offer that reflects the current state of the system, so that 1165 setLocalDescription will succeed when it attempts to acquire those 1166 resources. 1168 Calling this method may do things such as generating new ICE 1169 credentials, but does not change the PeerConnection state, trigger 1170 candidate gathering, or cause media to start or stop flowing. 1171 Specifically, the offer is not applied, and does not become the 1172 pending local description, until setLocalDescription is called. 1174 4.1.7. createAnswer 1176 The createAnswer method generates a blob of SDP that contains a 1177 [RFC3264] SDP answer with the supported configuration for the session 1178 that is compatible with the parameters supplied in the most recent 1179 call to setRemoteDescription, which MUST have been called prior to 1180 calling createAnswer. Like createOffer, the returned blob contains 1181 descriptions of the media added to this PeerConnection, the 1182 codec/RTP/RTCP options negotiated for this session, and any 1183 candidates that have been gathered by the ICE agent. An options 1184 parameter may be supplied to provide additional control over the 1185 generated answer. 1187 As an answer, the generated SDP will contain a specific configuration 1188 that specifies how the media plane should be established; for each 1189 SDP line, the generation of the SDP must follow the process defined 1190 for generating an answer from the document that specifies the given 1191 SDP line. The exact handling of answer generation is detailed in 1192 Section 5.3. below. 1194 Session descriptions generated by createAnswer must be immediately 1195 usable by setLocalDescription; like createOffer, the returned 1196 description should reflect the current state of the system. 1198 Calling this method may do things such as generating new ICE 1199 credentials, but does not change the PeerConnection state, trigger 1200 candidate gathering, or or cause a media state change. Specifically, 1201 the answer is not applied, and does not become the current local 1202 description, until setLocalDescription is called. 1204 4.1.8. SessionDescriptionType 1206 Session description objects (RTCSessionDescription) may be of type 1207 "offer", "pranswer", "answer" or "rollback". These types provide 1208 information as to how the description parameter should be parsed, and 1209 how the media state should be changed. 1211 "offer" indicates that a description should be parsed as an offer; 1212 said description may include many possible media configurations. A 1213 description used as an "offer" may be applied anytime the 1214 PeerConnection is in a stable state, or as an update to a previously 1215 supplied but unanswered "offer". 1217 "pranswer" indicates that a description should be parsed as an 1218 answer, but not a final answer, and so should not result in the 1219 freeing of allocated resources. It may result in the start of media 1220 transmission, if the answer does not specify an inactive media 1221 direction. A description used as a "pranswer" may be applied as a 1222 response to an "offer", or an update to a previously sent "pranswer". 1224 "answer" indicates that a description should be parsed as an answer, 1225 the offer-answer exchange should be considered complete, and any 1226 resources (decoders, candidates) that are no longer needed can be 1227 released. A description used as an "answer" may be applied as a 1228 response to an "offer", or an update to a previously sent "pranswer". 1230 The only difference between a provisional and final answer is that 1231 the final answer results in the freeing of any unused resources that 1232 were allocated as a result of the offer. As such, the application 1233 can use some discretion on whether an answer should be applied as 1234 provisional or final, and can change the type of the session 1235 description as needed. For example, in a serial forking scenario, an 1236 application may receive multiple "final" answers, one from each 1237 remote endpoint. The application could choose to accept the initial 1238 answers as provisional answers, and only apply an answer as final 1239 when it receives one that meets its criteria (e.g. a live user 1240 instead of voicemail). 1242 "rollback" is a special session description type implying that the 1243 state machine should be rolled back to the previous stable state, as 1244 described in Section 4.1.8.2. The contents MUST be empty. 1246 4.1.8.1. Use of Provisional Answers 1248 Most applications will not need to create answers using the 1249 "pranswer" type. While it is good practice to send an immediate 1250 response to an offer, in order to warm up the session transport and 1251 prevent media clipping, the preferred handling for a JSEP application 1252 is to create and send a "sendonly" final answer with a null 1253 MediaStreamTrack immediately after receiving the offer, which will 1254 prevent media from being sent by the caller, and allow media to be 1255 sent immediately upon answer by the callee. Later, when the callee 1256 actually accepts the call, the application can plug in the real 1257 MediaStreamTrack and create a new "sendrecv" offer to update the 1258 previous offer/answer pair and start bidirectional media flow. While 1259 this could also be done with a "sendonly" pranswer, followed by a 1260 "sendrecv" answer, the initial pranswer leaves the offer-answer 1261 exchange open, which means that the caller cannot send an updated 1262 offer during this time. 1264 As an example, consider a typical JSEP application that wants to set 1265 up audio and video as quickly as possible. When the callee receives 1266 an offer with audio and video MediaStreamTracks, it will send an 1267 immediate answer accepting these tracks as sendonly (meaning that the 1268 caller will not send the callee any media yet, and because the callee 1269 has not yet added its own MediaStreamTracks, the callee will not send 1270 any media either). It will then ask the user to accept the call and 1271 acquire the needed local tracks. Upon acceptance by the user, the 1272 application will plug in the tracks it has acquired, which, because 1273 ICE and DTLS handshaking have likely completed by this point, can 1274 start transmitting immediately. The application will also send a new 1275 offer to the remote side indicating call acceptance and moving the 1276 audio and video to be two-way media. A detailed example flow along 1277 these lines is shown in Section 7.3. 1279 Of course, some applications may not be able to perform this double 1280 offer-answer exchange, particularly ones that are attempting to 1281 gateway to legacy signaling protocols. In these cases, pranswer can 1282 still provide the application with a mechanism to warm up the 1283 transport. 1285 4.1.8.2. Rollback 1287 In certain situations it may be desirable to "undo" a change made to 1288 setLocalDescription or setRemoteDescription. Consider a case where a 1289 call is ongoing, and one side wants to change some of the session 1290 parameters; that side generates an updated offer and then calls 1291 setLocalDescription. However, the remote side, either before or 1292 after setRemoteDescription, decides it does not want to accept the 1293 new parameters, and sends a reject message back to the offerer. Now, 1294 the offerer, and possibly the answerer as well, need to return to a 1295 stable state and the previous local/remote description. To support 1296 this, we introduce the concept of "rollback", which discards any 1297 proposed changes to the session, returning the state machine to the 1298 stable state. A rollback is performed by supplying a session 1299 description of type "rollback" with empty contents to either 1300 setLocalDescription or setRemoteDescription. 1302 4.1.9. setLocalDescription 1304 The setLocalDescription method instructs the PeerConnection to apply 1305 the supplied session description as its local configuration. The 1306 type field indicates whether the description should be processed as 1307 an offer, provisional answer, final answer, or rollback; offers and 1308 answers are checked differently, using the various rules that exist 1309 for each SDP line. 1311 This API changes the local media state; among other things, it sets 1312 up local resources for receiving and decoding media. In order to 1313 successfully handle scenarios where the application wants to offer to 1314 change from one media format to a different, incompatible format, the 1315 PeerConnection must be able to simultaneously support use of both the 1316 current and pending local descriptions (e.g., support the codecs that 1317 exist in either description). This dual processing begins when the 1318 PeerConnection enters the "have-local-offer" state, and continues 1319 until setRemoteDescription is called with either a final answer, at 1320 which point the PeerConnection can fully adopt the pending local 1321 description, or a rollback, which results in a revert to the current 1322 local description. 1324 This API indirectly controls the candidate gathering process. When a 1325 local description is supplied, and the number of transports currently 1326 in use does not match the number of transports needed by the local 1327 description, the PeerConnection will create transports as needed and 1328 begin gathering candidates for each transport, using ones from the 1329 candidate pool if available. 1331 If setRemoteDescription was previously called with an offer, and 1332 setLocalDescription is called with an answer (provisional or final), 1333 and the media directions are compatible, and media is available to 1334 send, this will result in the starting of media transmission. 1336 4.1.10. setRemoteDescription 1338 The setRemoteDescription method instructs the PeerConnection to apply 1339 the supplied session description as the desired remote configuration. 1340 As in setLocalDescription, the type field of the description 1341 indicates how it should be processed. 1343 This API changes the local media state; among other things, it sets 1344 up local resources for sending and encoding media. 1346 If setLocalDescription was previously called with an offer, and 1347 setRemoteDescription is called with an answer (provisional or final), 1348 and the media directions are compatible, and media is available to 1349 send, this will result in the starting of media transmission. 1351 4.1.11. currentLocalDescription 1353 The currentLocalDescription method returns the current negotiated 1354 local description - i.e., the local description from the last 1355 successful offer/answer exchange - in addition to any local 1356 candidates that have been generated by the ICE agent since the local 1357 description was set. 1359 A null object will be returned if an offer/answer exchange has not 1360 yet been completed. 1362 4.1.12. pendingLocalDescription 1364 The pendingLocalDescription method returns a copy of the local 1365 description currently in negotiation - i.e., a local offer set 1366 without any corresponding remote answer - in addition to any local 1367 candidates that have been generated by the ICE agent since the local 1368 description was set. 1370 A null object will be returned if the state of the PeerConnection is 1371 "stable" or "have-remote-offer". 1373 4.1.13. currentRemoteDescription 1375 The currentRemoteDescription method returns a copy of the current 1376 negotiated remote description - i.e., the remote description from the 1377 last successful offer/answer exchange - in addition to any remote 1378 candidates that have been supplied via processIceMessage since the 1379 remote description was set. 1381 A null object will be returned if an offer/answer exchange has not 1382 yet been completed. 1384 4.1.14. pendingRemoteDescription 1386 The pendingRemoteDescription method returns a copy of the remote 1387 description currently in negotiation - i.e., a remote offer set 1388 without any corresponding local answer - in addition to any remote 1389 candidates that have been supplied via processIceMessage since the 1390 remote description was set. 1392 A null object will be returned if the state of the PeerConnection is 1393 "stable" or "have-local-offer". 1395 4.1.15. canTrickleIceCandidates 1397 The canTrickleIceCandidates property indicates whether the remote 1398 side supports receiving trickled candidates. There are three 1399 potential values: 1401 null: No SDP has been received from the other side, so it is not 1402 known if it can handle trickle. This is the initial value before 1403 setRemoteDescription() is called. 1405 true: SDP has been received from the other side indicating that it 1406 can support trickle. 1408 false: SDP has been received from the other side indicating that it 1409 cannot support trickle. 1411 As described in Section 3.5.2, JSEP implementations always provide 1412 candidates to the application individually, consistent with what is 1413 needed for Trickle ICE. However, applications can use the 1414 canTrickleIceCandidates property to determine whether their peer can 1415 actually do Trickle ICE, i.e., whether it is safe to send an initial 1416 offer or answer followed later by candidates as they are gathered. 1417 As "true" is the only value that definitively indicates remote 1418 Trickle ICE support, an application which compares 1419 canTrickleIceCandidates against "true" will by default attempt Half 1420 Trickle on initial offers and Full Trickle on subsequent interactions 1421 with a Trickle ICE-compatible agent. 1423 4.1.16. setConfiguration 1425 The setConfiguration method allows the global configuration of the 1426 PeerConnection, which was initially set by constructor parameters, to 1427 be changed during the session. The effects of this method call 1428 depend on when it is invoked, and differ depending on which specific 1429 parameters are changed: 1431 o Any changes to the STUN/TURN servers to use affect the next 1432 gathering phase. If an ICE gathering phase has already started or 1433 completed, the 'needs-ice-restart' bit mentioned in Section 3.5.1 1434 will be set. This will cause the next call to createOffer to 1435 generate new ICE credentials, for the purpose of forcing an ICE 1436 restart and kicking off a new gathering phase, in which the new 1437 servers will be used. If the ICE candidate pool has a nonzero 1438 size, and a local description has not yet been applied, any 1439 existing candidates will be discarded, and new candidates will be 1440 gathered from the new servers. 1442 o Any change to the ICE candidate policy affects the next gathering 1443 phase. If an ICE gathering phase has already started or 1444 completed, the 'needs-ice-restart' bit will be set. Either way, 1445 changes to the policy have no effect on the candidate pool, 1446 because pooled candidates are not made available to the 1447 application until a gathering phase occurs, and so any necessary 1448 filtering can still be done on any pooled candidates. 1450 o The ICE candidate pool size MUST NOT be changed after applying a 1451 local description. If a local description has not yet been 1452 applied, any changes to the ICE candidate pool size take effect 1453 immediately; if increased, additional candidates are pre-gathered; 1454 if decreased, the now-superfluous candidates are discarded. 1456 o The bundle and RTCP-multiplexing policies MUST NOT be changed 1457 after the construction of the PeerConnection. 1459 This call may result in a change to the state of the ICE Agent. 1461 4.1.17. addIceCandidate 1463 The addIceCandidate method provides an update to the ICE agent via an 1464 IceCandidate object Section 3.5.2.1. If the IceCandidate's candidate 1465 field is filled in, the IceCandidate is treated as a new remote ICE 1466 candidate, which will be added to the current and/or pending remote 1467 description according to the rules defined for Trickle ICE. 1468 Otherwise, the IceCandidate is treated as an end-of-candidates 1469 indication, as defined in [I-D.ietf-ice-trickle]. 1471 In either case, the m= section index, MID, and ufrag fields from the 1472 supplied IceCandidate are used to determine which m= section and ICE 1473 candidate generation the IceCandidate belongs to, as described in 1474 Section 3.5.2.1 above. In the case of an end-of-candidates 1475 indication, the absence of both the m= section index and MID fields 1476 is interpreted to mean that the indication applies to all m= sections 1477 in the specified ICE candidate generation. However, if both fields 1478 are absent for a new remote candidate, this MUST be treated as an 1479 invalid condition, as specified below. 1481 If any IceCandidate fields contain invalid values, or an error occurs 1482 during the processing of the IceCandidate object, the supplied 1483 IceCandidate MUST be ignored and an error MUST be returned. 1485 Otherwise, the new remote candidate or end-of-candidates indication 1486 is supplied to the ICE agent. In the case of a new remote candidate, 1487 connectivity checks will be sent to the new candidate. 1489 4.2. RtpTransceiver 1491 4.2.1. stop 1493 The stop method stops an RtpTransceiver. This will cause future 1494 calls to createOffer to generate a zero port for the associated m= 1495 section. See below for more details. 1497 4.2.2. stopped 1499 The stopped property indicates whether the transceiver has been 1500 stopped, either by a call to stopTransceiver or by applying an answer 1501 that rejects the associated m= section. In either of these cases, it 1502 is set to "true", and otherwise will be set to "false". 1504 A stopped RtpTransceiver does not send any outgoing RTP or RTCP or 1505 process any incoming RTP or RTCP. It cannot be restarted. 1507 4.2.3. setDirection 1509 The setDirection method sets the direction of a transceiver, which 1510 affects the direction property of the associated m= section on future 1511 calls to createOffer and createAnswer. The permitted values for 1512 direction are "recvonly", "sendrecv", "sendonly", and "inactive", 1513 mirroring the identically-named directional attributes defined in 1514 [RFC4566], Section 6. 1516 When creating offers, the transceiver direction is directly reflected 1517 in the output, even for re-offers. When creating answers, the 1518 transceiver direction is intersected with the offered direction, as 1519 explained in Section 5.3 below. 1521 Note that while setDirection sets the direction property of the 1522 transceiver immediately (Section 4.2.4), this property does not 1523 immediately affect whether the transceiver's RtpSender will send or 1524 its RtpReceiver will receive. The direction in effect is represented 1525 by the currentDirection property, which is only updated when an 1526 answer is applied. 1528 4.2.4. direction 1530 The direction property indicates the last value passed into 1531 setDirection. If setDirection has never been called, it is set to 1532 the direction the transceiver was initialized with. 1534 4.2.5. currentDirection 1536 The currentDirection property indicates the last negotiated direction 1537 for the transceiver's associated m= section. More specifically, it 1538 indicates the [RFC3264] directional attribute of the associated m= 1539 section in the last applied answer (including provisional answers), 1540 with "send" and "recv" directions reversed if it was a remote answer. 1541 For example, if the directional attribute for the associated m= 1542 section in a remote answer is "recvonly", currentDirection is set to 1543 "sendonly". 1545 If an answer that references this transceiver has not yet been 1546 applied, or if the transceiver is stopped, currentDirection is set to 1547 null. 1549 4.2.6. setCodecPreferences 1551 The setCodecPreferences method sets the codec preferences of a 1552 transceiver, which in turn affect the presence and order of codecs of 1553 the associated m= section on future calls to createOffer and 1554 createAnswer. Note that setCodecPreferences does not directly affect 1555 which codec the implementation decides to send. It only affects 1556 which codecs the implementation indicates that it prefers to receive, 1557 via the offer or answer. Even when a codec is excluded by 1558 setCodecPreferences, it still may be used to send until the next 1559 offer/answer exchange discards it. 1561 The codec preferences of an RtpTransceiver can cause codecs to be 1562 excluded by subsequent calls to createOffer and createAnswer, in 1563 which case the corresponding media formats in the associated m= 1564 section will be excluded. The codec preferences cannot add media 1565 formats that would otherwise not be present. 1567 The codec preferences of an RtpTransceiver can also determine the 1568 order of codecs in subsequent calls to createOffer and createAnswer, 1569 in which case the order of the media formats in the associated m= 1570 section will follow the specified preferences. 1572 5. SDP Interaction Procedures 1574 This section describes the specific procedures to be followed when 1575 creating and parsing SDP objects. 1577 5.1. Requirements Overview 1579 JSEP implementations must comply with the specifications listed below 1580 that govern the creation and processing of offers and answers. 1582 5.1.1. Usage Requirements 1584 All session descriptions handled by JSEP implementations, both local 1585 and remote, MUST indicate support for the following specifications. 1586 If any of these are absent, this omission MUST be treated as an 1587 error. 1589 o ICE, as specified in [RFC5245], MUST be used. Note that the 1590 remote endpoint may use a Lite implementation; implementations 1591 MUST properly handle remote endpoints which do ICE-Lite. 1593 o DTLS [RFC6347] or DTLS-SRTP [RFC5763], MUST be used, as 1594 appropriate for the media type, as specified in 1595 [I-D.ietf-rtcweb-security-arch] 1597 The SDES SRTP keying mechanism from [RFC4568] MUST NOT be used, as 1598 discussed in [I-D.ietf-rtcweb-security-arch]. 1600 5.1.2. Profile Names and Interoperability 1602 For media m= sections, JSEP implementations MUST support the 1603 "UDP/TLS/RTP/SAVPF" profile specified in [RFC5764], and MUST indicate 1604 this profile for each media m= line they produce in an offer. For 1605 data m= sections, implementations MUST support the "UDP/DTLS/SCTP" 1606 profile and MUST indicate this profile for each data m= line they 1607 produce in an offer. Although these profiles are formally associated 1608 with UDP, ICE can select either UDP [RFC5245] or TCP [RFC6544] 1609 transport depending on network conditions, even when advertising a 1610 UDP profile. 1612 Unfortunately, in an attempt at compatibility, some endpoints 1613 generate other profile strings even when they mean to support one of 1614 these profiles. For instance, an endpoint might generate "RTP/AVP" 1615 but supply "a=fingerprint" and "a=rtcp-fb" attributes, indicating its 1616 willingness to support "UDP/TLS/RTP/SAVPF" or "TCP/TLS/RTP/SAVPF". 1617 In order to simplify compatibility with such endpoints, JSEP 1618 implementations MUST follow the following rules when processing the 1619 media m= sections in a received offer: 1621 o Any profile in the offer matching one of the following MUST be 1622 accepted: 1624 * "RTP/AVP" (Defined in [RFC4566], Section 8.2.2) 1626 * "RTP/AVPF" (Defined in [RFC4585], Section 9) 1628 * "RTP/SAVP" (Defined in [RFC3711], Section 12) 1629 * "RTP/SAVPF" (Defined in [RFC5124], Section 6) 1631 * "TCP/DTLS/RTP/SAVP" (Defined in [RFC7850], Section 3.4) 1633 * "TCP/DTLS/RTP/SAVPF" (Defined in [RFC7850], Section 3.5) 1635 * "UDP/TLS/RTP/SAVP" (Defined in [RFC5764], Section 9) 1637 * "UDP/TLS/RTP/SAVPF" (Defined in [RFC5764], Section 9) 1639 o The profile in any "m=" line in any generated answer MUST exactly 1640 match the profile provided in the offer. 1642 o Because DTLS-SRTP is REQUIRED, the choice of SAVP or AVP has no 1643 effect; support for DTLS-SRTP is determined by the presence of one 1644 or more "a=fingerprint" attribute. Note that lack of an 1645 "a=fingerprint" attribute will lead to negotiation failure. 1647 o The use of AVPF or AVP simply controls the timing rules used for 1648 RTCP feedback. If AVPF is provided, or an "a=rtcp-fb" attribute 1649 is present, assume AVPF timing, i.e., a default value of "trr- 1650 int=0". Otherwise, assume that AVPF is being used in an AVP 1651 compatible mode and use a value of "trr-int=4000". 1653 o For data m= sections, implementations MUST support receiving the 1654 "UDP/DTLS/SCTP", "TCP/DTLS/SCTP", or "DTLS/SCTP" (for backwards 1655 compatibility) profiles. 1657 Note that re-offers by JSEP implementations MUST use the correct 1658 profile strings even if the initial offer/answer exchange used an 1659 (incorrect) older profile string. This simplifies JSEP behavior, 1660 with minimal downside, as any remote endpoint that fails to handle 1661 such a re-offer will also fail to handle a JSEP endpoint's initial 1662 offer. 1664 5.2. Constructing an Offer 1666 When createOffer is called, a new SDP description must be created 1667 that includes the functionality specified in 1668 [I-D.ietf-rtcweb-rtp-usage]. The exact details of this process are 1669 explained below. 1671 5.2.1. Initial Offers 1673 When createOffer is called for the first time, the result is known as 1674 the initial offer. 1676 The first step in generating an initial offer is to generate session- 1677 level attributes, as specified in [RFC4566], Section 5. 1678 Specifically: 1680 o The first SDP line MUST be "v=0", as specified in [RFC4566], 1681 Section 5.1 1683 o The second SDP line MUST be an "o=" line, as specified in 1684 [RFC4566], Section 5.2. The value of the field SHOULD 1685 be "-". The sess-id MUST be representable by a 64-bit signed 1686 integer, and the initial value MUST be less than (2**62)-1, as 1687 required by [RFC3264]. It is RECOMMENDED that the sess-id be 1688 constructed by generating a 64-bit quantity with the two highest 1689 bits being set to zero and the remaining 62 bits being 1690 cryptographically random. The value of the 1691 tuple SHOULD be set to a non-meaningful address, 1692 such as IN IP4 0.0.0.0, to prevent leaking the local address in 1693 this field. As mentioned in [RFC4566], the entire o= line needs 1694 to be unique, but selecting a random number for is 1695 sufficient to accomplish this. 1697 o The third SDP line MUST be a "s=" line, as specified in [RFC4566], 1698 Section 5.3; to match the "o=" line, a single dash SHOULD be used 1699 as the session name, e.g. "s=-". Note that this differs from the 1700 advice in [RFC4566] which proposes a single space, but as both 1701 "o=" and "s=" are meaningless in JSEP, having the same meaningless 1702 value seems clearer. 1704 o Session Information ("i="), URI ("u="), Email Address ("e="), 1705 Phone Number ("p="), Repeat Times ("r="), and Time Zones ("z=") 1706 lines are not useful in this context and SHOULD NOT be included. 1708 o Encryption Keys ("k=") lines do not provide sufficient security 1709 and MUST NOT be included. 1711 o A "t=" line MUST be added, as specified in [RFC4566], Section 5.9; 1712 both and SHOULD be set to zero, e.g. "t=0 1713 0". 1715 o An "a=ice-options" line with the "trickle" option MUST be added, 1716 as specified in [I-D.ietf-ice-trickle], Section 4. 1718 o If WebRTC identity is being used, an "a=identity" line as 1719 described in [I-D.ietf-rtcweb-security-arch], Section 5. 1721 The next step is to generate m= sections, as specified in [RFC4566], 1722 Section 5.14. An m= section is generated for each RtpTransceiver 1723 that has been added to the PeerConnection, excluding any stopped 1724 RtpTransceivers; this is done in the order the RtpTransceivers were 1725 added to the PeerConnection. If there are no such RtpTransceivers, 1726 no m= sections are generated; more can be added later, as discussed 1727 in [RFC3264], Section 5. 1729 For each m= section generated for an RtpTransceiver, establish a 1730 mapping between the transceiver and the index of the generated m= 1731 section. 1733 Each m= section, provided it is not marked as bundle-only, MUST 1734 generate a unique set of ICE credentials and gather its own unique 1735 set of ICE candidates. Bundle-only m= sections MUST NOT contain any 1736 ICE credentials and MUST NOT gather any candidates. 1738 For DTLS, all m= sections MUST use all the certificate(s) that have 1739 been specified for the PeerConnection; as a result, they MUST all 1740 have the same [RFC8122] fingerprint value(s), or these value(s) MUST 1741 be session-level attributes. 1743 Each m= section should be generated as specified in [RFC4566], 1744 Section 5.14. For the m= line itself, the following rules MUST be 1745 followed: 1747 o If the m= section is marked as bundle-only, then the port value 1748 MUST be set to 0. Otherwise, the port value is set to the port of 1749 the default ICE candidate for this m= section, but given that no 1750 candidates are available yet, the "dummy" port value of 9 1751 (Discard) MUST be used, as indicated in [I-D.ietf-ice-trickle], 1752 Section 5.1. 1754 o To properly indicate use of DTLS, the field MUST be set to 1755 "UDP/TLS/RTP/SAVPF", as specified in [RFC5764], Section 8. 1757 o If codec preferences have been set for the associated transceiver, 1758 media formats MUST be generated in the corresponding order, and 1759 MUST exclude any codecs not present in the codec preferences. 1761 o Unless excluded by the above restrictions, the media formats MUST 1762 include the mandatory audio/video codecs as specified in 1763 [RFC7874], Section 3, and [RFC7742], Section 5. 1765 The m= line MUST be followed immediately by a "c=" line, as specified 1766 in [RFC4566], Section 5.7. Again, as no candidates are available 1767 yet, the "c=" line must contain the "dummy" value "IN IP4 0.0.0.0", 1768 as defined in [I-D.ietf-ice-trickle], Section 5.1. 1770 [I-D.ietf-mmusic-sdp-mux-attributes] groups SDP attributes into 1771 different categories. To avoid unnecessary duplication when 1772 bundling, attributes of category IDENTICAL or TRANSPORT MUST NOT be 1773 repeated in bundled m= sections, repeating the guidance from 1774 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 8.1. This includes 1775 m= sections for which bundling has been negotiated and is still 1776 desired, as well as m= sections marked as bundle-only. 1778 The following attributes, which are of a category other than 1779 IDENTICAL or TRANSPORT, MUST be included in each m= section: 1781 o An "a=mid" line, as specified in [RFC5888], Section 4. All MID 1782 values MUST be generated in a fashion that does not leak user 1783 information, e.g., randomly or using a per-PeerConnection counter, 1784 and SHOULD be 3 bytes or less, to allow them to efficiently fit 1785 into the RTP header extension defined in 1786 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 14. Note that 1787 this does not set the RtpTransceiver mid property, as that only 1788 occurs when the description is applied. The generated MID value 1789 can be considered a "proposed" MID at this point. 1791 o A direction attribute which is the same as that of the associated 1792 transceiver. 1794 o For each media format on the m= line, "a=rtpmap" and "a=fmtp" 1795 lines, as specified in [RFC4566], Section 6, and [RFC3264], 1796 Section 5.1. 1798 o For each primary codec where RTP retransmission should be used, a 1799 corresponding "a=rtpmap" line indicating "rtx" with the clock rate 1800 of the primary codec and an "a=fmtp" line that references the 1801 payload type of the primary codec, as specified in [RFC4588], 1802 Section 8.1. 1804 o For each supported FEC mechanism, "a=rtpmap" and "a=fmtp" lines, 1805 as specified in [RFC4566], Section 6. The FEC mechanisms that 1806 MUST be supported are specified in [I-D.ietf-rtcweb-fec], 1807 Section 6, and specific usage for each media type is outlined in 1808 Sections 4 and 5. 1810 o If this m= section is for media with configurable durations of 1811 media per packet, e.g., audio, an "a=maxptime" line, indicating 1812 the maximum amount of media, specified in milliseconds, that can 1813 be encapsulated in each packet, as specified in [RFC4566], 1814 Section 6. This value is set to the smallest of the maximum 1815 duration values across all the codecs included in the m= section. 1817 o If this m= section is for video media, and there are known 1818 limitations on the size of images which can be decoded, an 1819 "a=imageattr" line, as specified in Section 3.6. 1821 o For each supported RTP header extension, an "a=extmap" line, as 1822 specified in [RFC5285], Section 5. The list of header extensions 1823 that SHOULD/MUST be supported is specified in 1824 [I-D.ietf-rtcweb-rtp-usage], Section 5.2. Any header extensions 1825 that require encryption MUST be specified as indicated in 1826 [RFC6904], Section 4. 1828 o For each supported RTCP feedback mechanism, an "a=rtcp-fb" line, 1829 as specified in [RFC4585], Section 4.2. The list of RTCP feedback 1830 mechanisms that SHOULD/MUST be supported is specified in 1831 [I-D.ietf-rtcweb-rtp-usage], Section 5.1. 1833 o If the RtpTransceiver has a sendrecv or sendonly direction: 1835 * For each MediaStream that was associated with the transceiver 1836 when it was created via addTrack or addTransceiver, an "a=msid" 1837 line, as specified in [I-D.ietf-mmusic-msid], Section 2. If a 1838 MediaStreamTrack is attached to the transceiver's RtpSender, 1839 the "a=msid" lines MUST use that track's ID. If no 1840 MediaStreamTrack is attached, a valid ID MUST be generated, in 1841 the same way that the implementation generates IDs for local 1842 tracks. 1844 * If no MediaStream is associated with the transceiver, a single 1845 "a=msid" line with the special value "-" in place of the 1846 MediaStream ID, as specified in [I-D.ietf-mmusic-msid], 1847 Section 3. The track ID MUST be selected as described above. 1849 o If the RtpTransceiver has a sendrecv or sendonly direction, and 1850 the application has specified RID values or has specified more 1851 than one encoding in the RtpSenders's parameters, an "a=rid" line 1852 for each encoding specified. The "a=rid" line is specified in 1853 [I-D.ietf-mmusic-rid], and its direction MUST be "send". If the 1854 application has chosen a RID value, it MUST be used as the rid- 1855 identifier; otherwise a RID value MUST be generated by the 1856 implementation. RID values MUST be generated in a fashion that 1857 does not leak user information, e.g., randomly or using a per- 1858 PeerConnection counter, and SHOULD be 3 bytes or less, to allow 1859 them to efficiently fit into the RTP header extension defined in 1860 [I-D.ietf-avtext-rid], Section 3. If no encodings have been 1861 specified, or only one encoding is specified but without a RID 1862 value, then no "a=rid" lines are generated. 1864 o If the RtpTransceiver has a sendrecv or sendonly direction and 1865 more than one "a=rid" line has been generated, an "a=simulcast" 1866 line, with direction "send", as defined in 1867 [I-D.ietf-mmusic-sdp-simulcast], Section 6.2. The list of RIDs 1868 MUST include all of the RID identifiers used in the "a=rid" lines 1869 for this m= section. 1871 o If the bundle policy for this PeerConnection is set to "max- 1872 bundle", and this is not the first m= section, or the bundle 1873 policy is set to "balanced", and this is not the first m= section 1874 for this media type, an "a=bundle-only" line. 1876 The following attributes, which are of category IDENTICAL or 1877 TRANSPORT, MUST appear only in "m=" sections which either have a 1878 unique address or which are associated with the bundle-tag. (In 1879 initial offers, this means those "m=" sections which do not contain 1880 an "a=bundle-only" attribute.) 1882 o "a=ice-ufrag" and "a=ice-pwd" lines, as specified in [RFC5245], 1883 Section 15.4. 1885 o For each desired digest algorithm, one or more "a=fingerprint" 1886 lines for each of the endpoint's certificates, as specified in 1887 [RFC8122], Section 5. 1889 o An "a=setup" line, as specified in [RFC4145], Section 4, and 1890 clarified for use in DTLS-SRTP scenarios in [RFC5763], Section 5. 1891 The role value in the offer MUST be "actpass". 1893 o An "a=tls-id" line, as specified in [I-D.ietf-mmusic-dtls-sdp], 1894 Section 5.2. 1896 o An "a=rtcp" line, as specified in [RFC3605], Section 2.1, 1897 containing the dummy value "9 IN IP4 0.0.0.0", because no 1898 candidates have yet been gathered. 1900 o An "a=rtcp-mux" line, as specified in [RFC5761], Section 5.1.3. 1902 o If the RTP/RTCP multiplexing policy is "require", an "a=rtcp-mux- 1903 only" line, as specified in [I-D.ietf-mmusic-mux-exclusive], 1904 Section 4. 1906 o An "a=rtcp-rsize" line, as specified in [RFC5506], Section 5. 1908 Lastly, if a data channel has been created, a m= section MUST be 1909 generated for data. The field MUST be set to "application" 1910 and the field MUST be set to "UDP/DTLS/SCTP" 1911 [I-D.ietf-mmusic-sctp-sdp]. The "fmt" value MUST be set to "webrtc- 1912 datachannel" as specified in [I-D.ietf-mmusic-sctp-sdp], Section 4.1. 1914 Within the data m= section, an "a=mid" line MUST be generated and 1915 included as described above, along with an "a=sctp-port" line 1916 referencing the SCTP port number, as defined in 1917 [I-D.ietf-mmusic-sctp-sdp], Section 5.1, and, if appropriate, an 1918 "a=max-message-size" line, as defined in [I-D.ietf-mmusic-sctp-sdp], 1919 Section 6.1. 1921 As discussed above, the following attributes of category IDENTICAL or 1922 TRANSPORT are included only if the data m= section either has a 1923 unique address or is associated with the bundle-tag (e.g., if it is 1924 the only m= section): 1926 o "a=ice-ufrag" 1928 o "a=ice-pwd" 1930 o "a=fingerprint" 1932 o "a=setup" 1934 o "a=tls-id" 1936 Once all m= sections have been generated, a session-level "a=group" 1937 attribute MUST be added as specified in [RFC5888]. This attribute 1938 MUST have semantics "BUNDLE", and MUST include the mid identifiers of 1939 each m= section. The effect of this is that the JSEP implementation 1940 offers all m= sections as one bundle group. However, whether the m= 1941 sections are bundle-only or not depends on the bundle policy. 1943 The next step is to generate session-level lip sync groups as defined 1944 in [RFC5888], Section 7. For each MediaStream referenced by more 1945 than one RtpTransceiver (by passing those MediaStreams as arguments 1946 to the addTrack and addTransceiver methods), a group of type "LS" 1947 MUST be added that contains the mid values for each RtpTransceiver. 1949 Attributes which SDP permits to either be at the session level or the 1950 media level SHOULD generally be at the media level even if they are 1951 identical. This assists development and debugging by making it 1952 easier to understand individual media sections, especially if one of 1953 a set of initially identical attributes is subsequently changed. 1954 However, implementations MAY choose to aggregate attributes at the 1955 session level and JSEP implementations MUST be prepared to receive 1956 attributes in either location. 1958 Attributes other than the ones specified above MAY be included, 1959 except for the following attributes which are specifically 1960 incompatible with the requirements of [I-D.ietf-rtcweb-rtp-usage], 1961 and MUST NOT be included: 1963 o "a=crypto" 1964 o "a=key-mgmt" 1966 o "a=ice-lite" 1968 Note that when bundle is used, any additional attributes that are 1969 added MUST follow the advice in [I-D.ietf-mmusic-sdp-mux-attributes] 1970 on how those attributes interact with bundle. 1972 Note that these requirements are in some cases stricter than those of 1973 SDP. Implementations MUST be prepared to accept compliant SDP even 1974 if it would not conform to the requirements for generating SDP in 1975 this specification. 1977 5.2.2. Subsequent Offers 1979 When createOffer is called a second (or later) time, or is called 1980 after a local description has already been installed, the processing 1981 is somewhat different than for an initial offer. 1983 If the previous offer was not applied using setLocalDescription, 1984 meaning the PeerConnection is still in the "stable" state, the steps 1985 for generating an initial offer should be followed, subject to the 1986 following restriction: 1988 o The fields of the "o=" line MUST stay the same except for the 1989 field, which MUST increment by one on each call 1990 to createOffer if the offer might differ from the output of the 1991 previous call to createOffer; implementations MAY opt to increment 1992 on every call. The value of the generated 1993 is independent of the of the 1994 current local description; in particular, in the case where the 1995 current version is N, an offer is created and applied with version 1996 N+1, and then that offer is rolled back so that the current 1997 version is again N, the next generated offer will still have 1998 version N+2. 2000 Note that if the application creates an offer by reading 2001 currentLocalDescription instead of calling createOffer, the returned 2002 SDP may be different than when setLocalDescription was originally 2003 called, due to the addition of gathered ICE candidates, but the 2004 will not have changed. There are no known 2005 scenarios in which this causes problems, but if this is a concern, 2006 the solution is simply to use createOffer to ensure a unique 2007 . 2009 If the previous offer was applied using setLocalDescription, but a 2010 corresponding answer from the remote side has not yet been applied, 2011 meaning the PeerConnection is still in the "have-local-offer" state, 2012 an offer is generated by following the steps in the "stable" state 2013 above, along with these exceptions: 2015 o The "s=" and "t=" lines MUST stay the same. 2017 o If any RtpTransceiver has been added, and there exists an m= 2018 section with a zero port in the current local description or the 2019 current remote description, that m= section MUST be recycled by 2020 generating an m= section for the added RtpTransceiver as if the m= 2021 section were being added to the session description (including a 2022 new MID value), and placing it at the same index as the m= section 2023 with a zero port. 2025 o If an RtpTransceiver is stopped and is not associated with an m= 2026 section, an m= section MUST NOT be generated for it. This 2027 prevents adding back RtpTransceivers whose m= sections were 2028 recycled and used for a new RtpTransceiver in a previous offer/ 2029 answer exchange, as described above. 2031 o If an RtpTransceiver has been stopped and is associated with an m= 2032 section, and the m= section is not being recycled as described 2033 above, an m= section MUST be generated for it with the port set to 2034 zero and all "a=msid" lines removed. 2036 o For RtpTransceivers that are not stopped, the "a=msid" line(s) 2037 MUST stay the same if they are present in the current description, 2038 regardless of changes to the transceiver's direction or track. If 2039 no "a=msid" line is present in the current description, "a=msid" 2040 line(s) MUST be generated according to the same rules as for an 2041 initial offer. 2043 o Each "m=" and c=" line MUST be filled in with the port, protocol, 2044 and address of the default candidate for the m= section, as 2045 described in [RFC5245], Section 4.3. If ICE checking has already 2046 completed for one or more candidate pairs and a candidate pair is 2047 in active use, then that pair MUST be used, even if ICE has not 2048 yet completed. Note that this differs from the guidance in 2049 [RFC5245], Section 9.1.2.2, which only refers to offers created 2050 when ICE has completed. In each case, if no RTP candidates have 2051 yet been gathered, dummy values MUST be used, as described above. 2053 o Each "a=mid" line MUST stay the same. 2055 o Each "a=ice-ufrag" and "a=ice-pwd" line MUST stay the same, unless 2056 the ICE configuration has changed (either changes to the supported 2057 STUN/TURN servers, or the ICE candidate policy), or the 2058 "IceRestart" option ( Section 5.2.3.1 was specified. If the m= 2059 section is bundled into another m= section, it still MUST NOT 2060 contain any ICE credentials. 2062 o If the m= section is not bundled into another m= section, its 2063 "a=rtcp" attribute line MUST be filled in with the port and 2064 address of the default RTCP candidate, as indicated in [RFC5761], 2065 Section 5.1.3. If no RTCP candidates have yet been gathered, 2066 dummy values MUST be used, as described in the initial offer 2067 section above. 2069 o If the m= section is not bundled into another m= section, for each 2070 candidate that has been gathered during the most recent gathering 2071 phase (see Section 3.5.1), an "a=candidate" line MUST be added, as 2072 defined in [RFC5245], Section 4.3., paragraph 3. If candidate 2073 gathering for the section has completed, an "a=end-of-candidates" 2074 attribute MUST be added, as described in [I-D.ietf-ice-trickle], 2075 Section 9.3. If the m= section is bundled into another m= 2076 section, both "a=candidate" and "a=end-of-candidates" MUST be 2077 omitted. 2079 o For RtpTransceivers that are still present, the "a=rid" lines MUST 2080 stay the same. 2082 o For RtpTransceivers that are still present, any "a=simulcast" line 2083 MUST stay the same. 2085 If the previous offer was applied using setLocalDescription, and a 2086 corresponding answer from the remote side has been applied using 2087 setRemoteDescription, meaning the PeerConnection is in the "have- 2088 remote-pranswer" or "stable" states, an offer is generated based on 2089 the negotiated session descriptions by following the steps mentioned 2090 for the "have-local-offer" state above. 2092 In addition, for each existing, non-recycled, non-rejected m= section 2093 in the new offer, the following adjustments are made based on the 2094 contents of the corresponding m= section in the current local or 2095 remote description, as appropriate: 2097 o The m= line and corresponding "a=rtpmap" and "a=fmtp" lines MUST 2098 only include media formats which have not been excluded by the 2099 codec preferences of the associated transceiver, and MUST include 2100 all currently available formats. Media formats that were 2101 previously offered but are no longer available (e.g., a shared 2102 hardware codec) MAY be excluded. 2104 o Unless codec preferences have been set for the associated 2105 transceiver, the media formats on the m= line MUST be generated in 2106 the same order as in the most recent answer. Any media formats 2107 that were not present in the most recent answer MUST be added 2108 after all existing formats. 2110 o The RTP header extensions MUST only include those that are present 2111 in the most recent answer. 2113 o The RTCP feedback mechanisms MUST only include those that are 2114 present in the most recent answer, except for the case of format- 2115 specific mechanisms that are referencing a newly-added media 2116 format. 2118 o The "a=rtcp" line MUST NOT be added if the most recent answer 2119 included an "a=rtcp-mux" line. 2121 o The "a=rtcp-mux" line MUST be the same as that in the most recent 2122 answer. 2124 o The "a=rtcp-mux-only" line MUST NOT be added. 2126 o The "a=rtcp-rsize" line MUST NOT be added unless present in the 2127 most recent answer. 2129 o An "a=bundle-only" line MUST NOT be added, as indicated in 2130 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 6. Instead, 2131 JSEP implementations MUST simply omit parameters in the IDENTICAL 2132 and TRANSPORT categories for bundled m= sections, as described in 2133 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 8.1. 2135 o Note that if media m= sections are bundled into a data m= section, 2136 then certain TRANSPORT and IDENTICAL attributes may appear in the 2137 data m= section even if they would otherwise only be appropriate 2138 for a media m= section (e.g., "a=rtcp-mux"). This cannot happen 2139 in initial offers because in the initial offer JSEP 2140 implementations always list media m= sections (if any) before the 2141 data m= section (if any), and at least one of those media m= 2142 sections will not have the "a=bundle-only" attribute. Therefore, 2143 in initial offers, any "a=bundle-only" m= sections will be bundled 2144 into a preceding non-bundle-only media m= section. 2146 The "a=group:BUNDLE" attribute MUST include the MID identifiers 2147 specified in the bundle group in the most recent answer, minus any m= 2148 sections that have been marked as rejected, plus any newly added or 2149 re-enabled m= sections. In other words, the bundle attribute must 2150 contain all m= sections that were previously bundled, as long as they 2151 are still alive, as well as any new m= sections. 2153 "a=group:LS" attributes are generated in the same way as for initial 2154 offers, with the additional stipulation that any lip sync groups that 2155 were present in the most recent answer MUST continue to exist and 2156 MUST contain any previously existing MID identifiers, as long as the 2157 identified m= sections still exist and are not rejected, and the 2158 group still contains at least two MID identifiers. This ensures that 2159 any synchronized "recvonly" m= sections continue to be synchronized 2160 in the new offer. 2162 5.2.3. Options Handling 2164 The createOffer method takes as a parameter an RTCOfferOptions 2165 object. Special processing is performed when generating a SDP 2166 description if the following options are present. 2168 5.2.3.1. IceRestart 2170 If the "IceRestart" option is specified, with a value of "true", the 2171 offer MUST indicate an ICE restart by generating new ICE ufrag and 2172 pwd attributes, as specified in [RFC5245], Section 9.1.1.1. If this 2173 option is specified on an initial offer, it has no effect (since a 2174 new ICE ufrag and pwd are already generated). Similarly, if the ICE 2175 configuration has changed, this option has no effect, since new ufrag 2176 and pwd attributes will be generated automatically. This option is 2177 primarily useful for reestablishing connectivity in cases where 2178 failures are detected by the application. 2180 5.2.3.2. VoiceActivityDetection 2182 Silence suppression, also known as discontinuous transmission 2183 ("DTX"), can reduce the bandwidth used for audio by switching to a 2184 special encoding when voice activity is not detected, at the cost of 2185 some fidelity. 2187 If the "VoiceActivityDetection" option is specified, with a value of 2188 "true", the offer MUST indicate support for silence suppression in 2189 the audio it receives by including comfort noise ("CN") codecs for 2190 each offered audio codec, as specified in [RFC3389], Section 5.1, 2191 except for codecs that have their own internal silence suppression 2192 support. For codecs that have their own internal silence suppression 2193 support, the appropriate fmtp parameters for that codec MUST be 2194 specified to indicate that silence suppression for received audio is 2195 desired. For example, when using the Opus codec [RFC6716], the 2196 "usedtx=1" parameter, specified in [RFC7587], would be used in the 2197 offer. 2199 If the "VoiceActivityDetection" option is specified, with a value of 2200 "false", the JSEP implementation MUST NOT emit "CN" codecs. For 2201 codecs that have their own internal silence suppression support, the 2202 appropriate fmtp parameters for that codec MUST be specified to 2203 indicate that silence suppression for received audio is not desired. 2204 For example, when using the Opus codec, the "usedtx=0" parameter 2205 would be specified in the offer. In addition, the implementation 2206 MUST NOT use silence suppression for media it generates, regardless 2207 of whether the "CN" codecs or related fmtp parameters appear in the 2208 peer's description. The impact of these rules is that silence 2209 suppression in JSEP depends on mutual agreement of both sides, which 2210 ensures consistent handling regardless of which codec is used. 2212 The "VoiceActivityDetection" option does not have any impact on the 2213 setting of the "vad" value in the signaling of the client to mixer 2214 audio level header extension described in [RFC6464], Section 4. 2216 5.3. Generating an Answer 2218 When createAnswer is called, a new SDP description must be created 2219 that is compatible with the supplied remote description as well as 2220 the requirements specified in [I-D.ietf-rtcweb-rtp-usage]. The exact 2221 details of this process are explained below. 2223 5.3.1. Initial Answers 2225 When createAnswer is called for the first time after a remote 2226 description has been provided, the result is known as the initial 2227 answer. If no remote description has been installed, an answer 2228 cannot be generated, and an error MUST be returned. 2230 Note that the remote description SDP may not have been created by a 2231 JSEP endpoint and may not conform to all the requirements listed in 2232 Section 5.2. For many cases, this is not a problem. However, if any 2233 mandatory SDP attributes are missing, or functionality listed as 2234 mandatory-to-use above is not present, this MUST be treated as an 2235 error, and MUST cause the affected m= sections to be marked as 2236 rejected. 2238 The first step in generating an initial answer is to generate 2239 session-level attributes. The process here is identical to that 2240 indicated in the initial offers section above, except that the 2241 "a=ice-options" line, with the "trickle" option as specified in 2242 [I-D.ietf-ice-trickle], Section 4, is only included if such an option 2243 was present in the offer. 2245 The next step is to generate session-level lip sync groups, as 2246 defined in [RFC5888], Section 7. For each group of type "LS" present 2247 in the offer, select the local RtpTransceivers that are referenced by 2248 the MID values in the specified group, and determine which of them 2249 either reference a common local MediaStream (specified in the calls 2250 to addTrack/addTransceiver used to create them), or have no 2251 MediaStream to reference because they were not created by addTrack/ 2252 addTransceiver. If at least two such RtpTransceivers exist, a group 2253 of type "LS" with the mid values of these RtpTransceivers MUST be 2254 added. Otherwise the offered "LS" group MUST be ignored and no 2255 corresponding group generated in the answer. 2257 As a simple example, consider the following offer of a single audio 2258 and single video track contained in the same MediaStream. SDP lines 2259 not relevant to this example have been removed for clarity. As 2260 explained in Section 5.2, a group of type "LS" has been added that 2261 references each track's RtpTransceiver. 2263 a=group:LS a1 v1 2264 m=audio 10000 UDP/TLS/RTP/SAVPF 0 2265 a=mid:a1 2266 a=msid:ms1 mst1a 2267 m=video 10001 UDP/TLS/RTP/SAVPF 96 2268 a=mid:v1 2269 a=msid:ms1 mst1v 2271 If the answerer uses a single MediaStream when it adds its tracks, 2272 both of its transceivers will reference this stream, and so the 2273 subsequent answer will contain a "LS" group identical to that in the 2274 offer, as shown below: 2276 a=group:LS a1 v1 2277 m=audio 20000 UDP/TLS/RTP/SAVPF 0 2278 a=mid:a1 2279 a=msid:ms2 mst2a 2280 m=video 20001 UDP/TLS/RTP/SAVPF 96 2281 a=mid:v1 2282 a=msid:ms2 mst2v 2284 However, if the answerer groups its tracks into separate 2285 MediaStreams, its transceivers will reference different streams, and 2286 so the subsequent answer will not contain a "LS" group. 2288 m=audio 20000 UDP/TLS/RTP/SAVPF 0 2289 a=mid:a1 2290 a=msid:ms2a mst2a 2291 m=video 20001 UDP/TLS/RTP/SAVPF 96 2292 a=mid:v1 2293 a=msid:ms2b mst2v 2295 Finally, if the answerer does not add any tracks, its transceivers 2296 will not reference any MediaStreams, causing the preferences of the 2297 offerer to be maintained, and so the subsequent answer will contain 2298 an identical "LS" group. 2300 a=group:LS a1 v1 2301 m=audio 20000 UDP/TLS/RTP/SAVPF 0 2302 a=mid:a1 2303 a=recvonly 2304 m=video 20001 UDP/TLS/RTP/SAVPF 96 2305 a=mid:v1 2306 a=recvonly 2308 The Section 7.2 example later in this document shows a more involved 2309 case of "LS" group generation. 2311 The next step is to generate m= sections for each m= section that is 2312 present in the remote offer, as specified in [RFC3264], Section 6. 2313 For the purposes of this discussion, any session-level attributes in 2314 the offer that are also valid as media-level attributes are 2315 considered to be present in each m= section. Each offered m= section 2316 will have an associated RtpTransceiver, as described in Section 5.10. 2317 If there are more RtpTransceivers than there are m= sections, the 2318 unmatched RtpTransceivers will need to be associated in a subsequent 2319 offer. 2321 For each offered m= section, if any of the following conditions are 2322 true, the corresponding m= section in the answer MUST be marked as 2323 rejected by setting the port in the m= line to zero, as indicated in 2324 [RFC3264], Section 6, and further processing for this m= section can 2325 be skipped: 2327 o The associated RtpTransceiver has been stopped. 2329 o None of the offered media formats are supported and, if 2330 applicable, allowed by codec preferences. 2332 o The bundle policy is "max-bundle", and this is not the first m= 2333 section or in the same bundle group as the first m= section. 2335 o The bundle policy is "balanced", and this is not the first m= 2336 section for this media type or in the same bundle group as the 2337 first m= section for this media type. 2339 Otherwise, each m= section in the answer should then be generated as 2340 specified in [RFC3264], Section 6.1. For the m= line itself, the 2341 following rules must be followed: 2343 o The port value would normally be set to the port of the default 2344 ICE candidate for this m= section, but given that no candidates 2345 are available yet, the "dummy" port value of 9 (Discard) MUST be 2346 used, as indicated in [I-D.ietf-ice-trickle], Section 5.1. 2348 o The field MUST be set to exactly match the field 2349 for the corresponding m= line in the offer. 2351 o If codec preferences have been set for the associated transceiver, 2352 media formats MUST be generated in the corresponding order, 2353 regardless of what was offered, and MUST exclude any codecs not 2354 present in the codec preferences. 2356 o Otherwise, the media formats on the m= line MUST be generated in 2357 the same order as those offered in the current remote description, 2358 excluding any currently unsupported formats. Any currently 2359 available media formats that are not present in the current remote 2360 description MUST be added after all existing formats. 2362 o In either case, the media formats in the answer MUST include at 2363 least one format that is present in the offer, but MAY include 2364 formats that are locally supported but not present in the offer, 2365 as mentioned in [RFC3264], Section 6.1. If no common format 2366 exists, the m= section is rejected as described above. 2368 The m= line MUST be followed immediately by a "c=" line, as specified 2369 in [RFC4566], Section 5.7. Again, as no candidates are available 2370 yet, the "c=" line must contain the "dummy" value "IN IP4 0.0.0.0", 2371 as defined in [I-D.ietf-ice-trickle], Section 5.1. 2373 If the offer supports bundle, all m= sections to be bundled must use 2374 the same ICE credentials and candidates; all m= sections not being 2375 bundled must use unique ICE credentials and candidates. Each m= 2376 section MUST contain the following attributes (which are of attribute 2377 types other than IDENTICAL and TRANSPORT): 2379 o If and only if present in the offer, an "a=mid" line, as specified 2380 in [RFC5888], Section 9.1. The "mid" value MUST match that 2381 specified in the offer. 2383 o A direction attribute, determined by applying the rules regarding 2384 the offered direction specified in [RFC3264], Section 6.1, and 2385 then intersecting with the direction of the associated 2386 RtpTransceiver. For example, in the case where an m= section is 2387 offered as "sendonly", and the local transceiver is set to 2388 "sendrecv", the result in the answer is a "recvonly" direction. 2390 o For each media format on the m= line, "a=rtpmap" and "a=fmtp" 2391 lines, as specified in [RFC4566], Section 6, and [RFC3264], 2392 Section 6.1. 2394 o If "rtx" is present in the offer, for each primary codec where RTP 2395 retransmission should be used, a corresponding "a=rtpmap" line 2396 indicating "rtx" with the clock rate of the primary codec and an 2397 "a=fmtp" line that references the payload type of the primary 2398 codec, as specified in [RFC4588], Section 8.1. 2400 o For each supported FEC mechanism, "a=rtpmap" and "a=fmtp" lines, 2401 as specified in [RFC4566], Section 6. The FEC mechanisms that 2402 MUST be supported are specified in [I-D.ietf-rtcweb-fec], 2403 Section 6, and specific usage for each media type is outlined in 2404 Sections 4 and 5. 2406 o If this m= section is for media with configurable durations of 2407 media per packet, e.g., audio, an "a=maxptime" line, as described 2408 in Section 5.2. 2410 o If this m= section is for video media, and there are known 2411 limitations on the size of images which can be decoded, an 2412 "a=imageattr" line, as specified in Section 3.6. 2414 o For each supported RTP header extension that is present in the 2415 offer, an "a=extmap" line, as specified in [RFC5285], Section 5. 2416 The list of header extensions that SHOULD/MUST be supported is 2417 specified in [I-D.ietf-rtcweb-rtp-usage], Section 5.2. Any header 2418 extensions that require encryption MUST be specified as indicated 2419 in [RFC6904], Section 4. 2421 o For each supported RTCP feedback mechanism that is present in the 2422 offer, an "a=rtcp-fb" line, as specified in [RFC4585], 2423 Section 4.2. The list of RTCP feedback mechanisms that SHOULD/ 2424 MUST be supported is specified in [I-D.ietf-rtcweb-rtp-usage], 2425 Section 5.1. 2427 o If the RtpTransceiver has a sendrecv or sendonly direction: 2429 * For each MediaStream that was associated with the transceiver 2430 when it was created via addTrack or addTransceiver, an "a=msid" 2431 line, as specified in [I-D.ietf-mmusic-msid], Section 2. If a 2432 MediaStreamTrack is attached to the transceiver's RtpSender, 2433 the "a=msid" lines MUST use that track's ID. If no 2434 MediaStreamTrack is attached, a valid ID MUST be generated, in 2435 the same way that the implementation generates IDs for local 2436 tracks. 2438 * If no MediaStream is associated with the transceiver, a single 2439 "a=msid" line with the special value "-" in place of the 2440 MediaStream ID, as specified in [I-D.ietf-mmusic-msid], 2441 Section 3. The track ID MUST be selected as described above. 2443 Each m= section which is not bundled into another m= section, MUST 2444 contain the following attributes (which are of category IDENTICAL or 2445 TRANSPORT): 2447 o "a=ice-ufrag" and "a=ice-pwd" lines, as specified in [RFC5245], 2448 Section 15.4. 2450 o For each desired digest algorithm, one or more "a=fingerprint" 2451 lines for each of the endpoint's certificates, as specified in 2452 [RFC8122], Section 5. 2454 o An "a=setup" line, as specified in [RFC4145], Section 4, and 2455 clarified for use in DTLS-SRTP scenarios in [RFC5763], Section 5. 2456 The role value in the answer MUST be "active" or "passive". When 2457 the offer contains the "actpass" value, as will always be the case 2458 with JSEP endpoints, the answerer SHOULD use the "active" role. 2459 Offers from non-JSEP endpoints MAY send other values for 2460 "a=setup", in which case the answer MUST use a value consistent 2461 with the value in the offer. 2463 o An "a=tls-id" line, as specified in [I-D.ietf-mmusic-dtls-sdp], 2464 Section 5.3. 2466 o If present in the offer, an "a=rtcp-mux" line, as specified in 2467 [RFC5761], Section 5.1.3. Otherwise, an "a=rtcp" line, as 2468 specified in [RFC3605], Section 2.1, containing the dummy value "9 2469 IN IP4 0.0.0.0" (because no candidates have yet been gathered). 2471 o If present in the offer, an "a=rtcp-rsize" line, as specified in 2472 [RFC5506], Section 5. 2474 If a data channel m= section has been offered, a m= section MUST also 2475 be generated for data. The field MUST be set to 2476 "application" and the and fields MUST be set to exactly 2477 match the fields in the offer. 2479 Within the data m= section, an "a=mid" line MUST be generated and 2480 included as described above, along with an "a=sctp-port" line 2481 referencing the SCTP port number, as defined in 2482 [I-D.ietf-mmusic-sctp-sdp], Section 5.1, and, if appropriate, an 2483 "a=max-message-size" line, as defined in [I-D.ietf-mmusic-sctp-sdp], 2484 Section 6.1. 2486 As discussed above, the following attributes of category IDENTICAL or 2487 TRANSPORT are included only if the data m= section is not bundled 2488 into another m= section: 2490 o "a=ice-ufrag" 2492 o "a=ice-pwd" 2494 o "a=fingerprint" 2496 o "a=setup" 2498 o "a=tls-id" 2500 Note that if media m= sections are bundled into a data m= section, 2501 then certain TRANSPORT and IDENTICAL attributes may also appear in 2502 the data m= section even if they would otherwise only be appropriate 2503 for a media m= section (e.g., "a=rtcp-mux"). 2505 If "a=group" attributes with semantics of "BUNDLE" are offered, 2506 corresponding session-level "a=group" attributes MUST be added as 2507 specified in [RFC5888]. These attributes MUST have semantics 2508 "BUNDLE", and MUST include the all mid identifiers from the offered 2509 bundle groups that have not been rejected. Note that regardless of 2510 the presence of "a=bundle-only" in the offer, no m= sections in the 2511 answer should have an "a=bundle-only" line. 2513 Attributes that are common between all m= sections MAY be moved to 2514 session-level, if explicitly defined to be valid at session-level. 2516 The attributes prohibited in the creation of offers are also 2517 prohibited in the creation of answers. 2519 5.3.2. Subsequent Answers 2521 When createAnswer is called a second (or later) time, or is called 2522 after a local description has already been installed, the processing 2523 is somewhat different than for an initial answer. 2525 If the previous answer was not applied using setLocalDescription, 2526 meaning the PeerConnection is still in the "have-remote-offer" state, 2527 the steps for generating an initial answer should be followed, 2528 subject to the following restriction: 2530 o The fields of the "o=" line MUST stay the same except for the 2531 field, which MUST increment if the session 2532 description changes in any way from the previously generated 2533 answer. 2535 If any session description was previously supplied to 2536 setLocalDescription, an answer is generated by following the steps in 2537 the "have-remote-offer" state above, along with these exceptions: 2539 o The "s=" and "t=" lines MUST stay the same. 2541 o Each "m=" and c=" line MUST be filled in with the port and address 2542 of the default candidate for the m= section, as described in 2543 [RFC5245], Section 4.3. Note, however, that the m= line protocol 2544 need not match the default candidate, because this protocol value 2545 must instead match what was supplied in the offer, as described 2546 above. 2548 o Each "a=ice-ufrag" and "a=ice-pwd" line MUST stay the same, unless 2549 the m= section is restarting, in which case new ICE credentials 2550 must be created as specified in [RFC5245], Section 9.2.1.1. If 2551 the m= section is bundled into another m= section, it still MUST 2552 NOT contain any ICE credentials. 2554 o Each "a=setup" line MUST use an "active" or "passive" role value 2555 consistent with the existing DTLS association, if the association 2556 is being continued by the offerer. 2558 o RTCP multiplexing must be used, and an "a=rtcp-mux" line inserted 2559 if and only if the m= section previously used RTCP multiplexing. 2561 o If the m= section is not bundled into another m= section and RTCP 2562 multiplexing is not active, an "a=rtcp" attribute line MUST be 2563 filled in with the port and address of the default RTCP candidate. 2564 If no RTCP candidates have yet been gathered, dummy values MUST be 2565 used, as described in the initial answer section above. 2567 o If the m= section is not bundled into another m= section, for each 2568 candidate that has been gathered during the most recent gathering 2569 phase (see Section 3.5.1), an "a=candidate" line MUST be added, as 2570 defined in [RFC5245], Section 4.3., paragraph 3. If candidate 2571 gathering for the section has completed, an "a=end-of-candidates" 2572 attribute MUST be added, as described in [I-D.ietf-ice-trickle], 2573 Section 9.3. If the m= section is bundled into another m= 2574 section, both "a=candidate" and "a=end-of-candidates" MUST be 2575 omitted. 2577 o For RtpTransceivers that are not stopped, the "a=msid" line(s) 2578 MUST stay the same, regardless of changes to the transceiver's 2579 direction or track. If no "a=msid" line is present in the current 2580 description, "a=msid" line(s) MUST be generated according to the 2581 same rules as for an initial answer. 2583 5.3.3. Options Handling 2585 The createAnswer method takes as a parameter an RTCAnswerOptions 2586 object. The set of parameters for RTCAnswerOptions is different than 2587 those supported in RTCOfferOptions; the IceRestart option is 2588 unnecessary, as ICE credentials will automatically be changed for all 2589 m= sections where the offerer chose to perform ICE restart. 2591 The following options are supported in RTCAnswerOptions. 2593 5.3.3.1. VoiceActivityDetection 2595 Silence suppression in the answer is handled as described in 2596 Section 5.2.3.2, with one exception: if support for silence 2597 suppression was not indicated in the offer, the 2598 VoiceActivityDetection parameter has no effect, and the answer should 2599 be generated as if VoiceActivityDetection was set to false. This is 2600 done on a per-codec basis (e.g., if the offerer somehow offered 2601 support for CN but set "usedtx=0" for Opus, setting 2602 VoiceActivityDetection to true would result in an answer with CN 2603 codecs and "usedtx=0"). The impact of this rule is that an answerer 2604 will not try to use silence suppression with any endpoint that does 2605 not offer it, making silence suppression support bilateral even with 2606 non-JSEP endpoints. 2608 5.4. Modifying an Offer or Answer 2610 The SDP returned from createOffer or createAnswer MUST NOT be changed 2611 before passing it to setLocalDescription. If precise control over 2612 the SDP is needed, the aforementioned createOffer/createAnswer 2613 options or RtpTransceiver APIs MUST be used. 2615 After calling setLocalDescription with an offer or answer, the 2616 application MAY modify the SDP to reduce its capabilities before 2617 sending it to the far side, as long as it follows the rules above 2618 that define a valid JSEP offer or answer. Likewise, an application 2619 that has received an offer or answer from a peer MAY modify the 2620 received SDP, subject to the same constraints, before calling 2621 setRemoteDescription. 2623 As always, the application is solely responsible for what it sends to 2624 the other party, and all incoming SDP will be processed by the JSEP 2625 implementation to the extent of its capabilities. It is an error to 2626 assume that all SDP is well-formed; however, one should be able to 2627 assume that any implementation of this specification will be able to 2628 process, as a remote offer or answer, unmodified SDP coming from any 2629 other implementation of this specification. 2631 5.5. Processing a Local Description 2633 When a SessionDescription is supplied to setLocalDescription, the 2634 following steps MUST be performed: 2636 o If the description is of type "rollback", follow the processing 2637 defined in Section 5.7 and skip the processing described in the 2638 rest of this section. 2640 o Otherwise, the type of the SessionDescription is checked against 2641 the current state of the PeerConnection: 2643 * If the type is "offer", the PeerConnection state MUST be either 2644 "stable" or "have-local-offer". 2646 * If the type is "pranswer" or "answer", the PeerConnection state 2647 MUST be either "have-remote-offer" or "have-local-pranswer". 2649 o If the type is not correct for the current state, processing MUST 2650 stop and an error MUST be returned. 2652 o The SessionDescription is then checked to ensure that its contents 2653 are identical to those generated in the last call to createOffer/ 2654 createAnswer, and thus have not been altered, as discussed in 2655 Section 5.4; otherwise, processing MUST stop and an error MUST be 2656 returned. 2658 o Next, the SessionDescription is parsed into a data structure, as 2659 described in Section 5.8 below. 2661 o Finally, the parsed SessionDescription is applied as described in 2662 Section 5.9 below. 2664 5.6. Processing a Remote Description 2666 When a SessionDescription is supplied to setRemoteDescription, the 2667 following steps MUST be performed: 2669 o If the description is of type "rollback", follow the processing 2670 defined in Section 5.7 and skip the processing described in the 2671 rest of this section. 2673 o Otherwise, the type of the SessionDescription is checked against 2674 the current state of the PeerConnection: 2676 * If the type is "offer", the PeerConnection state MUST be either 2677 "stable" or "have-remote-offer". 2679 * If the type is "pranswer" or "answer", the PeerConnection state 2680 MUST be either "have-local-offer" or "have-remote-pranswer". 2682 o If the type is not correct for the current state, processing MUST 2683 stop and an error MUST be returned. 2685 o Next, the SessionDescription is parsed into a data structure, as 2686 described in Section 5.8 below. If parsing fails for any reason, 2687 processing MUST stop and an error MUST be returned. 2689 o Finally, the parsed SessionDescription is applied as described in 2690 Section 5.10 below. 2692 5.7. Processing a Rollback 2694 A rollback may be performed if the PeerConnection is in any state 2695 except for "stable". This means that both offers and provisional 2696 answers can be rolled back. Rollback can only be used to cancel 2697 proposed changes; there is no support for rolling back from a stable 2698 state to a previous stable state. If a rollback is attempted in the 2699 "stable" state, processing MUST stop and an error MUST be returned. 2700 Note that this implies that once the answerer has performed 2701 setLocalDescription with his answer, this cannot be rolled back. 2703 The effect of rollback MUST be the same regardless of whether 2704 setLocalDescription or setRemoteDescription is called. 2706 In order to process rollback, a JSEP implementation abandons the 2707 current offer/answer transaction, sets the signaling state to 2708 "stable", and sets the pending local and/or remote description (see 2709 Section 4.1.12 and Section 4.1.14) to null. Any resources or 2710 candidates that were allocated by the abandoned local description are 2711 discarded; any media that is received is processed according to the 2712 previous local and remote descriptions. 2714 A rollback disassociates any RtpTransceivers that were associated 2715 with m= sections by the application of the rolled-back session 2716 description (see Section 5.10 and Section 5.9). This means that some 2717 RtpTransceivers that were previously associated will no longer be 2718 associated with any m= section; in such cases, the value of the 2719 RtpTransceiver's mid property MUST be set to null, and the mapping 2720 between the transceiver and its m= section index MUST be discarded. 2721 RtpTransceivers that were created by applying a remote offer that was 2722 subsequently rolled back MUST be stopped and removed from the 2723 PeerConnection. However, a RtpTransceiver MUST NOT be removed if a 2724 track was attached to the RtpTransceiver via the addTrack method. 2725 This is so that an application may call addTrack, then call 2726 setRemoteDescription with an offer, then roll back that offer, then 2727 call createOffer and have a m= section for the added track appear in 2728 the generated offer. 2730 5.8. Parsing a Session Description 2732 The SDP contained in the session description object consists of a 2733 sequence of text lines, each containing a key-value expression, as 2734 described in [RFC4566], Section 5. The SDP is read, line-by-line, 2735 and converted to a data structure that contains the deserialized 2736 information. However, SDP allows many types of lines, not all of 2737 which are relevant to JSEP applications. For each line, the 2738 implementation will first ensure it is syntactically correct 2739 according to its defining ABNF, check that it conforms to [RFC4566] 2740 and [RFC3264] semantics, and then either parse and store or discard 2741 the provided value, as described below. 2743 If any line is not well-formed, or cannot be parsed as described, the 2744 parser MUST stop with an error and reject the session description, 2745 even if the value is to be discarded. This ensures that 2746 implementations do not accidentally misinterpret ambiguous SDP. 2748 5.8.1. Session-Level Parsing 2750 First, the session-level lines are checked and parsed. These lines 2751 MUST occur in a specific order, and with a specific syntax, as 2752 defined in [RFC4566], Section 5. Note that while the specific line 2753 types (e.g. "v=", "c=") MUST occur in the defined order, lines of the 2754 same type (typically "a=") can occur in any order. 2756 The following non-attribute lines are not meaningful in the JSEP 2757 context and MAY be discarded once they have been checked. 2759 The "c=" line MUST be checked for syntax but its value is only 2760 used for ICE mismatch detection, as defined in [RFC5245], 2761 Section 6.1. Note that JSEP implementations should never 2762 encounter this condition because ICE is required for WebRTC. 2764 The "i=", "u=", "e=", "p=", "t=", "r=", "z=", and "k=" lines are 2765 not used by this specification; they MUST be checked for syntax 2766 but their values are not used. 2768 The remaining non-attribute lines are processed as follows: 2770 The "v=" line MUST have a version of 0, as specified in [RFC4566], 2771 Section 5.1. 2773 The "o=" line MUST be parsed as specified in [RFC4566], 2774 Section 5.2. 2776 The "b=" line, if present, MUST be parsed as specified in 2777 [RFC4566], Section 5.8, and the bwtype and bandwidth values 2778 stored. 2780 Finally, the attribute lines are processed. Specific processing MUST 2781 be applied for the following session-level attribute ("a=") lines: 2783 o Any "a=group" lines are parsed as specified in [RFC5888], 2784 Section 5, and the group's semantics and mids are stored. 2786 o If present, a single "a=ice-lite" line is parsed as specified in 2787 [RFC5245], Section 15.3, and a value indicating the presence of 2788 ice-lite is stored. 2790 o If present, a single "a=ice-ufrag" line is parsed as specified in 2791 [RFC5245], Section 15.4, and the ufrag value is stored. 2793 o If present, a single "a=ice-pwd" line is parsed as specified in 2794 [RFC5245], Section 15.4, and the password value is stored. 2796 o If present, a single "a=ice-options" line is parsed as specified 2797 in [RFC5245], Section 15.5, and the set of specified options is 2798 stored. 2800 o Any "a=fingerprint" lines are parsed as specified in [RFC8122], 2801 Section 5, and the set of fingerprint and algorithm values is 2802 stored. 2804 o If present, a single "a=setup" line is parsed as specified in 2805 [RFC4145], Section 4, and the setup value is stored. 2807 o If present, a single "a=tls-id" line is parsed as specified in 2808 [I-D.ietf-mmusic-dtls-sdp] Section 5, and the tls-id value is 2809 stored. 2811 o Any "a=identity" lines are parsed and the identity values stored 2812 for subsequent verification, as specified 2813 [I-D.ietf-rtcweb-security-arch], Section 5. 2815 o Any "a=extmap" lines are parsed as specified in [RFC5285], 2816 Section 5, and their values are stored. 2818 Other attributes that are not relevant to JSEP may also be present, 2819 and implementations SHOULD process any that they recognize. As 2820 required by [RFC4566], Section 5.13, unknown attribute lines MUST be 2821 ignored. 2823 Once all the session-level lines have been parsed, processing 2824 continues with the lines in m= sections. 2826 5.8.2. Media Section Parsing 2828 Like the session-level lines, the media section lines MUST occur in 2829 the specific order and with the specific syntax defined in [RFC4566], 2830 Section 5. 2832 The "m=" line itself MUST be parsed as described in [RFC4566], 2833 Section 5.14, and the media, port, proto, and fmt values stored. 2835 Following the "m=" line, specific processing MUST be applied for the 2836 following non-attribute lines: 2838 o As with the "c=" line at the session level, the "c=" line MUST be 2839 parsed according to [RFC4566], Section 5.7, but its value is not 2840 used. 2842 o The "b=" line, if present, MUST be parsed as specified in 2843 [RFC4566], Section 5.8, and the bwtype and bandwidth values 2844 stored. 2846 Specific processing MUST also be applied for the following attribute 2847 lines: 2849 o If present, a single "a=ice-ufrag" line is parsed as specified in 2850 [RFC5245], Section 15.4, and the ufrag value is stored. 2852 o If present, a single "a=ice-pwd" line is parsed as specified in 2853 [RFC5245], Section 15.4, and the password value is stored. 2855 o If present, a single "a=ice-options" line is parsed as specified 2856 in [RFC5245], Section 15.5, and the set of specified options is 2857 stored. 2859 o Any "a=candidate" attributes MUST be parsed as specified in 2860 [RFC5245], Section 15.1, and their values stored. 2862 o Any "a=remote-candidates" attributes MUST be parsed as specified 2863 in [RFC5245], Section 15.2, but their values are ignored. 2865 o If present, a single "a=end-of-candidates" attribute MUST be 2866 parsed as specified in [I-D.ietf-ice-trickle], Section 8.2, and 2867 its presence or absence flagged and stored. 2869 o Any "a=fingerprint" lines are parsed as specified in [RFC8122], 2870 Section 5, and the set of fingerprint and algorithm values is 2871 stored. 2873 If the "m=" proto value indicates use of RTP, as described in 2874 Section 5.1.2 above, the following attribute lines MUST be processed: 2876 o The "m=" fmt value MUST be parsed as specified in [RFC4566], 2877 Section 5.14, and the individual values stored. 2879 o Any "a=rtpmap" or "a=fmtp" lines MUST be parsed as specified in 2880 [RFC4566], Section 6, and their values stored. 2882 o If present, a single "a=ptime" line MUST be parsed as described in 2883 [RFC4566], Section 6, and its value stored. 2885 o If present, a single "a=maxptime" line MUST be parsed as described 2886 in [RFC4566], Section 6, and its value stored. 2888 o If present, a single direction attribute line (e.g. "a=sendrecv") 2889 MUST be parsed as described in [RFC4566], Section 6, and its value 2890 stored. 2892 o Any "a=ssrc" attributes MUST be parsed as specified in [RFC5576], 2893 Section 4.1, and their values stored. 2895 o Any "a=extmap" attributes MUST be parsed as specified in 2896 [RFC5285], Section 5, and their values stored. 2898 o Any "a=rtcp-fb" attributes MUST be parsed as specified in 2899 [RFC4585], Section 4.2., and their values stored. 2901 o If present, a single "a=rtcp-mux" attribute MUST be parsed as 2902 specified in [RFC5761], Section 5.1.3, and its presence or absence 2903 flagged and stored. 2905 o If present, a single "a=rtcp-mux-only" attribute MUST be parsed as 2906 specified in [I-D.ietf-mmusic-mux-exclusive], Section 3, and its 2907 presence or absence flagged and stored. 2909 o If present, a single "a=rtcp-rsize" attribute MUST be parsed as 2910 specified in [RFC5506], Section 5, and its presence or absence 2911 flagged and stored. 2913 o If present, a single "a=rtcp" attribute MUST be parsed as 2914 specified in [RFC3605], Section 2.1, but its value is ignored, as 2915 this information is superfluous when using ICE. 2917 o If present, "a=msid" attributes MUST be parsed as specified in 2918 [I-D.ietf-mmusic-msid], Section 3.2, and their values stored. 2920 o Any "a=imageattr" attributes MUST be parsed as specified in 2921 [RFC6236], Section 3, and their values stored. 2923 o Any "a=rid" lines MUST be parsed as specified in 2924 [I-D.ietf-mmusic-rid], Section 10, and their values stored. 2926 o If present, a single "a=simulcast" line MUST be parsed as 2927 specified in [I-D.ietf-mmusic-sdp-simulcast], and its values 2928 stored. 2930 Otherwise, if the "m=" proto value indicates use of SCTP, the 2931 following attribute lines MUST be processed: 2933 o The "m=" fmt value MUST be parsed as specified in 2934 [I-D.ietf-mmusic-sctp-sdp], Section 4.3, and the application 2935 protocol value stored. 2937 o An "a=sctp-port" attribute MUST be present, and it MUST be parsed 2938 as specified in [I-D.ietf-mmusic-sctp-sdp], Section 5.2, and the 2939 value stored. 2941 o If present, a single "a=max-message-size" attribute MUST be parsed 2942 as specified in [I-D.ietf-mmusic-sctp-sdp], Section 6, and the 2943 value stored. Otherwise, use the specified default. 2945 Other attributes that are not relevant to JSEP may also be present, 2946 and implementations SHOULD process any that they recognize. As 2947 required by [RFC4566], Section 5.13, unknown attribute lines MUST be 2948 ignored. 2950 5.8.3. Semantics Verification 2952 Assuming parsing completes successfully, the parsed description is 2953 then evaluated to ensure internal consistency as well as proper 2954 support for mandatory features. Specifically, the following checks 2955 are performed: 2957 o For each m= section, valid values for each of the mandatory-to-use 2958 features enumerated in Section 5.1.1 MUST be present. These 2959 values MAY either be present at the media level, or inherited from 2960 the session level. 2962 * ICE ufrag and password values, which MUST comply with the size 2963 limits specified in [RFC5245], Section 15.4. 2965 * tls-id value, which MUST be set according to 2966 [I-D.ietf-mmusic-dtls-sdp], Section 5. If this is a re-offer 2967 and the tls-id value is different from that presently in use, 2968 the DTLS connection is not being continued and the remote 2969 description MUST be part of an ICE restart, together with new 2970 ufrag and password values. If this is an answer, the tls-id 2971 value, if present, MUST be the same as in the offer. 2973 * DTLS setup value, which MUST be set according to the rules 2974 specified in [RFC5763], Section 5 and MUST be consistent with 2975 the selected role of the current DTLS connection, if one exists 2976 and is being continued. 2978 * DTLS fingerprint values, where at least one fingerprint MUST be 2979 present. 2981 o All RID values referenced in an "a=simulcast" line MUST exist as 2982 "a=rid" lines. 2984 o Each m= section is also checked to ensure prohibited features are 2985 not used. 2987 o If the RTP/RTCP multiplexing policy is "require", each m= section 2988 MUST contain an "a=rtcp-mux" attribute. If an m= section contains 2989 an "a=rtcp-mux-only" attribute, that section MUST also contain an 2990 "a=rtcp-mux" attribute. 2992 o If an m= section was present in the previous answer, the state of 2993 RTP/RTCP multiplexing MUST match what was previously negotiated. 2995 If this session description is of type "pranswer" or "answer", the 2996 following additional checks are applied: 2998 o The session description must follow the rules defined in 2999 [RFC3264], Section 6, including the requirement that the number of 3000 m= sections MUST exactly match the number of m= sections in the 3001 associated offer. 3003 o For each m= section, the media type and protocol values MUST 3004 exactly match the media type and protocol values in the 3005 corresponding m= section in the associated offer. 3007 If any of the preceding checks failed, processing MUST stop and an 3008 error MUST be returned. 3010 5.9. Applying a Local Description 3012 The following steps are performed at the media engine level to apply 3013 a local description. If an error is returned, the session MUST be 3014 restored to the state it was in before performing these steps. 3016 First, m= sections are processed. For each m= section, the following 3017 steps MUST be performed; if any parameters are out of bounds, or 3018 cannot be applied, processing MUST stop and an error MUST be 3019 returned. 3021 o If this m= section is new, begin gathering candidates for it, as 3022 defined in [RFC5245], Section 4.1.1, unless it is definitively 3023 being bundled (either this is an offer and the m= section is 3024 marked bundle-only, or it is an answer and the m= section is 3025 bundled into into another m= section.) 3027 o Or, if the ICE ufrag and password values have changed, trigger the 3028 ICE agent to start an ICE restart, and begin gathering new 3029 candidates for the m= section as described in [RFC5245], 3030 Section 9.1.1.1. If this description is an answer, also start 3031 checks on that media section as defined in [RFC5245], 3032 Section 9.3.1.1. 3034 o If the m= section proto value indicates use of RTP: 3036 * If there is no RtpTransceiver associated with this m= section, 3037 find one and associate it with this m= section according to the 3038 following steps. Note that this situation will only occur when 3039 applying an offer. 3041 + Find the RtpTransceiver that corresponds to this m= section, 3042 using the mapping between transceivers and m= section 3043 indices established when creating the offer. 3045 + Set the value of this RtpTransceiver's mid property to the 3046 MID of the m= section. 3048 * If RTCP mux is indicated, prepare to demux RTP and RTCP from 3049 the RTP ICE component, as specified in [RFC5761], 3050 Section 5.1.3. 3052 * For each specified RTP header extension, establish a mapping 3053 between the extension ID and URI, as described in [RFC5285], 3054 Section 6. 3056 * If the MID header extension is supported, prepare to demux RTP 3057 streams intended for this m= section based on the MID header 3058 extension, as described in 3059 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 15. 3061 * For each specified media format, establish a mapping between 3062 the payload type and the actual media format, as described in 3063 [RFC3264], Section 6.1. In addition, prepare to demux RTP 3064 streams intended for this m= section based on the media formats 3065 supported by this m= section, as described in 3066 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 10.2. 3068 * For each specified "rtx" media format, establish a mapping 3069 between the RTX payload type and its associated primary payload 3070 type, as described in [RFC4588], Sections 8.6 and 8.7. 3072 * If the directional attribute is of type "sendrecv" or 3073 "recvonly", enable receipt and decoding of media. 3075 Finally, if this description is of type "pranswer" or "answer", 3076 follow the processing defined in Section 5.11 below. 3078 5.10. Applying a Remote Description 3080 The following steps are performed to apply a remote description. If 3081 an error is returned, the session MUST be restored to the state it 3082 was in before performing these steps. 3084 If the answer contains any "a=ice-options" attributes where "trickle" 3085 is listed as an attribute, update the PeerConnection canTrickle 3086 property to be true. Otherwise, set this property to false. 3088 The following steps MUST be performed for attributes at the session 3089 level; if any parameters are out of bounds, or cannot be applied, 3090 processing MUST stop and an error MUST be returned. 3092 o For any specified "CT" bandwidth value, set this as the limit for 3093 the maximum total bitrate for all m= sections, as specified in 3094 [RFC4566], Section 5.8. Within this overall limit, the 3095 implementation can dynamically decide how to best allocate the 3096 available bandwidth between m= sections, respecting any specific 3097 limits that have been specified for individual m= sections. 3099 o For any specified "RR" or "RS" bandwidth values, handle as 3100 specified in [RFC3556], Section 2. 3102 o Any "AS" bandwidth value MUST be ignored, as the meaning of this 3103 construct at the session level is not well defined. 3105 For each m= section, the following steps MUST be performed; if any 3106 parameters are out of bounds, or cannot be applied, processing MUST 3107 stop and an error MUST be returned. 3109 o If the ICE ufrag or password changed from the previous remote 3110 description: [RFC5245]. 3112 * If the description is of type "offer", the implementation MUST 3113 note that an ICE restart is needed, as described in [RFC5245], 3114 Section 9.1.1.1. 3116 * If the description is of type "answer" or "pranswer", then 3117 check to see if the current local description is an ICE 3118 restart, and if not, generate an error. If the PeerConnection 3119 state is "have-remote-pranswer", and the ICE ufrag or password 3120 changed from the previous provisional answer, then signal the 3121 ICE agent to discard any previous ICE check list state for the 3122 m= section. Finally, signal the ICE agent to begin checks as 3123 described in [RFC5245], Section 9.3.1.1. 3125 o If the current local description indicates an ICE restart, and 3126 either the ICE ufrag or password has not changed from the previous 3127 remote description, as prescribed by [RFC5245], Section 9.2.1.1, 3128 generate an error. 3130 o Configure the ICE components associated with this media section to 3131 use the supplied ICE remote ufrag and password for their 3132 connectivity checks. 3134 o Pair any supplied ICE candidates with any gathered local 3135 candidates, as described in [RFC5245], Section 5.7, and start 3136 connectivity checks with the appropriate credentials. 3138 o If an "a=end-of-candidates" attribute is present, process the end- 3139 of-candidates indication as described in [I-D.ietf-ice-trickle], 3140 Section 11. 3142 o If the m= section proto value indicates use of RTP: 3144 * If the m= section is being recycled (see Section 5.2.2), 3145 dissociate the currently associated RtpTransceiver by setting 3146 its mid property to null, and discard the mapping between the 3147 transceiver and its m= section index. 3149 * If the m= section is not associated with any RtpTransceiver 3150 (possibly because it was dissociated in the previous step), 3151 either find an RtpTransceiver or create one according to the 3152 following steps: 3154 + If the m= section is sendrecv or recvonly, and there are 3155 RtpTransceivers of the same type that were added to the 3156 PeerConnection by addTrack and are not associated with any 3157 m= section and are not stopped, find the first (according to 3158 the canonical order described in Section 5.2.1) such 3159 RtpTransceiver. 3161 + If no RtpTransceiver was found in the previous step, create 3162 one with a recvonly direction. 3164 + Associate the found or created RtpTransceiver with the m= 3165 section by setting the value of the RtpTransceiver's mid 3166 property to the MID of the m= section, and establish a 3167 mapping between the transceiver and the index of the m= 3168 section. If the m= section does not include a MID (i.e., 3169 the remote endpoint does not support the MID extension), 3170 generate a value for the RtpTransceiver mid property, 3171 following the guidance for "a=mid" mentioned in 3172 Section 5.2.1. 3174 * For each specified media format that is also supported by the 3175 local implementation, establish a mapping between the specified 3176 payload type and the media format, as described in [RFC3264], 3177 Section 6.1. Specifically, this means that the implementation 3178 records the payload type to be used in outgoing RTP packets 3179 when sending each specified media format, as well as the 3180 relative preference for each format that is indicated in their 3181 ordering. If any indicated media format is not supported by 3182 the local implementation, it MUST be ignored. 3184 * For each specified "rtx" media format, establish a mapping 3185 between the RTX payload type and its associated primary payload 3186 type, as described in [RFC4588], Section 4. If any referenced 3187 primary payload types are not present, this MUST result in an 3188 error. Note that RTX payload types may refer to primary 3189 payload types which are not supported by the local media 3190 implementation, in which case, the RTX payload type MUST also 3191 be ignored. 3193 * For each specified fmtp parameter that is supported by the 3194 local implementation, enable them on the associated media 3195 formats. 3197 * For each specified SSRC that is signaled in the m= section, 3198 prepare to demux RTP streams intended for this m= section using 3199 that SSRC, as described in 3200 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 10.2. 3202 * For each specified RTP header extension that is also supported 3203 by the local implementation, establish a mapping between the 3204 extension ID and URI, as described in [RFC5285], Section 5. 3205 Specifically, this means that the implementation records the 3206 extension ID to be used in outgoing RTP packets when sending 3207 each specified header extension. If any indicated RTP header 3208 extension is not supported by the local implementation, it MUST 3209 be ignored. 3211 * For each specified RTCP feedback mechanism that is supported by 3212 the local implementation, enable them on the associated media 3213 formats. 3215 * For any specified "TIAS" bandwidth value, set this value as a 3216 constraint on the maximum RTP bitrate to be used when sending 3217 media, as specified in [RFC3890]. If a "TIAS" value is not 3218 present, but an "AS" value is specified, generate a "TIAS" 3219 value using this formula: 3221 TIAS = AS * 1000 * 0.95 - (50 * 40 * 8) 3223 The 50 is based on 50 packets per second, the 40 is based on an 3224 estimate of total header size, the 1000 changes the unit from 3225 kbps to bps (as required by TIAS), and the 0.95 is to allocate 3226 5% to RTCP. "TIAS" is used in preference to "AS" because it 3227 provides more accurate control of bandwidth. 3229 * For any "RR" or "RS" bandwidth values, handle as specified in 3230 [RFC3556], Section 2. 3232 * Any specified "CT" bandwidth value MUST be ignored, as the 3233 meaning of this construct at the media level is not well 3234 defined. 3236 * If the m= section is of type audio: 3238 + For each specified "CN" media format, configure silence 3239 suppression for all supported media formats with the same 3240 clockrate, as described in [RFC3389], Section 5, except for 3241 formats that have their own internal silence suppression 3242 mechanisms. Silence suppression for such formats (e.g., 3243 Opus) is controlled via fmtp parameters, as discussed in 3244 Section 5.2.3.2. 3246 + For each specified "telephone-event" media format, enable 3247 DTMF transmission for all supported media formats with the 3248 same clockrate, as described in [RFC4733], Section 2.5.1.2. 3249 If there are any supported media formats that do not have a 3250 corresponding telephone-event format, disable DTMF 3251 transmission for those formats. 3253 + For any specified "ptime" value, configure the available 3254 media formats to use the specified packet size when sending. 3255 If the specified size is not supported for a media format, 3256 use the next closest value instead. 3258 Finally, if this description is of type "pranswer" or "answer", 3259 follow the processing defined in Section 5.11 below. 3261 5.11. Applying an Answer 3263 In addition to the steps mentioned above for processing a local or 3264 remote description, the following steps are performed when processing 3265 a description of type "pranswer" or "answer". 3267 For each m= section, the following steps MUST be performed: 3269 o If the m= section has been rejected (i.e. port is set to zero in 3270 the answer), stop any reception or transmission of media for this 3271 section, and, unless a non-rejected m= section is bundled with 3272 this m= section, discard any associated ICE components, as 3273 described in [RFC5245], Section 9.2.1.3. 3275 o If the remote DTLS fingerprint has been changed or the tls-id has 3276 changed, tear down the DTLS connection. This includes the case 3277 when the PeerConnection state is "have-remote-pranswer". If a 3278 DTLS connection needs to be torn down but the answer does not 3279 indicate an ICE restart or, in the case of "have-remote-pranswer", 3280 new ICE credentials, an error MUST be generated. If an ICE 3281 restart is performed without a change in tls-id or fingerprint, 3282 then the same DTLS connection is continued over the new ICE 3283 channel. 3285 o If no valid DTLS connection exists, prepare to start a DTLS 3286 connection, using the specified roles and fingerprints, on any 3287 underlying ICE components, once they are active. 3289 o If the m= section proto value indicates use of RTP: 3291 * If the m= section references RTCP feedback mechanisms that were 3292 not present in the corresponding m= section in the offer, this 3293 indicates a negotiation problem and MUST result in an error. 3294 However, new media formats and new RTP header extension values 3295 are permitted in the answer, as described in [RFC3264], 3296 Section 7, and [RFC5285], Section 6. 3298 * If the m= section has RTCP mux enabled, discard the RTCP ICE 3299 component, if one exists, and begin or continue muxing RTCP 3300 over the RTP ICE component, as specified in [RFC5761], 3301 Section 5.1.3. Otherwise, prepare to transmit RTCP over the 3302 RTCP ICE component; if no RTCP ICE component exists, because 3303 RTCP mux was previously enabled, this MUST result in an error. 3305 * If the m= section has reduced-size RTCP enabled, configure the 3306 RTCP transmission for this m= section to use reduced-size RTCP, 3307 as specified in [RFC5506]. 3309 * If the directional attribute in the answer indicates that the 3310 JSEP implementation should be sending media ("sendonly" for 3311 local answers, "recvonly" for remote answers, or "sendrecv" for 3312 either type of answer), choose the media format to send as the 3313 most preferred media format from the remote description that is 3314 also locally supported, as discussed in [RFC3264], Sections 6.1 3315 and 7, and start transmitting RTP media using that format once 3316 the underlying transport layers have been established. If an 3317 SSRC has not already been chosen for this outgoing RTP stream, 3318 choose a random one. If media is already being transmitted, 3319 the same SSRC SHOULD be used unless the clockrate of the new 3320 codec is different, in which case a new SSRC MUST be chosen, as 3321 specified in [RFC7160], Section 3.1. 3323 * The payload type mapping from the remote description is used to 3324 determine payload types for the outgoing RTP streams, including 3325 the payload type for the send media format chosen above. Any 3326 RTP header extensions that were negotiated should be included 3327 in the outgoing RTP streams, using the extension mapping from 3328 the remote description; if the RID header extension has been 3329 negotiated, and RID values are specified, include the RID 3330 header extension in the outgoing RTP streams, as indicated in 3331 [I-D.ietf-mmusic-rid], Section 4. 3333 * If the m= section is of type audio, and silence suppression was 3334 configured for the send media format as a result of processing 3335 the remote description, and is also enabled for that format in 3336 the local description, use silence suppression for outgoing 3337 media, in accordance with the guidance in Section 5.2.3.2. If 3338 these conditions are not met, silence suppression MUST NOT be 3339 used for outgoing media. 3341 * If simulcast has been negotiated, send the number of Source RTP 3342 Streams as specified in [I-D.ietf-mmusic-sdp-simulcast], 3343 Section 6.2.2. 3345 * If the send media format chosen above has a corresponding "rtx" 3346 media format, or a FEC mechanism has been negotiated, establish 3347 a Redundancy RTP Stream with a random SSRC for each Source RTP 3348 Stream, and start or continue transmitting RTX/FEC packets as 3349 needed. 3351 * If the send media format chosen above has a corresponding "red" 3352 media format of the same clockrate, allow redundant encoding 3353 using the specified format for resiliency purposes, as 3354 discussed in [I-D.ietf-rtcweb-fec], Section 3.2. Note that 3355 unlike RTX or FEC media formats, the "red" format is 3356 transmitted on the Source RTP Stream, not the Redundancy RTP 3357 Stream. 3359 * Enable the RTCP feedback mechanisms referenced in the media 3360 section for all Source RTP Streams using the specified media 3361 formats. Specifically, begin or continue sending the requested 3362 feedback types and reacting to received feedback, as specified 3363 in [RFC4585], Section 4.2. When sending RTCP feedback, follow 3364 the rules and recommendations from [RFC8108] Section 5.4.1, to 3365 select which SSRC to use. 3367 * If the directional attribute in the answer indicates that the 3368 JSEP implementation should not be sending media ("recvonly" for 3369 local answers, "sendonly" for remote answers, or "inactive" for 3370 either type of answer) stop transmitting all RTP media, but 3371 continue sending RTCP, as described in [RFC3264], Section 5.1. 3373 o If the m= section proto value indicates use of SCTP: 3375 * If an SCTP association exists, and the remote SCTP port has 3376 changed, discard the existing SCTP association. This includes 3377 the case when the PeerConnection state is "have-remote- 3378 pranswer". 3380 * If no valid SCTP association exists, prepare to initiate a SCTP 3381 association over the associated ICE component and DTLS 3382 connection, using the local SCTP port value from the local 3383 description, and the remote SCTP port value from the remote 3384 description, as described in [I-D.ietf-mmusic-sctp-sdp], 3385 Section 10.2. 3387 If the answer contains valid bundle groups, discard any ICE 3388 components for the m= sections that will be bundled onto the primary 3389 ICE components in each bundle, and begin muxing these m= sections 3390 accordingly, as described in 3391 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 8.2. 3393 If the description is of type "answer", and there are still remaining 3394 candidates in the ICE candidate pool, discard them. 3396 6. Processing RTP/RTCP 3398 When bundling, associating incoming RTP/RTCP with the proper m= 3399 section is defined in [I-D.ietf-mmusic-sdp-bundle-negotiation], 3400 Section 10.2. When not bundling, the proper m= section is clear from 3401 the ICE component over which the RTP/RTCP is received. 3403 Once the proper m= section(s) are known, RTP/RTCP is delivered to the 3404 RtpTransceiver(s) associated with the m= section(s) and further 3405 processing of the RTP/RTCP is done at the RtpTransceiver level. This 3406 includes using RID [I-D.ietf-mmusic-rid] to distinguish between 3407 multiple Encoded Streams, as well as determine which Source RTP 3408 stream should be repaired by a given Redundancy RTP stream. 3410 7. Examples 3412 Note that this example section shows several SDP fragments. To 3413 format in 72 columns, some of the lines in SDP have been split into 3414 multiple lines, where leading whitespace indicates that a line is a 3415 continuation of the previous line. In addition, some blank lines 3416 have been added to improve readability but are not valid in SDP. 3418 More examples of SDP for WebRTC call flows, including examples with 3419 IPv6 addresses, can be found in [I-D.ietf-rtcweb-sdp]. 3421 7.1. Simple Example 3423 This section shows a very simple example that sets up a minimal audio 3424 / video call between two JSEP endpoints without using trickle ICE. 3425 The example in the following section provides a more detailed example 3426 of what could happen in a JSEP session. 3428 The code flow below shows Alice's endpoint initiating the session to 3429 Bob's endpoint. The messages from the JavaScript application in 3430 Alice's browser to the JavaScript in Bob's browser, abbreviated as 3431 AliceJS and BobJS respectively, are assumed to flow over some 3432 signaling protocol via a web server. The JavaScript on both Alice's 3433 side and Bob's side waits for all candidates before sending the offer 3434 or answer, so the offers and answers are complete; trickle ICE is not 3435 used. The user agents (JSEP implementations) in Alice and Bob's 3436 browsers, abbreviated as AliceUA and BobUA respectively, are using 3437 the default bundle policy of "balanced", and the default RTCP mux 3438 policy of "require". 3440 // set up local media state 3441 AliceJS->AliceUA: create new PeerConnection 3442 AliceJS->AliceUA: addTrack with two tracks: audio and video 3443 AliceJS->AliceUA: createOffer to get offer 3444 AliceJS->AliceUA: setLocalDescription with offer 3445 AliceUA->AliceJS: multiple onicecandidate events with candidates 3447 // wait for ICE gathering to complete 3448 AliceUA->AliceJS: onicecandidate event with null candidate 3449 AliceJS->AliceUA: get |offer-A1| from pendingLocalDescription 3451 // |offer-A1| is sent over signaling protocol to Bob 3452 AliceJS->WebServer: signaling with |offer-A1| 3453 WebServer->BobJS: signaling with |offer-A1| 3455 // |offer-A1| arrives at Bob 3456 BobJS->BobUA: create a PeerConnection 3457 BobJS->BobUA: setRemoteDescription with |offer-A1| 3458 BobUA->BobJS: ontrack events for audio and video tracks 3460 // Bob accepts call 3461 BobJS->BobUA: addTrack with local tracks 3462 BobJS->BobUA: createAnswer 3463 BobJS->BobUA: setLocalDescription with answer 3464 BobUA->BobJS: multiple onicecandidate events with candidates 3466 // wait for ICE gathering to complete 3467 BobUA->BobJS: onicecandidate event with null candidate 3468 BobJS->BobUA: get |answer-A1| from currentLocalDescription 3470 // |answer-A1| is sent over signaling protocol to Alice 3471 BobJS->WebServer: signaling with |answer-A1| 3472 WebServer->AliceJS: signaling with |answer-A1| 3474 // |answer-A1| arrives at Alice 3475 AliceJS->AliceUA: setRemoteDescription with |answer-A1| 3476 AliceUA->AliceJS: ontrack events for audio and video tracks 3478 // media flows 3479 BobUA->AliceUA: media sent from Bob to Alice 3480 AliceUA->BobUA: media sent from Alice to Bob 3482 The SDP for |offer-A1| looks like: 3484 v=0 3485 o=- 4962303333179871722 1 IN IP4 0.0.0.0 3486 s=- 3487 t=0 0 3488 a=ice-options:trickle 3489 a=group:BUNDLE a1 v1 3490 a=group:LS a1 v1 3492 m=audio 10100 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3493 c=IN IP4 203.0.113.100 3494 a=mid:a1 3495 a=sendrecv 3496 a=rtpmap:96 opus/48000/2 3497 a=rtpmap:0 PCMU/8000 3498 a=rtpmap:8 PCMA/8000 3499 a=rtpmap:97 telephone-event/8000 3500 a=rtpmap:98 telephone-event/48000 3501 a=fmtp:97 0-15 3502 a=fmtp:98 0-15 3503 a=maxptime:120 3504 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3505 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3506 a=msid:47017fee-b6c1-4162-929c-a25110252400 3507 f83006c5-a0ff-4e0a-9ed9-d3e6747be7d9 3508 a=ice-ufrag:ETEn 3509 a=ice-pwd:OtSK0WpNtpUjkY4+86js7ZQl 3510 a=fingerprint:sha-256 3511 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04: 3512 BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3513 a=setup:actpass 3514 a=tls-id:1 3515 a=rtcp:10101 IN IP4 203.0.113.100 3516 a=rtcp-mux 3517 a=rtcp-rsize 3518 a=candidate:1 1 udp 2113929471 203.0.113.100 10100 typ host 3519 a=candidate:1 2 udp 2113929470 203.0.113.100 10101 typ host 3520 a=end-of-candidates 3522 m=video 10102 UDP/TLS/RTP/SAVPF 100 101 102 103 3523 c=IN IP4 203.0.113.100 3524 a=mid:v1 3525 a=sendrecv 3526 a=rtpmap:100 VP8/90000 3527 a=rtpmap:101 H264/90000 3528 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 3529 a=rtpmap:102 rtx/90000 3530 a=fmtp:102 apt=100 3531 =rtpmap:103 rtx/90000 3532 a=fmtp:103 apt=101 3533 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3534 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 3535 a=rtcp-fb:100 ccm fir 3536 a=rtcp-fb:100 nack 3537 a=rtcp-fb:100 nack pli 3538 a=msid:47017fee-b6c1-4162-929c-a25110252400 3539 f30bdb4a-5db8-49b5-bcdc-e0c9a23172e0 3540 a=ice-ufrag:BGKk 3541 a=ice-pwd:mqyWsAjvtKwTGnvhPztQ9mIf 3542 a=fingerprint:sha-256 3543 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04: 3544 BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3545 a=setup:actpass 3546 a=tls-id:1 3547 a=rtcp:10103 IN IP4 203.0.113.100 3548 a=rtcp-mux 3549 a=rtcp-rsize 3550 a=candidate:1 1 udp 2113929471 203.0.113.100 10102 typ host 3551 a=candidate:1 2 udp 2113929470 203.0.113.100 10103 typ host 3552 a=end-of-candidates 3554 The SDP for |answer-A1| looks like: 3556 v=0 3557 o=- 6729291447651054566 1 IN IP4 0.0.0.0 3558 s=- 3559 t=0 0 3560 a=ice-options:trickle 3561 a=group:BUNDLE a1 v1 3562 a=group:LS a1 v1 3564 m=audio 10200 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3565 c=IN IP4 203.0.113.200 3566 a=mid:a1 3567 a=sendrecv 3568 a=rtpmap:96 opus/48000/2 3569 a=rtpmap:0 PCMU/8000 3570 a=rtpmap:8 PCMA/8000 3571 a=rtpmap:97 telephone-event/8000 3572 a=rtpmap:98 telephone-event/48000 3573 a=fmtp:97 0-15 3574 a=fmtp:98 0-15 3575 a=maxptime:120 3576 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3577 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3578 a=msid:61317484-2ed4-49d7-9eb7-1414322a7aae 3579 5a7b57b8-f043-4bd1-a45d-09d4dfa31226 3581 a=ice-ufrag:6sFv 3582 a=ice-pwd:cOTZKZNVlO9RSGsEGM63JXT2 3583 a=fingerprint:sha-256 3584 6B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35: 3585 DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3586 a=setup:active 3587 a=tls-id:1 3588 a=rtcp-mux 3589 a=rtcp-rsize 3590 a=candidate:1 1 udp 2113929471 203.0.113.200 10200 typ host 3591 a=end-of-candidates 3593 m=video 10200 UDP/TLS/RTP/SAVPF 100 101 102 103 3594 c=IN IP4 203.0.113.200 3595 a=mid:v1 3596 a=sendrecv 3597 a=rtpmap:100 VP8/90000 3598 a=rtpmap:101 H264/90000 3599 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 3600 a=rtpmap:102 rtx/90000 3601 a=fmtp:102 apt=100 3602 =rtpmap:103 rtx/90000 3603 a=fmtp:103 apt=101 3604 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3605 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 3606 a=rtcp-fb:100 ccm fir 3607 a=rtcp-fb:100 nack 3608 a=rtcp-fb:100 nack pli 3609 a=msid:61317484-2ed4-49d7-9eb7-1414322a7aae 3610 4ea4d4a1-2fda-4511-a9cc-1b32c2e59552 3612 7.2. Detailed Example 3614 This section shows a more involved example of a session between two 3615 JSEP endpoints. Trickle ICE is used in full trickle mode, with a 3616 bundle policy of "max-bundle", an RTCP mux policy of "require", and a 3617 single TURN server. Initially, both Alice and Bob establish an audio 3618 channel and a data channel. Later, Bob adds two video flows, one for 3619 his video feed, and one for screensharing, both supporting FEC, and 3620 with the video feed configured for simulcast. Alice accepts these 3621 video flows, but does not add video flows of her own, so they are 3622 handled as recvonly. Alice also specifies a maximum video decoder 3623 resolution. 3625 // set up local media state 3626 AliceJS->AliceUA: create new PeerConnection 3627 AliceJS->AliceUA: addTrack with an audio track 3628 AliceJS->AliceUA: createDataChannel to get data channel 3629 AliceJS->AliceUA: createOffer to get |offer-B1| 3630 AliceJS->AliceUA: setLocalDescription with |offer-B1| 3632 // |offer-B1| is sent over signaling protocol to Bob 3633 AliceJS->WebServer: signaling with |offer-B1| 3634 WebServer->BobJS: signaling with |offer-B1| 3636 // |offer-B1| arrives at Bob 3637 BobJS->BobUA: create a PeerConnection 3638 BobJS->BobUA: setRemoteDescription with |offer-B1| 3639 BobUA->BobJS: ontrack with audio track from Alice 3641 // candidates are sent to Bob 3642 AliceUA->AliceJS: onicecandidate (host) |offer-B1-candidate-1| 3643 AliceJS->WebServer: signaling with |offer-B1-candidate-1| 3644 AliceUA->AliceJS: onicecandidate (srflx) |offer-B1-candidate-2| 3645 AliceJS->WebServer: signaling with |offer-B1-candidate-2| 3646 AliceUA->AliceJS: onicecandidate (relay) |offer-B1-candidate-3| 3647 AliceJS->WebServer: signaling with |offer-B1-candidate-3| 3649 WebServer->BobJS: signaling with |offer-B1-candidate-1| 3650 BobJS->BobUA: addIceCandidate with |offer-B1-candidate-1| 3651 WebServer->BobJS: signaling with |offer-B1-candidate-2| 3652 BobJS->BobUA: addIceCandidate with |offer-B1-candidate-2| 3653 WebServer->BobJS: signaling with |offer-B1-candidate-3| 3654 BobJS->BobUA: addIceCandidate with |offer-B1-candidate-3| 3656 // Bob accepts call 3657 BobJS->BobUA: addTrack with local audio 3658 BobJS->BobUA: createDataChannel to get data channel 3659 BobJS->BobUA: createAnswer to get |answer-B1| 3660 BobJS->BobUA: setLocalDescription with |answer-B1| 3662 // |answer-B1| is sent to Alice 3663 BobJS->WebServer: signaling with |answer-B1| 3664 WebServer->AliceJS: signaling with |answer-B1| 3665 AliceJS->AliceUA: setRemoteDescription with |answer-B1| 3666 AliceUA->AliceJS: ontrack event with audio track from Bob 3668 // candidates are sent to Alice 3669 BobUA->BobJS: onicecandidate (host) |answer-B1-candidate-1| 3670 BobJS->WebServer: signaling with |answer-B1-candidate-1| 3671 BobUA->BobJS: onicecandidate (srflx) |answer-B1-candidate-2| 3672 BobJS->WebServer: signaling with |answer-B1-candidate-2| 3673 BobUA->BobJS: onicecandidate (relay) |answer-B1-candidate-3| 3674 BobJS->WebServer: signaling with |answer-B1-candidate-3| 3675 WebServer->AliceJS: signaling with |answer-B1-candidate-1| 3676 AliceJS->AliceUA: addIceCandidate with |answer-B1-candidate-1| 3677 WebServer->AliceJS: signaling with |answer-B1-candidate-2| 3678 AliceJS->AliceUA: addIceCandidate with |answer-B1-candidate-2| 3679 WebServer->AliceJS: signaling with |answer-B1-candidate-3| 3680 AliceJS->AliceUA: addIceCandidate with |answer-B1-candidate-3| 3682 // data channel opens 3683 BobUA->BobJS: ondatachannel event 3684 AliceUA->AliceJS: ondatachannel event 3685 BobUA->BobJS: onopen 3686 AliceUA->AliceJS: onopen 3688 // media is flowing between endpoints 3689 BobUA->AliceUA: audio+data sent from Bob to Alice 3690 AliceUA->BobUA: audio+data sent from Alice to Bob 3692 // some time later Bob adds two video streams 3693 // note, no candidates exchanged, because of bundle 3694 BobJS->BobUA: addTrack with first video stream 3695 BobJS->BobUA: addTrack with second video stream 3696 BobJS->BobUA: createOffer to get |offer-B2| 3697 BobJS->BobUA: setLocalDescription with |offer-B2| 3699 // |offer-B2| is sent to Alice 3700 BobJS->WebServer: signaling with |offer-B2| 3701 WebServer->AliceJS: signaling with |offer-B2| 3702 AliceJS->AliceUA: setRemoteDescription with |offer-B2| 3703 AliceUA->AliceJS: ontrack event with first video track 3704 AliceUA->AliceJS: ontrack event with second video track 3705 AliceJS->AliceUA: createAnswer to get |answer-B2| 3706 AliceJS->AliceUA: setLocalDescription with |answer-B2| 3708 // |answer-B2| is sent over signaling protocol to Bob 3709 AliceJS->WebServer: signaling with |answer-B2| 3710 WebServer->BobJS: signaling with |answer-B2| 3711 BobJS->BobUA: setRemoteDescription with |answer-B2| 3713 // media is flowing between endpoints 3714 BobUA->AliceUA: audio+video+data sent from Bob to Alice 3715 AliceUA->BobUA: audio+video+data sent from Alice to Bob 3717 The SDP for |offer-B1| looks like: 3719 v=0 3720 o=- 4962303333179871723 1 IN IP4 0.0.0.0 3721 s=- 3722 t=0 0 3723 a=ice-options:trickle 3724 a=group:BUNDLE a1 d1 3726 m=audio 9 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3727 c=IN IP4 0.0.0.0 3728 a=mid:a1 3729 a=sendrecv 3730 a=rtpmap:96 opus/48000/2 3731 a=rtpmap:0 PCMU/8000 3732 a=rtpmap:8 PCMA/8000 3733 a=rtpmap:97 telephone-event/8000 3734 a=rtpmap:98 telephone-event/48000 3735 a=fmtp:97 0-15 3736 a=fmtp:98 0-15 3737 a=maxptime:120 3738 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3739 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3740 a=msid:57017fee-b6c1-4162-929c-a25110252400 3741 e83006c5-a0ff-4e0a-9ed9-d3e6747be7d9 3742 a=ice-ufrag:ATEn 3743 a=ice-pwd:AtSK0WpNtpUjkY4+86js7ZQl 3744 a=fingerprint:sha-256 3745 29:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04: 3746 BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3747 a=setup:actpass 3748 a=tls-id:1 3749 a=rtcp-mux 3750 a=rtcp-mux-only 3751 a=rtcp-rsize 3753 m=application 0 UDP/DTLS/SCTP webrtc-datachannel 3754 c=IN IP4 0.0.0.0 3755 a=mid:d1 3756 a=sctp-port:5000 3757 a=max-message-size:65536 3758 a=bundle-only 3760 |offer-B1-candidate-1| looks like: 3762 ufrag ATEn 3763 index 0 3764 mid a1 3765 attr candidate:1 1 udp 2113929471 203.0.113.100 10100 typ host 3767 |offer-B1-candidate-2| looks like: 3769 ufrag ATEn 3770 index 0 3771 mid a1 3772 attr candidate:1 1 udp 1845494015 198.51.100.100 11100 typ srflx 3773 raddr 203.0.113.100 rport 10100 3775 |offer-B1-candidate-3| looks like: 3777 ufrag ATEn 3778 index 0 3779 mid a1 3780 attr candidate:1 1 udp 255 192.0.2.100 12100 typ relay 3781 raddr 198.51.100.100 rport 11100 3783 The SDP for |answer-B1| looks like: 3785 v=0 3786 o=- 7729291447651054566 1 IN IP4 0.0.0.0 3787 s=- 3788 t=0 0 3789 a=ice-options:trickle 3790 a=group:BUNDLE a1 d1 3792 m=audio 9 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3793 c=IN IP4 0.0.0.0 3794 a=mid:a1 3795 a=sendrecv 3796 a=rtpmap:96 opus/48000/2 3797 a=rtpmap:0 PCMU/8000 3798 a=rtpmap:8 PCMA/8000 3799 a=rtpmap:97 telephone-event/8000 3800 a=rtpmap:98 telephone-event/48000 3801 a=fmtp:97 0-15 3802 a=fmtp:98 0-15 3803 a=maxptime:120 3804 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3805 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3806 a=msid:71317484-2ed4-49d7-9eb7-1414322a7aae 3807 6a7b57b8-f043-4bd1-a45d-09d4dfa31226 3808 a=ice-ufrag:7sFv 3809 a=ice-pwd:dOTZKZNVlO9RSGsEGM63JXT2 3810 a=fingerprint:sha-256 3811 7B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35: 3812 DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3813 a=setup:active 3814 a=tls-id:1 3815 a=rtcp-mux 3816 a=rtcp-mux-only 3817 a=rtcp-rsize 3819 m=application 9 UDP/DTLS/SCTP webrtc-datachannel 3820 c=IN IP4 0.0.0.0 3821 a=mid:d1 3822 a=sctp-port:5000 3823 a=max-message-size:65536 3825 |answer-B1-candidate-1| looks like: 3827 ufrag 7sFv 3828 index 0 3829 mid a1 3830 attr candidate:1 1 udp 2113929471 203.0.113.200 10200 typ host 3832 |answer-B1-candidate-2| looks like: 3834 ufrag 7sFv 3835 index 0 3836 mid a1 3837 attr candidate:1 1 udp 1845494015 198.51.100.200 11200 typ srflx 3838 raddr 203.0.113.200 rport 10200 3840 |answer-B1-candidate-3| looks like: 3842 ufrag 7sFv 3843 index 0 3844 mid a1 3845 attr candidate:1 1 udp 255 192.0.2.200 12200 typ relay 3846 raddr 198.51.100.200 rport 11200 3848 The SDP for |offer-B2| is shown below. In addition to the new m= 3849 sections for video, both of which are offering FEC, and one of which 3850 is offering simulcast, note the increment of the version number in 3851 the o= line, changes to the c= line, indicating the local candidate 3852 that was selected, and the inclusion of gathered candidates as 3853 a=candidate lines. 3855 v=0 3856 o=- 7729291447651054566 2 IN IP4 0.0.0.0 3857 s=- 3858 t=0 0 3859 a=ice-options:trickle 3860 a=group:BUNDLE a1 d1 v1 v2 3861 a=group:LS a1 v1 3863 m=audio 12200 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3864 c=IN IP4 192.0.2.200 3865 a=mid:a1 3866 a=sendrecv 3867 a=rtpmap:96 opus/48000/2 3868 a=rtpmap:0 PCMU/8000 3869 a=rtpmap:8 PCMA/8000 3870 a=rtpmap:97 telephone-event/8000 3871 a=rtpmap:98 telephone-event/48000 3872 a=fmtp:97 0-15 3873 a=fmtp:98 0-15 3874 a=maxptime:120 3875 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3876 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3877 a=msid:71317484-2ed4-49d7-9eb7-1414322a7aae 3878 6a7b57b8-f043-4bd1-a45d-09d4dfa31226 3879 a=ice-ufrag:7sFv 3880 a=ice-pwd:dOTZKZNVlO9RSGsEGM63JXT2 3881 a=fingerprint:sha-256 3882 7B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35: 3883 DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3884 a=setup:actpass 3885 a=tls-id:1 3886 a=rtcp-mux 3887 a=rtcp-mux-only 3888 a=rtcp-rsize 3889 a=candidate:1 1 udp 2113929471 203.0.113.200 10200 typ host 3890 a=candidate:1 1 udp 1845494015 198.51.100.200 11200 typ srflx 3891 raddr 203.0.113.200 rport 10200 3892 a=candidate:1 1 udp 255 192.0.2.200 12200 typ relay 3893 raddr 198.51.100.200 rport 11200 3894 a=end-of-candidates 3896 m=application 12200 UDP/DTLS/SCTP webrtc-datachannel 3897 c=IN IP4 192.0.2.200 3898 a=mid:d1 3899 a=sctp-port:5000 3900 a=max-message-size:65536 3902 m=video 12200 UDP/TLS/RTP/SAVPF 100 101 102 103 104 3903 c=IN IP4 192.0.2.200 3904 a=mid:v1 3905 a=sendrecv 3906 a=rtpmap:100 VP8/90000 3907 a=rtpmap:101 H264/90000 3908 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 3909 a=rtpmap:102 rtx/90000 3910 a=fmtp:102 apt=100 3911 =rtpmap:103 rtx/90000 3912 a=fmtp:103 apt=101 3913 a=rtpmap:104 flexfec/90000 3914 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3915 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 3916 a=rtcp-fb:100 ccm fir 3917 a=rtcp-fb:100 nack 3918 a=rtcp-fb:100 nack pli 3919 a=msid:71317484-2ed4-49d7-9eb7-1414322a7aae 3920 5ea4d4a1-2fda-4511-a9cc-1b32c2e59552 3921 a=rid:1 send 3922 a=rid:2 send 3923 a=rid:3 send 3924 a=simulcast:send 1;2;3 3926 m=video 12200 UDP/TLS/RTP/SAVPF 100 101 102 103 104 3927 c=IN IP4 192.0.2.200 3928 a=mid:v2 3929 a=sendrecv 3930 a=rtpmap:100 VP8/90000 3931 a=rtpmap:101 H264/90000 3932 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 3933 a=rtpmap:102 rtx/90000 3934 a=fmtp:102 apt=100 3935 =rtpmap:103 rtx/90000 3936 a=fmtp:103 apt=101 3937 a=rtpmap:104 flexfec/90000 3938 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3939 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 3940 a=rtcp-fb:100 ccm fir 3941 a=rtcp-fb:100 nack 3942 a=rtcp-fb:100 nack pli 3943 a=msid:81317484-2ed4-49d7-9eb7-1414322a7aae 3944 6ea4d4a1-2fda-4511-a9cc-1b32c2e59552 3946 The SDP for |answer-B2| is shown below. In addition to the 3947 acceptance of the video m= sections, the use of a=recvonly to 3948 indicate one-way video, and the use of a=imageattr to limit the 3949 received resolution, note the use of setup:passive to maintain the 3950 existing DTLS roles. 3952 v=0 3953 o=- 4962303333179871723 2 IN IP4 0.0.0.0 3954 s=- 3955 t=0 0 3956 a=ice-options:trickle 3957 a=group:BUNDLE a1 d1 v1 v2 3958 a=group:LS a1 v1 3960 m=audio 12100 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3961 c=IN IP4 192.0.2.100 3962 a=mid:a1 3963 a=sendrecv 3964 a=rtpmap:96 opus/48000/2 3965 a=rtpmap:0 PCMU/8000 3966 a=rtpmap:8 PCMA/8000 3967 a=rtpmap:97 telephone-event/8000 3968 a=rtpmap:98 telephone-event/48000 3969 a=fmtp:97 0-15 3970 a=fmtp:98 0-15 3971 a=maxptime:120 3972 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3973 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3974 a=msid:57017fee-b6c1-4162-929c-a25110252400 3975 e83006c5-a0ff-4e0a-9ed9-d3e6747be7d9 3976 a=ice-ufrag:ATEn 3977 a=ice-pwd:AtSK0WpNtpUjkY4+86js7ZQl 3978 a=fingerprint:sha-256 3979 29:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04: 3980 BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3981 a=setup:passive 3982 a=tls-id:1 3983 a=rtcp-mux 3984 a=rtcp-mux-only 3985 a=rtcp-rsize 3986 a=candidate:1 1 udp 2113929471 203.0.113.100 10100 typ host 3987 a=candidate:1 1 udp 1845494015 198.51.100.100 11100 typ srflx 3988 raddr 203.0.113.100 rport 10100 3989 a=candidate:1 1 udp 255 192.0.2.100 12100 typ relay 3990 raddr 198.51.100.100 rport 11100 3991 a=end-of-candidates 3993 m=application 12100 UDP/DTLS/SCTP webrtc-datachannel 3994 c=IN IP4 192.0.2.100 3995 a=mid:d1 3996 a=sctp-port:5000 3997 a=max-message-size:65536 3999 m=video 12100 UDP/TLS/RTP/SAVPF 100 101 102 103 4000 c=IN IP4 192.0.2.100 4001 a=mid:v1 4002 a=recvonly 4003 a=rtpmap:100 VP8/90000 4004 a=rtpmap:101 H264/90000 4005 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 4006 a=rtpmap:102 rtx/90000 4007 a=fmtp:102 apt=100 4008 =rtpmap:103 rtx/90000 4009 a=fmtp:103 apt=101 4010 a=imageattr:100 recv [x=[48:1920],y=[48:1080],q=1.0] 4011 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4012 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 4013 a=rtcp-fb:100 ccm fir 4014 a=rtcp-fb:100 nack 4015 a=rtcp-fb:100 nack pli 4017 m=video 12100 UDP/TLS/RTP/SAVPF 100 101 102 103 4018 c=IN IP4 192.0.2.100 4019 a=mid:v2 4020 a=recvonly 4021 a=rtpmap:100 VP8/90000 4022 a=rtpmap:101 H264/90000 4023 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 4024 a=rtpmap:102 rtx/90000 4025 a=fmtp:102 apt=100 4026 =rtpmap:103 rtx/90000 4027 a=fmtp:103 apt=101 4028 a=imageattr:100 recv [x=[48:1920],y=[48:1080],q=1.0] 4029 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4030 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 4031 a=rtcp-fb:100 ccm fir 4032 a=rtcp-fb:100 nack 4033 a=rtcp-fb:100 nack pli 4035 7.3. Early Transport Warmup Example 4037 This example demonstrates the early warmup technique described in 4038 Section 4.1.8.1. Here, Alice's endpoint sends an offer to Bob's 4039 endpoint to start an audio/video call. Bob immediately responds with 4040 an answer that accepts the audio/video m= sections, but marks them as 4041 sendonly (from his perspective), meaning that Alice will not yet send 4042 media. This allows the JSEP implementation to start negotiating ICE 4043 and DTLS immediately. Bob's endpoint then prompts him to answer the 4044 call, and when he does, his endpoint sends a second offer which 4045 enables the audio and video m= sections, and thereby bidirectional 4046 media transmission. The advantage of such a flow is that as soon as 4047 the first answer is received, the implementation can proceed with ICE 4048 and DTLS negotiation and establish the session transport. If the 4049 transport setup completes before the second offer is sent, then media 4050 can be transmitted immediately by the callee immediately upon 4051 answering the call, minimizing perceived post-dial-delay. The second 4052 offer/answer exchange can also change the preferred codecs or other 4053 session parameters. 4055 This example also makes use of the "relay" ICE candidate policy 4056 described in Section 3.5.3 to minimize the ICE gathering and checking 4057 needed. 4059 // set up local media state 4060 AliceJS->AliceUA: create new PeerConnection with "relay" ICE policy 4061 AliceJS->AliceUA: addTrack with two tracks: audio and video 4062 AliceJS->AliceUA: createOffer to get |offer-C1| 4063 AliceJS->AliceUA: setLocalDescription with |offer-C1| 4065 // |offer-C1| is sent over signaling protocol to Bob 4066 AliceJS->WebServer: signaling with |offer-C1| 4067 WebServer->BobJS: signaling with |offer-C1| 4069 // |offer-C1| arrives at Bob 4070 BobJS->BobUA: create new PeerConnection with "relay" ICE policy 4071 BobJS->BobUA: setRemoteDescription with |offer-C1| 4072 BobUA->BobJS: ontrack events for audio and video 4074 // a relay candidate is sent to Bob 4075 AliceUA->AliceJS: onicecandidate (relay) |offer-C1-candidate-1| 4076 AliceJS->WebServer: signaling with |offer-C1-candidate-1| 4078 WebServer->BobJS: signaling with |offer-C1-candidate-1| 4079 BobJS->BobUA: addIceCandidate with |offer-C1-candidate-1| 4081 // Bob prepares an early answer to warmup the transport 4082 BobJS->BobUA: addTransceiver with null audio and video tracks 4083 BobJS->BobUA: transceiver.setDirection(sendonly) for both 4084 BobJS->BobUA: createAnswer 4085 BobJS->BobUA: setLocalDescription with answer 4087 // |answer-C1| is sent over signaling protocol to Alice 4088 BobJS->WebServer: signaling with |answer-C1| 4089 WebServer->AliceJS: signaling with |answer-C1| 4091 // |answer-C1| (sendonly) arrives at Alice 4092 AliceJS->AliceUA: setRemoteDescription with |answer-C1| 4093 AliceUA->AliceJS: ontrack events for audio and video 4095 // a relay candidate is sent to Alice 4096 BobUA->BobJS: onicecandidate (relay) |answer-B1-candidate-1| 4097 BobJS->WebServer: signaling with |answer-B1-candidate-1| 4099 WebServer->AliceJS: signaling with |answer-B1-candidate-1| 4100 AliceJS->AliceUA: addIceCandidate with |answer-B1-candidate-1| 4102 // ICE and DTLS establish while call is ringing 4104 // Bob accepts call, starts media, and sends new offer 4105 BobJS->BobUA: transceiver.setTrack with audio and video tracks 4106 BobUA->AliceUA: media sent from Bob to Alice 4107 BobJS->BobUA: transceiver.setDirection(sendrecv) for both 4108 transceivers 4109 BobJS->BobUA: createOffer 4110 BobJS->BobUA: setLocalDescription with offer 4112 // |offer-C2| is sent over signaling protocol to Alice 4113 BobJS->WebServer: signaling with |offer-C2| 4114 WebServer->AliceJS: signaling with |offer-C2| 4116 // |offer-C2| (sendrecv) arrives at Alice 4117 AliceJS->AliceUA: setRemoteDescription with |offer-C2| 4118 AliceJS->AliceUA: createAnswer 4119 AliceJS->AliceUA: setLocalDescription with |answer-C2| 4120 AliceUA->BobUA: media sent from Alice to Bob 4122 // |answer-C2| is sent over signaling protocol to Bob 4123 AliceJS->WebServer: signaling with |answer-C2| 4124 WebServer->BobJS: signaling with |answer-C2| 4125 BobJS->BobUA: setRemoteDescription with |answer-C2| 4127 The SDP for |offer-C1| looks like: 4129 v=0 4130 o=- 1070771854436052752 1 IN IP4 0.0.0.0 4131 s=- 4132 t=0 0 4133 a=ice-options:trickle 4134 a=group:BUNDLE a1 v1 4135 a=group:LS a1 v1 4137 m=audio 9 UDP/TLS/RTP/SAVPF 96 0 8 97 98 4138 c=IN IP4 0.0.0.0 4139 a=mid:a1 4140 a=sendrecv 4141 a=rtpmap:96 opus/48000/2 4142 a=rtpmap:0 PCMU/8000 4143 a=rtpmap:8 PCMA/8000 4144 a=rtpmap:97 telephone-event/8000 4145 a=rtpmap:98 telephone-event/48000 4146 a=fmtp:97 0-15 4147 a=fmtp:98 0-15 4148 a=maxptime:120 4149 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4150 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 4151 a=msid:bbce3ba6-abfc-ac63-d00a-e15b286f8fce 4152 e80098db-7159-3c06-229a-00df2a9b3dbc 4154 a=ice-ufrag:4ZcD 4155 a=ice-pwd:ZaaG6OG7tCn4J/lehAGz+HHD 4156 a=fingerprint:sha-256 4157 C4:68:F8:77:6A:44:F1:98:6D:7C:9F:47:EB:E3:34:A4: 4158 0A:AA:2D:49:08:28:70:2E:1F:AE:18:7D:4E:3E:66:BF 4159 a=setup:actpass 4160 a=tls-id:1 4161 a=rtcp-mux 4162 a=rtcp-mux-only 4163 a=rtcp-rsize 4165 m=video 0 UDP/TLS/RTP/SAVPF 100 101 102 103 4166 c=IN IP4 0.0.0.0 4167 a=mid:v1 4168 a=sendrecv 4169 a=rtpmap:100 VP8/90000 4170 a=rtpmap:101 H264/90000 4171 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 4172 a=rtpmap:102 rtx/90000 4173 a=fmtp:102 apt=100 4174 =rtpmap:103 rtx/90000 4175 a=fmtp:103 apt=101 4176 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4177 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 4178 a=rtcp-fb:100 ccm fir 4179 a=rtcp-fb:100 nack 4180 a=rtcp-fb:100 nack pli 4181 a=msid:bbce3ba6-abfc-ac63-d00a-e15b286f8fce 4182 ac701365-eb06-42df-cc93-7f22bc308789 4183 a=bundle-only 4185 |offer-C1-candidate-1| looks like: 4187 ufrag 4ZcD 4188 index 0 4189 mid a1 4190 attr candidate:1 1 udp 255 192.0.2.100 12100 typ relay 4191 raddr 0.0.0.0 rport 0 4193 The SDP for |answer-C1| looks like: 4195 v=0 4196 o=- 6386516489780559513 1 IN IP4 0.0.0.0 4197 s=- 4198 t=0 0 4199 a=ice-options:trickle 4200 a=group:BUNDLE a1 v1 4201 a=group:LS a1 v1 4203 m=audio 9 UDP/TLS/RTP/SAVPF 96 0 8 97 98 4204 c=IN IP4 0.0.0.0 4205 a=mid:a1 4206 a=sendonly 4207 a=rtpmap:96 opus/48000/2 4208 a=rtpmap:0 PCMU/8000 4209 a=rtpmap:8 PCMA/8000 4210 a=rtpmap:97 telephone-event/8000 4211 a=rtpmap:98 telephone-event/48000 4212 a=fmtp:97 0-15 4213 a=fmtp:98 0-15 4214 a=maxptime:120 4215 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4216 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 4217 a=msid:751f239e-4ae0-c549-aa3d-890de772998b 4218 04b5a445-82cc-c9e8-9ffe-c24d0ef4b0ff 4219 a=ice-ufrag:TpaA 4220 a=ice-pwd:t2Ouhc67y8JcCaYZxUUTgKw/ 4221 a=fingerprint:sha-256 4222 A2:F3:A5:6D:4C:8C:1E:B2:62:10:4A:F6:70:61:C4:FC: 4223 3C:E0:01:D6:F3:24:80:74:DA:7C:3E:50:18:7B:CE:4D 4224 a=setup:active 4225 a=tls-id:1 4226 a=rtcp-mux 4227 a=rtcp-mux-only 4228 a=rtcp-rsize 4230 m=video 9 UDP/TLS/RTP/SAVPF 100 101 102 103 4231 c=IN IP4 0.0.0.0 4232 a=mid:v1 4233 a=sendonly 4234 a=rtpmap:100 VP8/90000 4235 a=rtpmap:101 H264/90000 4236 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 4237 a=rtpmap:102 rtx/90000 4238 a=fmtp:102 apt=100 4239 =rtpmap:103 rtx/90000 4240 a=fmtp:103 apt=101 4241 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4242 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 4243 a=rtcp-fb:100 ccm fir 4244 a=rtcp-fb:100 nack 4245 a=rtcp-fb:100 nack pli 4246 a=msid:751f239e-4ae0-c549-aa3d-890de772998b 4247 39292672-c102-d075-f580-5826f31ca958 4249 |answer-C1-candidate-1| looks like: 4251 ufrag TpaA 4252 index 0 4253 mid a1 4254 attr candidate:1 1 udp 255 192.0.2.200 12200 typ relay 4255 raddr 0.0.0.0 rport 0 4257 The SDP for |offer-C2| looks like: 4259 v=0 4260 o=- 6386516489780559513 2 IN IP4 0.0.0.0 4261 s=- 4262 t=0 0 4263 a=ice-options:trickle 4264 a=group:BUNDLE a1 v1 4265 a=group:LS a1 v1 4267 m=audio 12200 UDP/TLS/RTP/SAVPF 96 0 8 97 98 4268 c=IN IP4 192.0.2.200 4269 a=mid:a1 4270 a=sendrecv 4271 a=rtpmap:96 opus/48000/2 4272 a=rtpmap:0 PCMU/8000 4273 a=rtpmap:8 PCMA/8000 4274 a=rtpmap:97 telephone-event/8000 4275 a=rtpmap:98 telephone-event/48000 4276 a=fmtp:97 0-15 4277 a=fmtp:98 0-15 4278 a=maxptime:120 4279 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4280 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 4281 a=msid:751f239e-4ae0-c549-aa3d-890de772998b 4282 04b5a445-82cc-c9e8-9ffe-c24d0ef4b0ff 4283 a=ice-ufrag:TpaA 4284 a=ice-pwd:t2Ouhc67y8JcCaYZxUUTgKw/ 4285 a=fingerprint:sha-256 4286 A2:F3:A5:6D:4C:8C:1E:B2:62:10:4A:F6:70:61:C4:FC: 4287 3C:E0:01:D6:F3:24:80:74:DA:7C:3E:50:18:7B:CE:4D 4288 a=setup:actpass 4289 a=tls-id:1 4290 a=rtcp-mux 4291 a=rtcp-mux-only 4292 a=rtcp-rsize 4293 a=candidate:1 1 udp 255 192.0.2.200 12200 typ relay 4294 raddr 0.0.0.0 rport 0 4295 a=end-of-candidates 4297 m=video 12200 UDP/TLS/RTP/SAVPF 100 101 102 103 4298 c=IN IP4 192.0.2.200 4299 a=mid:v1 4300 a=sendrecv 4301 a=rtpmap:100 VP8/90000 4302 a=rtpmap:101 H264/90000 4303 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 4304 a=rtpmap:102 rtx/90000 4305 a=fmtp:102 apt=100 4306 =rtpmap:103 rtx/90000 4307 a=fmtp:103 apt=101 4308 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4309 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 4310 a=rtcp-fb:100 ccm fir 4311 a=rtcp-fb:100 nack 4312 a=rtcp-fb:100 nack pli 4313 a=msid:751f239e-4ae0-c549-aa3d-890de772998b 4314 39292672-c102-d075-f580-5826f31ca958 4316 The SDP for |answer-C2| looks like: 4318 v=0 4319 o=- 1070771854436052752 2 IN IP4 0.0.0.0 4320 s=- 4321 t=0 0 4322 a=ice-options:trickle 4323 a=group:BUNDLE a1 v1 4324 a=group:LS a1 v1 4326 m=audio 12100 UDP/TLS/RTP/SAVPF 96 0 8 97 98 4327 c=IN IP4 192.0.2.100 4328 a=mid:a1 4329 a=sendrecv 4330 a=rtpmap:96 opus/48000/2 4331 a=rtpmap:0 PCMU/8000 4332 a=rtpmap:8 PCMA/8000 4333 a=rtpmap:97 telephone-event/8000 4334 a=rtpmap:98 telephone-event/48000 4335 a=fmtp:97 0-15 4336 a=fmtp:98 0-15 4337 a=maxptime:120 4338 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4339 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 4340 a=msid:bbce3ba6-abfc-ac63-d00a-e15b286f8fce 4341 e80098db-7159-3c06-229a-00df2a9b3dbc 4342 a=ice-ufrag:4ZcD 4343 a=ice-pwd:ZaaG6OG7tCn4J/lehAGz+HHD 4344 a=fingerprint:sha-256 4345 C4:68:F8:77:6A:44:F1:98:6D:7C:9F:47:EB:E3:34:A4: 4346 0A:AA:2D:49:08:28:70:2E:1F:AE:18:7D:4E:3E:66:BF 4347 a=setup:passive 4348 a=tls-id:1 4349 a=rtcp-mux 4350 a=rtcp-mux-only 4351 a=rtcp-rsize 4352 a=candidate:1 1 udp 255 192.0.2.100 12100 typ relay 4353 raddr 0.0.0.0 rport 0 4354 a=end-of-candidates 4356 m=video 12100 UDP/TLS/RTP/SAVPF 100 101 102 103 4357 c=IN IP4 192.0.2.100 4358 a=mid:v1 4359 a=sendrecv 4360 a=rtpmap:100 VP8/90000 4361 a=rtpmap:101 H264/90000 4362 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 4363 a=rtpmap:102 rtx/90000 4364 a=fmtp:102 apt=100 4365 =rtpmap:103 rtx/90000 4366 a=fmtp:103 apt=101 4367 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4368 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 4369 a=rtcp-fb:100 ccm fir 4370 a=rtcp-fb:100 nack 4371 a=rtcp-fb:100 nack pli 4372 a=msid:bbce3ba6-abfc-ac63-d00a-e15b286f8fce 4373 ac701365-eb06-42df-cc93-7f22bc308789 4375 8. Security Considerations 4377 The IETF has published separate documents 4378 [I-D.ietf-rtcweb-security-arch] [I-D.ietf-rtcweb-security] describing 4379 the security architecture for WebRTC as a whole. The remainder of 4380 this section describes security considerations for this document. 4382 While formally the JSEP interface is an API, it is better to think of 4383 it is an Internet protocol, with the application JavaScript being 4384 untrustworthy from the perspective of the JSEP implementation. Thus, 4385 the threat model of [RFC3552] applies. In particular, JavaScript can 4386 call the API in any order and with any inputs, including malicious 4387 ones. This is particularly relevant when we consider the SDP which 4388 is passed to setLocalDescription(). While correct API usage requires 4389 that the application pass in SDP which was derived from createOffer() 4390 or createAnswer(), there is no guarantee that applications do so. 4391 The JSEP implementation MUST be prepared for the JavaScript to pass 4392 in bogus data instead. 4394 Conversely, the application programmer needs to be aware that the 4395 JavaScript does not have complete control of endpoint behavior. One 4396 case that bears particular mention is that editing ICE candidates out 4397 of the SDP or suppressing trickled candidates does not have the 4398 expected behavior: implementations will still perform checks from 4399 those candidates even if they are not sent to the other side. Thus, 4400 for instance, it is not possible to prevent the remote peer from 4401 learning your public IP address by removing server reflexive 4402 candidates. Applications which wish to conceal their public IP 4403 address should instead configure the ICE agent to use only relay 4404 candidates. 4406 9. IANA Considerations 4408 This document requires no actions from IANA. 4410 10. Acknowledgements 4412 Harald Alvestrand, Taylor Brandstetter, Suhas Nandakumar, and Peter 4413 Thatcher provided significant text for this draft. Bernard Aboba, 4414 Adam Bergkvist, Dan Burnett, Ben Campbell, Alissa Cooper, Richard 4415 Ejzak, Stefan Hakansson, Ted Hardie, Christer Holmberg Andrew Hutton, 4416 Randell Jesup, Matthew Kaufman, Anant Narayanan, Adam Roach, Robert 4417 Sparks, Neil Stratford, Martin Thomson, Sean Turner, and Magnus 4418 Westerlund all provided valuable feedback on this proposal. 4420 11. References 4422 11.1. Normative References 4424 [I-D.ietf-avtext-rid] 4425 Roach, A., Nandakumar, S., and P. Thatcher, "RTP Stream 4426 Identifier Source Description (SDES)", draft-ietf-avtext- 4427 rid-09 (work in progress), October 2016. 4429 [I-D.ietf-ice-trickle] 4430 Ivov, E., Rescorla, E., Uberti, J., and P. Saint-Andre, 4431 "Trickle ICE: Incremental Provisioning of Candidates for 4432 the Interactive Connectivity Establishment (ICE) 4433 Protocol", draft-ietf-ice-trickle-13 (work in progress), 4434 July 2017. 4436 [I-D.ietf-mmusic-dtls-sdp] 4437 Holmberg, C. and R. Shpount, "Session Description Protocol 4438 (SDP) Offer/Answer Considerations for Datagram Transport 4439 Layer Security (DTLS) and Transport Layer Security (TLS)", 4440 draft-ietf-mmusic-dtls-sdp-29 (work in progress), August 4441 2017. 4443 [I-D.ietf-mmusic-msid] 4444 Alvestrand, H., "WebRTC MediaStream Identification in the 4445 Session Description Protocol", draft-ietf-mmusic-msid-16 4446 (work in progress), February 2017. 4448 [I-D.ietf-mmusic-mux-exclusive] 4449 Holmberg, C., "Indicating Exclusive Support of RTP/RTCP 4450 Multiplexing using SDP", draft-ietf-mmusic-mux- 4451 exclusive-12 (work in progress), May 2017. 4453 [I-D.ietf-mmusic-rid] 4454 Thatcher, P., Zanaty, M., Nandakumar, S., Burman, B., 4455 Roach, A., and B. Campen, "RTP Payload Format 4456 Restrictions", draft-ietf-mmusic-rid-11 (work in 4457 progress), July 2017. 4459 [I-D.ietf-mmusic-sctp-sdp] 4460 Holmberg, C., Shpount, R., Loreto, S., and G. Camarillo, 4461 "Session Description Protocol (SDP) Offer/Answer 4462 Procedures For Stream Control Transmission Protocol (SCTP) 4463 over Datagram Transport Layer Security (DTLS) Transport.", 4464 draft-ietf-mmusic-sctp-sdp-26 (work in progress), April 4465 2017. 4467 [I-D.ietf-mmusic-sdp-bundle-negotiation] 4468 Holmberg, C., Alvestrand, H., and C. Jennings, 4469 "Negotiating Media Multiplexing Using the Session 4470 Description Protocol (SDP)", draft-ietf-mmusic-sdp-bundle- 4471 negotiation-39 (work in progress), August 2017. 4473 [I-D.ietf-mmusic-sdp-mux-attributes] 4474 Nandakumar, S., "A Framework for SDP Attributes when 4475 Multiplexing", draft-ietf-mmusic-sdp-mux-attributes-16 4476 (work in progress), December 2016. 4478 [I-D.ietf-mmusic-sdp-simulcast] 4479 Burman, B., Westerlund, M., Nandakumar, S., and M. Zanaty, 4480 "Using Simulcast in SDP and RTP Sessions", draft-ietf- 4481 mmusic-sdp-simulcast-10 (work in progress), July 2017. 4483 [I-D.ietf-rtcweb-fec] 4484 Uberti, J., "WebRTC Forward Error Correction 4485 Requirements", draft-ietf-rtcweb-fec-06 (work in 4486 progress), July 2017. 4488 [I-D.ietf-rtcweb-rtp-usage] 4489 Perkins, C., Westerlund, M., and J. Ott, "Web Real-Time 4490 Communication (WebRTC): Media Transport and Use of RTP", 4491 draft-ietf-rtcweb-rtp-usage-26 (work in progress), March 4492 2016. 4494 [I-D.ietf-rtcweb-security] 4495 Rescorla, E., "Security Considerations for WebRTC", draft- 4496 ietf-rtcweb-security-08 (work in progress), February 2015. 4498 [I-D.ietf-rtcweb-security-arch] 4499 Rescorla, E., "WebRTC Security Architecture", draft-ietf- 4500 rtcweb-security-arch-12 (work in progress), June 2016. 4502 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 4503 Requirement Levels", BCP 14, RFC 2119, 4504 DOI 10.17487/RFC2119, March 1997, . 4507 [RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, 4508 A., Peterson, J., Sparks, R., Handley, M., and E. 4509 Schooler, "SIP: Session Initiation Protocol", RFC 3261, 4510 DOI 10.17487/RFC3261, June 2002, . 4513 [RFC3264] Rosenberg, J. and H. Schulzrinne, "An Offer/Answer Model 4514 with Session Description Protocol (SDP)", RFC 3264, 4515 DOI 10.17487/RFC3264, June 2002, . 4518 [RFC3552] Rescorla, E. and B. Korver, "Guidelines for Writing RFC 4519 Text on Security Considerations", BCP 72, RFC 3552, 4520 DOI 10.17487/RFC3552, July 2003, . 4523 [RFC3605] Huitema, C., "Real Time Control Protocol (RTCP) attribute 4524 in Session Description Protocol (SDP)", RFC 3605, 4525 DOI 10.17487/RFC3605, October 2003, . 4528 [RFC3711] Baugher, M., McGrew, D., Naslund, M., Carrara, E., and K. 4529 Norrman, "The Secure Real-time Transport Protocol (SRTP)", 4530 RFC 3711, DOI 10.17487/RFC3711, March 2004, 4531 . 4533 [RFC3890] Westerlund, M., "A Transport Independent Bandwidth 4534 Modifier for the Session Description Protocol (SDP)", 4535 RFC 3890, DOI 10.17487/RFC3890, September 2004, 4536 . 4538 [RFC4145] Yon, D. and G. Camarillo, "TCP-Based Media Transport in 4539 the Session Description Protocol (SDP)", RFC 4145, 4540 DOI 10.17487/RFC4145, September 2005, . 4543 [RFC4566] Handley, M., Jacobson, V., and C. Perkins, "SDP: Session 4544 Description Protocol", RFC 4566, DOI 10.17487/RFC4566, 4545 July 2006, . 4547 [RFC4585] Ott, J., Wenger, S., Sato, N., Burmeister, C., and J. Rey, 4548 "Extended RTP Profile for Real-time Transport Control 4549 Protocol (RTCP)-Based Feedback (RTP/AVPF)", RFC 4585, 4550 DOI 10.17487/RFC4585, July 2006, . 4553 [RFC5124] Ott, J. and E. Carrara, "Extended Secure RTP Profile for 4554 Real-time Transport Control Protocol (RTCP)-Based Feedback 4555 (RTP/SAVPF)", RFC 5124, DOI 10.17487/RFC5124, February 4556 2008, . 4558 [RFC5245] Rosenberg, J., "Interactive Connectivity Establishment 4559 (ICE): A Protocol for Network Address Translator (NAT) 4560 Traversal for Offer/Answer Protocols", RFC 5245, 4561 DOI 10.17487/RFC5245, April 2010, . 4564 [RFC5285] Singer, D. and H. Desineni, "A General Mechanism for RTP 4565 Header Extensions", RFC 5285, DOI 10.17487/RFC5285, July 4566 2008, . 4568 [RFC5761] Perkins, C. and M. Westerlund, "Multiplexing RTP Data and 4569 Control Packets on a Single Port", RFC 5761, 4570 DOI 10.17487/RFC5761, April 2010, . 4573 [RFC5888] Camarillo, G. and H. Schulzrinne, "The Session Description 4574 Protocol (SDP) Grouping Framework", RFC 5888, 4575 DOI 10.17487/RFC5888, June 2010, . 4578 [RFC6236] Johansson, I. and K. Jung, "Negotiation of Generic Image 4579 Attributes in the Session Description Protocol (SDP)", 4580 RFC 6236, DOI 10.17487/RFC6236, May 2011, 4581 . 4583 [RFC6347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 4584 Security Version 1.2", RFC 6347, DOI 10.17487/RFC6347, 4585 January 2012, . 4587 [RFC6716] Valin, JM., Vos, K., and T. Terriberry, "Definition of the 4588 Opus Audio Codec", RFC 6716, DOI 10.17487/RFC6716, 4589 September 2012, . 4591 [RFC6904] Lennox, J., "Encryption of Header Extensions in the Secure 4592 Real-time Transport Protocol (SRTP)", RFC 6904, 4593 DOI 10.17487/RFC6904, April 2013, . 4596 [RFC7160] Petit-Huguenin, M. and G. Zorn, Ed., "Support for Multiple 4597 Clock Rates in an RTP Session", RFC 7160, 4598 DOI 10.17487/RFC7160, April 2014, . 4601 [RFC7587] Spittka, J., Vos, K., and JM. Valin, "RTP Payload Format 4602 for the Opus Speech and Audio Codec", RFC 7587, 4603 DOI 10.17487/RFC7587, June 2015, . 4606 [RFC7742] Roach, A., "WebRTC Video Processing and Codec 4607 Requirements", RFC 7742, DOI 10.17487/RFC7742, March 2016, 4608 . 4610 [RFC7850] Nandakumar, S., "Registering Values of the SDP 'proto' 4611 Field for Transporting RTP Media over TCP under Various 4612 RTP Profiles", RFC 7850, DOI 10.17487/RFC7850, April 2016, 4613 . 4615 [RFC7874] Valin, JM. and C. Bran, "WebRTC Audio Codec and Processing 4616 Requirements", RFC 7874, DOI 10.17487/RFC7874, May 2016, 4617 . 4619 [RFC8108] Lennox, J., Westerlund, M., Wu, Q., and C. Perkins, 4620 "Sending Multiple RTP Streams in a Single RTP Session", 4621 RFC 8108, DOI 10.17487/RFC8108, March 2017, 4622 . 4624 [RFC8122] Lennox, J. and C. Holmberg, "Connection-Oriented Media 4625 Transport over the Transport Layer Security (TLS) Protocol 4626 in the Session Description Protocol (SDP)", RFC 8122, 4627 DOI 10.17487/RFC8122, March 2017, . 4630 11.2. Informative References 4632 [I-D.ietf-mmusic-trickle-ice-sip] 4633 Ivov, E., Stach, T., Marocco, E., and C. Holmberg, "A 4634 Session Initiation Protocol (SIP) usage for Trickle ICE", 4635 draft-ietf-mmusic-trickle-ice-sip-08 (work in progress), 4636 July 2017. 4638 [I-D.ietf-rtcweb-ip-handling] 4639 Uberti, J. and G. Shieh, "WebRTC IP Address Handling 4640 Requirements", draft-ietf-rtcweb-ip-handling-04 (work in 4641 progress), July 2017. 4643 [I-D.ietf-rtcweb-sdp] 4644 Nandakumar, S. and C. Jennings, "Annotated Example SDP for 4645 WebRTC", draft-ietf-rtcweb-sdp-06 (work in progress), 4646 April 2017. 4648 [RFC3389] Zopf, R., "Real-time Transport Protocol (RTP) Payload for 4649 Comfort Noise (CN)", RFC 3389, DOI 10.17487/RFC3389, 4650 September 2002, . 4652 [RFC3556] Casner, S., "Session Description Protocol (SDP) Bandwidth 4653 Modifiers for RTP Control Protocol (RTCP) Bandwidth", 4654 RFC 3556, DOI 10.17487/RFC3556, July 2003, 4655 . 4657 [RFC3960] Camarillo, G. and H. Schulzrinne, "Early Media and Ringing 4658 Tone Generation in the Session Initiation Protocol (SIP)", 4659 RFC 3960, DOI 10.17487/RFC3960, December 2004, 4660 . 4662 [RFC4568] Andreasen, F., Baugher, M., and D. Wing, "Session 4663 Description Protocol (SDP) Security Descriptions for Media 4664 Streams", RFC 4568, DOI 10.17487/RFC4568, July 2006, 4665 . 4667 [RFC4588] Rey, J., Leon, D., Miyazaki, A., Varsa, V., and R. 4668 Hakenberg, "RTP Retransmission Payload Format", RFC 4588, 4669 DOI 10.17487/RFC4588, July 2006, . 4672 [RFC4733] Schulzrinne, H. and T. Taylor, "RTP Payload for DTMF 4673 Digits, Telephony Tones, and Telephony Signals", RFC 4733, 4674 DOI 10.17487/RFC4733, December 2006, . 4677 [RFC5506] Johansson, I. and M. Westerlund, "Support for Reduced-Size 4678 Real-Time Transport Control Protocol (RTCP): Opportunities 4679 and Consequences", RFC 5506, DOI 10.17487/RFC5506, April 4680 2009, . 4682 [RFC5576] Lennox, J., Ott, J., and T. Schierl, "Source-Specific 4683 Media Attributes in the Session Description Protocol 4684 (SDP)", RFC 5576, DOI 10.17487/RFC5576, June 2009, 4685 . 4687 [RFC5763] Fischl, J., Tschofenig, H., and E. Rescorla, "Framework 4688 for Establishing a Secure Real-time Transport Protocol 4689 (SRTP) Security Context Using Datagram Transport Layer 4690 Security (DTLS)", RFC 5763, DOI 10.17487/RFC5763, May 4691 2010, . 4693 [RFC5764] McGrew, D. and E. Rescorla, "Datagram Transport Layer 4694 Security (DTLS) Extension to Establish Keys for the Secure 4695 Real-time Transport Protocol (SRTP)", RFC 5764, 4696 DOI 10.17487/RFC5764, May 2010, . 4699 [RFC6464] Lennox, J., Ed., Ivov, E., and E. Marocco, "A Real-time 4700 Transport Protocol (RTP) Header Extension for Client-to- 4701 Mixer Audio Level Indication", RFC 6464, 4702 DOI 10.17487/RFC6464, December 2011, . 4705 [RFC6544] Rosenberg, J., Keranen, A., Lowekamp, B., and A. Roach, 4706 "TCP Candidates with Interactive Connectivity 4707 Establishment (ICE)", RFC 6544, DOI 10.17487/RFC6544, 4708 March 2012, . 4710 [TS26.114] 4711 3GPP TS 26.114 V12.8.0, "3rd Generation Partnership 4712 Project; Technical Specification Group Services and System 4713 Aspects; IP Multimedia Subsystem (IMS); Multimedia 4714 Telephony; Media handling and interaction (Release 12)", 4715 December 2014, . 4717 [W3C.webrtc] 4718 Bergkvist, A., Burnett, D., Jennings, C., Narayanan, A., 4719 Aboba, B., and T. Brandstetter, "WebRTC 1.0: Real-time 4720 Communication Between Browsers", World Wide Web Consortium 4721 WD WD-webrtc-20170515, May 2017, 4722 . 4724 Appendix A. Appendix A 4726 For the syntax validation performed in Section 5.8, the following 4727 list of ABNF definitions is used: 4729 +------------------------+------------------------------------------+ 4730 | Attribute | Reference | 4731 +------------------------+------------------------------------------+ 4732 | ptime | [RFC4566] Section 9 | 4733 | maxptime | [RFC4566] Section 9 | 4734 | rtpmap | [RFC4566] Section 9 | 4735 | recvonly | [RFC4566] Section 9 | 4736 | sendrecv | [RFC4566] Section 9 | 4737 | sendonly | [RFC4566] Section 9 | 4738 | inactive | [RFC4566] Section 9 | 4739 | framerate | [RFC4566] Section 9 | 4740 | fmtp | [RFC4566] Section 9 | 4741 | quality | [RFC4566] Section 9 | 4742 | rtcp | [RFC3605] Section 2.1 | 4743 | setup | [RFC4145] Sections 3, 4, and 5 | 4744 | connection | [RFC4145] Sections 3, 4, and 5 | 4745 | fingerprint | [RFC8122] Section 5 | 4746 | rtcp-fb | [RFC4585] Section 4.2 | 4747 | candidate | [RFC5245] Section 15.1 | 4748 | remote-candidates | [RFC5245] Section 15.2 | 4749 | ice-lite | [RFC5245] Section 15.3 | 4750 | ice-ufrag | [RFC5245] Section 15.4 | 4751 | ice-pwd | [RFC5245] Section 15.4 | 4752 | ice-options | [RFC5245] Section 15.5 | 4753 | extmap | [RFC5285] Section 7 | 4754 | mid | [RFC5888] Sections 4 and 5 | 4755 | group | [RFC5888] Sections 4 and 5 | 4756 | imageattr | [RFC6236] Section 3.1 | 4757 | extmap (encrypt | [RFC6904] Section 4 | 4758 | option) | | 4759 | msid | [I-D.ietf-mmusic-msid] Section 2 | 4760 | rid | [I-D.ietf-mmusic-rid] Section 10 | 4761 | simulcast | [I-D.ietf-mmusic-sdp-simulcast] Section | 4762 | | 6.1 | 4763 | tls-id | [I-D.ietf-mmusic-dtls-sdp] Section 4 | 4764 +------------------------+------------------------------------------+ 4766 Table 1: SDP ABNF References 4768 Appendix B. Change log 4770 Note to RFC Editor: Please remove this section before publication. 4772 Changes in draft-23: 4774 o Clarify rollback handling, and treat it similarly to other 4775 setLocal/setRemote usages. 4777 o Adopt a first-fit policy for handling multiple remote a=imageattr 4778 attributes. 4780 o Clarify that a session description with zero m= sections is legal. 4782 Changes in draft-22: 4784 o Clarify currentDirection versus direction. 4786 o Correct session-id text so that it aligns with RFC 3264. 4788 o Clarify that generated ICE candidate objects must have all four 4789 fields. 4791 o Make rollback work from any state besides stable and regardless of 4792 whether setLocalDescription or setRemoteDescription is used. 4794 o Allow modifying SDP before sending or after receiving either 4795 offers or answers (previously this was forbidden for answers). 4797 o Provide rationale for several design choices. 4799 Changes in draft-21: 4801 o Change dtls-id to tls-id to match MMUSIC draft. 4803 o Replace regular expression for proto field with a list and clarify 4804 that the answer must exactly match the offer. 4806 o Remove text about how to error check on setLocal because local 4807 descriptions cannot be changed. 4809 o Rework silence suppression support to always require that both 4810 sides agree to silence suppression or none is used. 4812 o Remove instructions to parse "a=ssrc-group". 4814 o Allow the addition of new codecs in answers and in subsequent 4815 offers. 4817 o Clarify imageattr processing. Replace use of [x=0,y=0] with 4818 direction indicators. 4820 o Document when early media can occur. 4822 o Fix ICE default port handling when bundle-only is used. 4824 o Forbid duplicating IDENTICAL/TRANSPORT attributes when you are 4825 bundling. 4827 o Clarify the number of components to gather when bundle is 4828 involved. 4830 o Explicitly state that PTs and SSRCs are to be used for demuxing. 4832 o Update guidance on "a=setup" line. This should now match the 4833 MMUSIC draft. 4835 o Update guidance on certificate/digest matching to conform to 4836 RFC8122. 4838 o Update examples. 4840 Changes in draft-20: 4842 o Remove Appendix-B. 4844 Changes in draft-19: 4846 o Examples are now machine-generated for correctness, and use IETF- 4847 approved example IP addresses. 4849 o Add early transport warmup example, and add missing attributes to 4850 existing examples. 4852 o Only send "a=rtcp-mux-only" and "a=bundle-only" on new m= 4853 sections. 4855 o Update references. 4857 o Add coverage of a=identity. 4859 o Explain the lipsync group algorithm more thoroughly. 4861 o Remove unnecessary list of MTI specs. 4863 o Allow codecs which weren't offered to appear in answers and which 4864 weren't selected to appear in subsequent offers. 4866 o Codec preferences now are applied on both initial and subsequent 4867 offers and answers. 4869 o Clarify a=msid handling for recvonly m= sections. 4871 o Clarify behavior of attributes for bundle-only data channels. 4873 o Allow media attributes to appear in data m= sections when all the 4874 media m= sections are bundle-only. 4876 o Use consistent terminology for JSEP implementations. 4878 o Describe how to handle failed API calls. 4880 o Some cleanup on routing rules. 4882 Changes in draft-18: 4884 o Update demux algorithm and move it to an appendix in preparation 4885 for merging it into BUNDLE. 4887 o Clarify why we can't handle an incoming offer to send simulcast. 4889 o Expand IceCandidate object text. 4891 o Further document use of ICE candidate pool. 4893 o Document removeTrack. 4895 o Update requirements to only accept the last generated offer/answer 4896 as an argument to setLocalDescription. 4898 o Allow round pixels. 4900 o Fix code around default timing when AVPF is not specified. 4902 o Clean up terminology around m= line and m=section. 4904 o Provide a more realistic example for minimum decoder capabilities. 4906 o Document behavior when rtcp-mux policy is require but rtcp-mux 4907 attribute not provided. 4909 o Expanded discussion of RtpSender and RtpReceiver. 4911 o Add RtpTransceiver.currentDirection and document setDirection. 4913 o Require imageattr x=0, y=0 to indicate that there are no valid 4914 resolutions. 4916 o Require a privacy-preserving MID/RID construction. 4918 o Require support for RFC 3556 bandwidth modifiers. 4920 o Update maxptime description. 4922 o Note that endpoints may encounter extra codecs in answers and 4923 subsequent offers from non-JSEP peers. 4925 o Update references. 4927 Changes in draft-17: 4929 o Split createOffer and createAnswer sections to clearly indicate 4930 attributes which always appear and which only appear when not 4931 bundled into another m= section. 4933 o Add descriptions of RtpTransceiver methods. 4935 o Describe how to process RTCP feedback attributes. 4937 o Clarify transceiver directions and their interaction with 3264. 4939 o Describe setCodecPreferences. 4941 o Update RTP demux algorithm. Include RTCP. 4943 o Update requirements for when a=rtcp is included, limiting to cases 4944 where it is needed for backward compatibility. 4946 o Clarify SAR handling. 4948 o Updated addTrack matching algorithm. 4950 o Remove a=ssrc requirements. 4952 o Handle a=setup in reoffers. 4954 o Discuss how RTX/FEC should be handled. 4956 o Discuss how telephone-event should be handled. 4958 o Discuss how CN/DTX should be handled. 4960 o Add missing references to ABNF table. 4962 Changes in draft-16: 4964 o Update addIceCandidate to indicate ICE generation and allow per-m= 4965 section end-of-candidates. 4967 o Update fingerprint handling to use draft-ietf-mmusic-4572-update. 4969 o Update text around SDP processing of RTP header extensions and 4970 payload formats. 4972 o Add sections on simulcast, addTransceiver, and createDataChannel. 4974 o Clarify text to ensure that the session ID is a positive 63 bit 4975 integer. 4977 o Clarify SDP processing for direction indication. 4979 o Describe SDP processing for rtcp-mux-only. 4981 o Specify how SDP session version in o= line. 4983 o Require that when doing an re-offer, the capabilities of the new 4984 session are mostly required to be a subset of the previously 4985 negotiated session. 4987 o Clarified ICE restart interaction with bundle-only. 4989 o Remove support for changing SDP before calling 4990 setLocalDescription. 4992 o Specify algorithm for demuxing RTP based on MID, PT, and SSRC. 4994 o Clarify rules for rejecting m= lines when bundle policy is 4995 balanced or max-bundle. 4997 Changes in draft-15: 4999 o Clarify text around codecs offered in subsequent transactions to 5000 refer to what's been negotiated. 5002 o Rewrite LS handling text to indicate edge cases and that we're 5003 living with them. 5005 o Require that answerer reject m= lines when there are no codecs in 5006 common. 5008 o Enforce max-bundle on offer processing. 5010 o Fix TIAS formula to handle bits vs. kilobits. 5012 o Describe addTrack algorithm. 5014 o Clean up references. 5016 Changes in draft-14: 5018 o Added discussion of RtpTransceivers + RtpSenders + RtpReceivers, 5019 and how they interact with createOffer/createAnswer. 5021 o Removed obsolete OfferToReceiveX options. 5023 o Explained how addIceCandidate can be used for end-of-candidates. 5025 Changes in draft-13: 5027 o Clarified which SDP lines can be ignored. 5029 o Clarified how to handle various received attributes. 5031 o Revised how attributes should be generated for bundled m= lines. 5033 o Remove unused references. 5035 o Remove text advocating use of unilateral PTs. 5037 o Trigger an ICE restart even if the ICE candidate policy is being 5038 made more strict. 5040 o Remove the 'public' ICE candidate policy. 5042 o Move open issues into GitHub issues. 5044 o Split local/remote description accessors into current/pending. 5046 o Clarify a=imageattr handling. 5048 o Add more detail on VoiceActivityDetection handling. 5050 o Reference draft-shieh-rtcweb-ip-handling. 5052 o Make it clear when an ICE restart should occur. 5054 o Resolve changes needed in references. 5056 o Remove MSID semantics. 5058 o ice-options are now at session level. 5060 o Default RTCP mux policy is now 'require'. 5062 Changes in draft-12: 5064 o Filled in sections on applying local and remote descriptions. 5066 o Discussed downscaling and upscaling to fulfill imageattr 5067 requirements. 5069 o Updated what SDP can be modified by the application. 5071 o Updated to latest datachannel SDP. 5073 o Allowed multiple fingerprint lines. 5075 o Switched back to IPv4 for dummy candidates. 5077 o Added additional clarity on ICE default candidates. 5079 Changes in draft-11: 5081 o Clarified handling of RTP CNAMEs. 5083 o Updated what SDP lines should be processed or ignored. 5085 o Specified how a=imageattr should be used. 5087 Changes in draft-10: 5089 o Described video size negotiation with imageattr. 5091 o Clarified rejection of sections that do not have mux-only. 5093 o Add handling of LS groups 5095 Changes in draft-09: 5097 o Don't return null for {local,remote}Description after close(). 5099 o Changed TCP/TLS to UDP/DTLS in RTP profile names. 5101 o Separate out bundle and mux policy. 5103 o Added specific references to FEC mechanisms. 5105 o Added canTrickle mechanism. 5107 o Added section on subsequent answers and, answer options. 5109 o Added text defining set{Local,Remote}Description behavior. 5111 Changes in draft-08: 5113 o Added new example section and removed old examples in appendix. 5115 o Fixed field handling. 5117 o Added text describing a=rtcp attribute. 5119 o Reworked handling of OfferToReceiveAudio and OfferToReceiveVideo 5120 per discussion at IETF 90. 5122 o Reworked trickle ICE handling and its impact on m= and c= lines 5123 per discussion at interim. 5125 o Added max-bundle-and-rtcp-mux policy. 5127 o Added description of maxptime handling. 5129 o Updated ICE candidate pool default to 0. 5131 o Resolved open issues around AppID/receiver-ID. 5133 o Reworked and expanded how changes to the ICE configuration are 5134 handled. 5136 o Some reference updates. 5138 o Editorial clarification. 5140 Changes in draft-07: 5142 o Expanded discussion of VAD and Opus DTX. 5144 o Added a security considerations section. 5146 o Rewrote the section on modifying SDP to require implementations to 5147 clearly indicate whether any given modification is allowed. 5149 o Clarified impact of IceRestart on CreateOffer in local-offer 5150 state. 5152 o Guidance on whether attributes should be defined at the media 5153 level or the session level. 5155 o Renamed "default" bundle policy to "balanced". 5157 o Removed default ICE candidate pool size and clarify how it works. 5159 o Defined a canonical order for assignment of MSTs to m= lines. 5161 o Removed discussion of rehydration. 5163 o Added Eric Rescorla as a draft editor. 5165 o Cleaned up references. 5167 o Editorial cleanup 5169 Changes in draft-06: 5171 o Reworked handling of m= line recycling. 5173 o Added handling of BUNDLE and bundle-only. 5175 o Clarified handling of rollback. 5177 o Added text describing the ICE Candidate Pool and its behavior. 5179 o Allowed OfferToReceiveX to create multiple recvonly m= sections. 5181 Changes in draft-05: 5183 o Fixed several issues identified in the createOffer/Answer sections 5184 during document review. 5186 o Updated references. 5188 Changes in draft-04: 5190 o Filled in sections on createOffer and createAnswer. 5192 o Added SDP examples. 5194 o Fixed references. 5196 Changes in draft-03: 5198 o Added text describing relationship to W3C specification 5200 Changes in draft-02: 5202 o Converted from nroff 5204 o Removed comparisons to old approaches abandoned by the working 5205 group 5207 o Removed stuff that has moved to W3C specification 5209 o Align SDP handling with W3C draft 5210 o Clarified section on forking. 5212 Changes in draft-01: 5214 o Added diagrams for architecture and state machine. 5216 o Added sections on forking and rehydration. 5218 o Clarified meaning of "pranswer" and "answer". 5220 o Reworked how ICE restarts and media directions are controlled. 5222 o Added list of parameters that can be changed in a description. 5224 o Updated suggested API and examples to match latest thinking. 5226 o Suggested API and examples have been moved to an appendix. 5228 Changes in draft -00: 5230 o Migrated from draft-uberti-rtcweb-jsep-02. 5232 Authors' Addresses 5234 Justin Uberti 5235 Google 5236 747 6th St S 5237 Kirkland, WA 98033 5238 USA 5240 Email: justin@uberti.name 5242 Cullen Jennings 5243 Cisco 5244 400 3rd Avenue SW 5245 Calgary, AB T2P 4H2 5246 Canada 5248 Email: fluffy@iii.ca 5249 Eric Rescorla (editor) 5250 Mozilla 5251 331 Evelyn Ave 5252 Mountain View, CA 94041 5253 USA 5255 Email: ekr@rtfm.com