idnits 2.17.1 draft-ietf-rtcweb-jsep-22.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 3749 has weird spacing: '... mid a1...' == Line 3750 has weird spacing: '... attr candi...' == Line 3756 has weird spacing: '... mid a1...' == Line 3757 has weird spacing: '... attr candi...' == Line 3764 has weird spacing: '... mid a1...' == (11 more instances...) -- The document date (August 25, 2017) is 2436 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-28 == 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-38 == 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: February 26, 2018 Cisco 6 E. Rescorla, Ed. 7 Mozilla 8 August 25, 2017 10 JavaScript Session Establishment Protocol 11 draft-ietf-rtcweb-jsep-22 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 February 26, 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 an imageattr Attribute . . . . . . . . . 17 75 3.7. Simulcast . . . . . . . . . . . . . . . . . . . . . . . . 18 76 3.8. Interactions With Forking . . . . . . . . . . . . . . . . 20 77 3.8.1. Sequential Forking . . . . . . . . . . . . . . . . . 20 78 3.8.2. Parallel Forking . . . . . . . . . . . . . . . . . . 21 79 4. Interface . . . . . . . . . . . . . . . . . . . . . . . . . . 21 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 . . . . . . . . . . . 27 90 4.1.8.2. Rollback . . . . . . . . . . . . . . . . . . . . 28 91 4.1.9. setLocalDescription . . . . . . . . . . . . . . . . . 29 92 4.1.10. setRemoteDescription . . . . . . . . . . . . . . . . 30 93 4.1.11. currentLocalDescription . . . . . . . . . . . . . . . 30 94 4.1.12. pendingLocalDescription . . . . . . . . . . . . . . . 31 95 4.1.13. currentRemoteDescription . . . . . . . . . . . . . . 31 96 4.1.14. pendingRemoteDescription . . . . . . . . . . . . . . 31 97 4.1.15. canTrickleIceCandidates . . . . . . . . . . . . . . . 31 98 4.1.16. setConfiguration . . . . . . . . . . . . . . . . . . 32 99 4.1.17. addIceCandidate . . . . . . . . . . . . . . . . . . . 33 100 4.2. RtpTransceiver . . . . . . . . . . . . . . . . . . . . . 33 101 4.2.1. stop . . . . . . . . . . . . . . . . . . . . . . . . 33 102 4.2.2. stopped . . . . . . . . . . . . . . . . . . . . . . . 33 103 4.2.3. setDirection . . . . . . . . . . . . . . . . . . . . 34 104 4.2.4. direction . . . . . . . . . . . . . . . . . . . . . . 34 105 4.2.5. currentDirection . . . . . . . . . . . . . . . . . . 34 106 4.2.6. setCodecPreferences . . . . . . . . . . . . . . . . . 34 107 5. SDP Interaction Procedures . . . . . . . . . . . . . . . . . 35 108 5.1. Requirements Overview . . . . . . . . . . . . . . . . . . 35 109 5.1.1. Usage Requirements . . . . . . . . . . . . . . . . . 35 110 5.1.2. Profile Names and Interoperability . . . . . . . . . 36 111 5.2. Constructing an Offer . . . . . . . . . . . . . . . . . . 37 112 5.2.1. Initial Offers . . . . . . . . . . . . . . . . . . . 37 113 5.2.2. Subsequent Offers . . . . . . . . . . . . . . . . . . 44 114 5.2.3. Options Handling . . . . . . . . . . . . . . . . . . 47 115 5.2.3.1. IceRestart . . . . . . . . . . . . . . . . . . . 48 116 5.2.3.2. VoiceActivityDetection . . . . . . . . . . . . . 48 117 5.3. Generating an Answer . . . . . . . . . . . . . . . . . . 49 118 5.3.1. Initial Answers . . . . . . . . . . . . . . . . . . . 49 119 5.3.2. Subsequent Answers . . . . . . . . . . . . . . . . . 55 120 5.3.3. Options Handling . . . . . . . . . . . . . . . . . . 56 121 5.3.3.1. VoiceActivityDetection . . . . . . . . . . . . . 57 122 5.4. Modifying an Offer or Answer . . . . . . . . . . . . . . 57 123 5.5. Processing a Local Description . . . . . . . . . . . . . 57 124 5.6. Processing a Remote Description . . . . . . . . . . . . . 58 125 5.7. Parsing a Session Description . . . . . . . . . . . . . . 59 126 5.7.1. Session-Level Parsing . . . . . . . . . . . . . . . . 59 127 5.7.2. Media Section Parsing . . . . . . . . . . . . . . . . 61 128 5.7.3. Semantics Verification . . . . . . . . . . . . . . . 63 129 5.8. Applying a Local Description . . . . . . . . . . . . . . 65 130 5.9. Applying a Remote Description . . . . . . . . . . . . . . 66 131 5.10. Applying an Answer . . . . . . . . . . . . . . . . . . . 70 132 6. Processing RTP/RTCP . . . . . . . . . . . . . . . . . . . . . 73 133 7. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 73 134 7.1. Simple Example . . . . . . . . . . . . . . . . . . . . . 73 135 7.2. Detailed Example . . . . . . . . . . . . . . . . . . . . 77 136 7.3. Early Transport Warmup Example . . . . . . . . . . . . . 87 137 8. Security Considerations . . . . . . . . . . . . . . . . . . . 94 138 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 95 139 10. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 95 140 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 95 141 11.1. Normative References . . . . . . . . . . . . . . . . . . 95 142 11.2. Informative References . . . . . . . . . . . . . . . . . 100 143 Appendix A. Appendix A . . . . . . . . . . . . . . . . . . . . . 102 144 Appendix B. Change log . . . . . . . . . . . . . . . . . . . . . 103 145 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 113 147 1. Introduction 149 This document describes how the W3C WEBRTC RTCPeerConnection 150 interface [W3C.webrtc] is used to control the setup, management and 151 teardown of a multimedia session. 153 1.1. General Design of JSEP 155 WebRTC call setup has been designed to focus on controlling the media 156 plane, leaving signaling plane behavior up to the application as much 157 as possible. The rationale is that different applications may prefer 158 to use different protocols, such as the existing SIP call signaling 159 protocol, or something custom to the particular application, perhaps 160 for a novel use case. In this approach, the key information that 161 needs to be exchanged is the multimedia session description, which 162 specifies the necessary transport and media configuration information 163 necessary to establish the media plane. 165 With these considerations in mind, this document describes the 166 JavaScript Session Establishment Protocol (JSEP) that allows for full 167 control of the signaling state machine from JavaScript. As described 168 above, JSEP assumes a model in which a JavaScript application 169 executes inside a runtime containing WebRTC APIs (the "JSEP 170 implementation"). The JSEP implementation is almost entirely 171 divorced from the core signaling flow, which is instead handled by 172 the JavaScript making use of two interfaces: (1) passing in local and 173 remote session descriptions and (2) interacting with the ICE state 174 machine. The combination of the JSEP implementation and the 175 JavaScript application is referred to throughout this document as a 176 "JSEP endpoint". 178 In this document, the use of JSEP is described as if it always occurs 179 between two JSEP endpoints. Note though in many cases it will 180 actually be between a JSEP endpoint and some kind of server, such as 181 a gateway or MCU. This distinction is invisible to the JSEP 182 endpoint; it just follows the instructions it is given via the API. 184 JSEP's handling of session descriptions is simple and 185 straightforward. Whenever an offer/answer exchange is needed, the 186 initiating side creates an offer by calling a createOffer() API. The 187 application then uses that offer to set up its local config via the 188 setLocalDescription() API. The offer is finally sent off to the 189 remote side over its preferred signaling mechanism (e.g., 190 WebSockets); upon receipt of that offer, the remote party installs it 191 using the setRemoteDescription() API. 193 To complete the offer/answer exchange, the remote party uses the 194 createAnswer() API to generate an appropriate answer, applies it 195 using the setLocalDescription() API, and sends the answer back to the 196 initiator over the signaling channel. When the initiator gets that 197 answer, it installs it using the setRemoteDescription() API, and 198 initial setup is complete. This process can be repeated for 199 additional offer/answer exchanges. 201 Regarding ICE [RFC5245], JSEP decouples the ICE state machine from 202 the overall signaling state machine, as the ICE state machine must 203 remain in the JSEP implementation, because only the implementation 204 has the necessary knowledge of candidates and other transport 205 information. Performing this separation provides additional 206 flexibility in protocols that decouple session descriptions from 207 transport. For instance, in traditional SIP, each offer or answer is 208 self-contained, including both the session descriptions and the 209 transport information. However, [I-D.ietf-mmusic-trickle-ice-sip] 210 allows SIP to be used with trickle ICE [I-D.ietf-ice-trickle], in 211 which the session description can be sent immediately and the 212 transport information can be sent when available. Sending transport 213 information separately can allow for faster ICE and DTLS startup, 214 since ICE checks can start as soon as any transport information is 215 available rather than waiting for all of it. JSEP's decoupling of 216 the ICE and signaling state machines allows it to accommodate either 217 model. 219 Through its abstraction of signaling, the JSEP approach does require 220 the application to be aware of the signaling process. While the 221 application does not need to understand the contents of session 222 descriptions to set up a call, the application must call the right 223 APIs at the right times, convert the session descriptions and ICE 224 information into the defined messages of its chosen signaling 225 protocol, and perform the reverse conversion on the messages it 226 receives from the other side. 228 One way to make life easier for the application is to provide a 229 JavaScript library that hides this complexity from the developer; 230 said library would implement a given signaling protocol along with 231 its state machine and serialization code, presenting a higher level 232 call-oriented interface to the application developer. For example, 233 libraries exist to adapt the JSEP API into an API suitable for a SIP 234 or XMPP. Thus, JSEP provides greater control for the experienced 235 developer without forcing any additional complexity on the novice 236 developer. 238 1.2. Other Approaches Considered 240 One approach that was considered instead of JSEP was to include a 241 lightweight signaling protocol. Instead of providing session 242 descriptions to the API, the API would produce and consume messages 243 from this protocol. While providing a more high-level API, this put 244 more control of signaling within the JSEP implementation, forcing it 245 to have to understand and handle concepts like signaling glare (see 246 [RFC3264], Section 4). 248 A second approach that was considered but not chosen was to decouple 249 the management of the media control objects from session 250 descriptions, instead offering APIs that would control each component 251 directly. This was rejected based on the argument that requiring 252 exposure of this level of complexity to the application programmer 253 would not be beneficial; it would result in an API where even a 254 simple example would require a significant amount of code to 255 orchestrate all the needed interactions, as well as creating a large 256 API surface that needed to be agreed upon and documented. In 257 addition, these API points could be called in any order, resulting in 258 a more complex set of interactions with the media subsystem than the 259 JSEP approach, which specifies how session descriptions are to be 260 evaluated and applied. 262 One variation on JSEP that was considered was to keep the basic 263 session description-oriented API, but to move the mechanism for 264 generating offers and answers out of the JSEP implementation. 265 Instead of providing createOffer/createAnswer methods within the 266 implementation, this approach would instead expose a getCapabilities 267 API which would provide the application with the information it 268 needed in order to generate its own session descriptions. This 269 increases the amount of work that the application needs to do; it 270 needs to know how to generate session descriptions from capabilities, 271 and especially how to generate the correct answer from an arbitrary 272 offer and the supported capabilities. While this could certainly be 273 addressed by using a library like the one mentioned above, it 274 basically forces the use of said library even for a simple example. 275 Providing createOffer/createAnswer avoids this problem. 277 2. Terminology 279 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 280 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 281 document are to be interpreted as described in [RFC2119]. 283 3. Semantics and Syntax 285 3.1. Signaling Model 287 JSEP does not specify a particular signaling model or state machine, 288 other than the generic need to exchange session descriptions in the 289 fashion described by [RFC3264] (offer/answer) in order for both sides 290 of the session to know how to conduct the session. JSEP provides 291 mechanisms to create offers and answers, as well as to apply them to 292 a session. However, the JSEP implementation is totally decoupled 293 from the actual mechanism by which these offers and answers are 294 communicated to the remote side, including addressing, 295 retransmission, forking, and glare handling. These issues are left 296 entirely up to the application; the application has complete control 297 over which offers and answers get handed to the implementation, and 298 when. 300 +-----------+ +-----------+ 301 | Web App |<--- App-Specific Signaling -->| Web App | 302 +-----------+ +-----------+ 303 ^ ^ 304 | SDP | SDP 305 V V 306 +-----------+ +-----------+ 307 | JSEP |<----------- Media ------------>| JSEP | 308 | Impl. | | Impl. | 309 +-----------+ +-----------+ 311 Figure 1: JSEP Signaling Model 313 3.2. Session Descriptions and State Machine 315 In order to establish the media plane, the JSEP implementation needs 316 specific parameters to indicate what to transmit to the remote side, 317 as well as how to handle the media that is received. These 318 parameters are determined by the exchange of session descriptions in 319 offers and answers, and there are certain details to this process 320 that must be handled in the JSEP APIs. 322 Whether a session description applies to the local side or the remote 323 side affects the meaning of that description. For example, the list 324 of codecs sent to a remote party indicates what the local side is 325 willing to receive, which, when intersected with the set of codecs 326 the remote side supports, specifies what the remote side should send. 327 However, not all parameters follow this rule; some parameters are 328 declarative and the remote side MUST either accept them or reject 329 them altogether. An example of such a parameter is the DTLS 330 fingerprints [RFC8122], which are calculated based on the local 331 certificate(s) offered, and are not subject to negotiation. 333 In addition, various RFCs put different conditions on the format of 334 offers versus answers. For example, an offer may propose an 335 arbitrary number of m= sections (i.e., media descriptions as 336 described in [RFC4566], Section 5.14), but an answer must contain the 337 exact same number as the offer. 339 Lastly, while the exact media parameters are only known only after an 340 offer and an answer have been exchanged, the offerer may receive ICE 341 checks, and possibly media (e.g., in the case of a re-offer after a 342 connection has been established) before it receives an answer. To 343 properly process incoming media in this case, the offerer's media 344 handler must be aware of the details of the offer before the answer 345 arrives. 347 Therefore, in order to handle session descriptions properly, the JSEP 348 implementation needs: 350 1. To know if a session description pertains to the local or remote 351 side. 353 2. To know if a session description is an offer or an answer. 355 3. To allow the offer to be specified independently of the answer. 357 JSEP addresses this by adding both setLocalDescription and 358 setRemoteDescription methods and having session description objects 359 contain a type field indicating the type of session description being 360 supplied. This satisfies the requirements listed above for both the 361 offerer, who first calls setLocalDescription(sdp [offer]) and then 362 later setRemoteDescription(sdp [answer]), as well as for the 363 answerer, who first calls setRemoteDescription(sdp [offer]) and then 364 later setLocalDescription(sdp [answer]). 366 During the offer/answer exchange, the outstanding offer is considered 367 to be "pending" at the offerer and the answerer, as it may either be 368 accepted or rejected. If this is a re-offer, each side will also 369 have "current" local and remote descriptions, which reflect the 370 result of the last offer/answer exchange. Sections Section 4.1.12, 371 Section 4.1.14, Section 4.1.11, and Section 4.1.13, provide more 372 detail on pending and current descriptions. 374 JSEP also allows for an answer to be treated as provisional by the 375 application. Provisional answers provide a way for an answerer to 376 communicate initial session parameters back to the offerer, in order 377 to allow the session to begin, while allowing a final answer to be 378 specified later. This concept of a final answer is important to the 379 offer/answer model; when such an answer is received, any extra 380 resources allocated by the caller can be released, now that the exact 381 session configuration is known. These "resources" can include things 382 like extra ICE components, TURN candidates, or video decoders. 383 Provisional answers, on the other hand, do no such deallocation; as a 384 result, multiple dissimilar provisional answers, with their own codec 385 choices, transport parameters, etc., can be received and applied 386 during call setup. Note that the final answer itself may be 387 different than any received provisional answers. 389 In [RFC3264], the constraint at the signaling level is that only one 390 offer can be outstanding for a given session, but at the media stack 391 level, a new offer can be generated at any point. For example, when 392 using SIP for signaling, if one offer is sent, then cancelled using a 393 SIP CANCEL, another offer can be generated even though no answer was 394 received for the first offer. To support this, the JSEP media layer 395 can provide an offer via the createOffer() method whenever the 396 JavaScript application needs one for the signaling. The answerer can 397 send back zero or more provisional answers, and finally end the 398 offer-answer exchange by sending a final answer. The state machine 399 for this is as follows: 401 setRemote(OFFER) setLocal(PRANSWER) 402 /-----\ /-----\ 403 | | | | 404 v | v | 405 +---------------+ | +---------------+ | 406 | |----/ | |----/ 407 | have- | setLocal(PRANSWER) | have- | 408 | remote-offer |------------------- >| local-pranswer| 409 | | | | 410 | | | | 411 +---------------+ +---------------+ 412 ^ | | 413 | | setLocal(ANSWER) | 414 setRemote(OFFER) | | 415 | V setLocal(ANSWER) | 416 +---------------+ | 417 | | | 418 | |<---------------------------+ 419 | stable | 420 | |<---------------------------+ 421 | | | 422 +---------------+ setRemote(ANSWER) | 423 ^ | | 424 | | setLocal(OFFER) | 425 setRemote(ANSWER) | | 426 | V | 427 +---------------+ +---------------+ 428 | | | | 429 | have- | setRemote(PRANSWER) |have- | 430 | local-offer |------------------- >|remote-pranswer| 431 | | | | 432 | |----\ | |----\ 433 +---------------+ | +---------------+ | 434 ^ | ^ | 435 | | | | 436 \-----/ \-----/ 437 setLocal(OFFER) setRemote(PRANSWER) 439 Figure 2: JSEP State Machine 441 Aside from these state transitions there is no other difference 442 between the handling of provisional ("pranswer") and final ("answer") 443 answers. 445 3.3. Session Description Format 447 JSEP's session descriptions use SDP syntax for their internal 448 representation. While this format is not optimal for manipulation 449 from JavaScript, it is widely accepted, and frequently updated with 450 new features; any alternate encoding of session descriptions would 451 have to keep pace with the changes to SDP, at least until the time 452 that this new encoding eclipsed SDP in popularity. 454 However, to provide for future flexibility, the SDP syntax is 455 encapsulated within a SessionDescription object, which can be 456 constructed from SDP, and be serialized out to SDP. If future 457 specifications agree on a JSON format for session descriptions, we 458 could easily enable this object to generate and consume that JSON. 460 As detailed below, most applications should be able to treat the 461 SessionDescriptions produced and consumed by these various API calls 462 as opaque blobs; that is, the application will not need to read or 463 change them. 465 3.4. Session Description Control 467 In order to give the application control over various common session 468 parameters, JSEP provides control surfaces which tell the JSEP 469 implementation how to generate session descriptions. This avoids the 470 need for JavaScript to modify session descriptions in most cases. 472 Changes to these objects result in changes to the session 473 descriptions generated by subsequent createOffer/Answer calls. 475 3.4.1. RtpTransceivers 477 RtpTransceivers allow the application to control the RTP media 478 associated with one m= section. Each RtpTransceiver has an RtpSender 479 and an RtpReceiver, which an application can use to control the 480 sending and receiving of RTP media. The application may also modify 481 the RtpTransceiver directly, for instance, by stopping it. 483 RtpTransceivers generally have a 1:1 mapping with m= sections, 484 although there may be more RtpTransceivers than m= sections when 485 RtpTransceivers are created but not yet associated with a m= section, 486 or if RtpTransceivers have been stopped and disassociated from m= 487 sections. An RtpTransceiver is said to be associated with an m= 488 section if its mid property is non-null; otherwise it is said to be 489 disassociated. The associated m= section is determined using a 490 mapping between transceivers and m= section indices, formed when 491 creating an offer or applying a remote offer. 493 An RtpTransceiver is never associated with more than one m= section, 494 and once a session description is applied, a m= section is always 495 associated with exactly one RtpTransceiver. However, in certain 496 cases where a m= section has been rejected, as discussed in 497 Section 5.2.2 below, that m= section will be "recycled" and 498 associated with a new RtpTransceiver with a new mid value. 500 RtpTransceivers can be created explicitly by the application or 501 implicitly by calling setRemoteDescription with an offer that adds 502 new m= sections. 504 3.4.2. RtpSenders 506 RtpSenders allow the application to control how RTP media is sent. 507 An RtpSender is conceptually responsible for the outgoing RTP 508 stream(s) described by an m= section. This includes encoding the 509 attached MediaStreamTrack, sending RTP media packets, and generating/ 510 processing RTCP for the outgoing RTP streams(s). 512 3.4.3. RtpReceivers 514 RtpReceivers allow the application to inspect how RTP media is 515 received. An RtpReceiver is conceptually responsible for the 516 incoming RTP stream(s) described by an m= section. This includes 517 processing received RTP media packets, decoding the incoming 518 stream(s) to produce a remote MediaStreamTrack, and generating/ 519 processing RTCP for the incoming RTP stream(s). 521 3.5. ICE 523 3.5.1. ICE Gathering Overview 525 JSEP gathers ICE candidates as needed by the application. Collection 526 of ICE candidates is referred to as a gathering phase, and this is 527 triggered either by the addition of a new or recycled m= section to 528 the local session description, or new ICE credentials in the 529 description, indicating an ICE restart. Use of new ICE credentials 530 can be triggered explicitly by the application, or implicitly by the 531 JSEP implementation in response to changes in the ICE configuration. 533 When the ICE configuration changes in a way that requires a new 534 gathering phase, a 'needs-ice-restart' bit is set. When this bit is 535 set, calls to the createOffer API will generate new ICE credentials. 536 This bit is cleared by a call to the setLocalDescription API with new 537 ICE credentials from either an offer or an answer, i.e., from either 538 a local- or remote-initiated ICE restart. 540 When a new gathering phase starts, the ICE agent will notify the 541 application that gathering is occurring through an event. Then, when 542 each new ICE candidate becomes available, the ICE agent will supply 543 it to the application via an additional event; these candidates will 544 also automatically be added to the current and/or pending local 545 session description. Finally, when all candidates have been 546 gathered, an event will be dispatched to signal that the gathering 547 process is complete. 549 Note that gathering phases only gather the candidates needed by 550 new/recycled/restarting m= sections; other m= sections continue to 551 use their existing candidates. Also, if an m= section is bundled 552 (either by a successful bundle negotiation or by being marked as 553 bundle-only), then candidates will be gathered and exchanged for that 554 m= section if and only if its MID is a BUNDLE-tag, as described in 555 [I-D.ietf-mmusic-sdp-bundle-negotiation]. 557 3.5.2. ICE Candidate Trickling 559 Candidate trickling is a technique through which a caller may 560 incrementally provide candidates to the callee after the initial 561 offer has been dispatched; the semantics of "Trickle ICE" are defined 562 in [I-D.ietf-ice-trickle]. This process allows the callee to begin 563 acting upon the call and setting up the ICE (and perhaps DTLS) 564 connections immediately, without having to wait for the caller to 565 gather all possible candidates. This results in faster media setup 566 in cases where gathering is not performed prior to initiating the 567 call. 569 JSEP supports optional candidate trickling by providing APIs, as 570 described above, that provide control and feedback on the ICE 571 candidate gathering process. Applications that support candidate 572 trickling can send the initial offer immediately and send individual 573 candidates when they get the notified of a new candidate; 574 applications that do not support this feature can simply wait for the 575 indication that gathering is complete, and then create and send their 576 offer, with all the candidates, at this time. 578 Upon receipt of trickled candidates, the receiving application will 579 supply them to its ICE agent. This triggers the ICE agent to start 580 using the new remote candidates for connectivity checks. 582 3.5.2.1. ICE Candidate Format 584 In JSEP, ICE candidates are abstracted by an IceCandidate object, and 585 as with session descriptions, SDP syntax is used for the internal 586 representation. 588 The candidate details are specified in an IceCandidate field, using 589 the same SDP syntax as the "candidate-attribute" field defined in 590 [RFC5245], Section 15.1. Note that this field does not contain an 591 "a=" prefix, as indicated in the following example: 593 candidate:1 1 UDP 1694498815 192.0.2.33 10000 typ host 595 The IceCandidate object contains a field to indicate which ICE ufrag 596 it is associated with, as defined in [RFC5245], Section 15.4. This 597 value is used to determine which session description (and thereby 598 which gathering phase) this IceCandidate belongs to, which helps 599 resolve ambiguities during ICE restarts. If this field is absent in 600 a received IceCandidate (perhaps when communicating with a non-JSEP 601 endpoint), the most recently received session description is assumed. 603 The IceCandidate object also contains fields to indicate which m= 604 section it is associated with, which can be identified in one of two 605 ways, either by a m= section index, or a MID. The m= section index 606 is a zero-based index, with index N referring to the N+1th m= section 607 in the session description referenced by this IceCandidate. The MID 608 is a "media stream identification" value, as defined in [RFC5888], 609 Section 4, which provides a more robust way to identify the m= 610 section in the session description, using the MID of the associated 611 RtpTransceiver object (which may have been locally generated by the 612 answerer when interacting with a non-JSEP endpoint that does not 613 support the MID attribute, as discussed in Section 5.9 below). If 614 the MID field is present in a received IceCandidate, it MUST be used 615 for identification; otherwise, the m= section index is used instead. 617 When creating an IceCandidate object, JSEP implementations MUST 618 populate each of the candidate, ufrag, m= section index, and MID 619 fields. Implementations MUST also be prepared to receive objects 620 with some fields missing, as mentioned above. 622 3.5.3. ICE Candidate Policy 624 Typically, when gathering ICE candidates, the JSEP implementation 625 will gather all possible forms of initial candidates - host, server 626 reflexive, and relay. However, in certain cases, applications may 627 want to have more specific control over the gathering process, due to 628 privacy or related concerns. For example, one may want to only use 629 relay candidates, to leak as little location information as possible 630 (keeping in mind that this choice comes with corresponding 631 operational costs). To accomplish this, JSEP allows the application 632 to restrict which ICE candidates are used in a session. Note that 633 this filtering is applied on top of any restrictions the 634 implementation chooses to enforce regarding which IP addresses are 635 permitted for the application, as discussed in 636 [I-D.ietf-rtcweb-ip-handling]. 638 There may also be cases where the application wants to change which 639 types of candidates are used while the session is active. A prime 640 example is where a callee may initially want to use only relay 641 candidates, to avoid leaking location information to an arbitrary 642 caller, but then change to use all candidates (for lower operational 643 cost) once the user has indicated they want to take the call. For 644 this scenario, the JSEP implementation MUST allow the candidate 645 policy to be changed in mid-session, subject to the aforementioned 646 interactions with local policy. 648 To administer the ICE candidate policy, the JSEP implementation will 649 determine the current setting at the start of each gathering phase. 650 Then, during the gathering phase, the implementation MUST NOT expose 651 candidates disallowed by the current policy to the application, use 652 them as the source of connectivity checks, or indirectly expose them 653 via other fields, such as the raddr/rport attributes for other ICE 654 candidates. Later, if a different policy is specified by the 655 application, the application can apply it by kicking off a new 656 gathering phase via an ICE restart. 658 3.5.4. ICE Candidate Pool 660 JSEP applications typically inform the JSEP implementation to begin 661 ICE gathering via the information supplied to setLocalDescription, as 662 the local description indicates the number of ICE components which 663 will be needed and for which candidates must be gathered. However, 664 to accelerate cases where the application knows the number of ICE 665 components to use ahead of time, it may ask the implementation to 666 gather a pool of potential ICE candidates to help ensure rapid media 667 setup. 669 When setLocalDescription is eventually called, and the JSEP 670 implementation goes to gather the needed ICE candidates, it SHOULD 671 start by checking if any candidates are available in the pool. If 672 there are candidates in the pool, they SHOULD be handed to the 673 application immediately via the ICE candidate event. If the pool 674 becomes depleted, either because a larger-than-expected number of ICE 675 components is used, or because the pool has not had enough time to 676 gather candidates, the remaining candidates are gathered as usual. 677 This only occurs for the first offer/answer exchange, after which the 678 candidate pool is emptied and no longer used. 680 One example of where this concept is useful is an application that 681 expects an incoming call at some point in the future, and wants to 682 minimize the time it takes to establish connectivity, to avoid 683 clipping of initial media. By pre-gathering candidates into the 684 pool, it can exchange and start sending connectivity checks from 685 these candidates almost immediately upon receipt of a call. Note 686 though that by holding on to these pre-gathered candidates, which 687 will be kept alive as long as they may be needed, the application 688 will consume resources on the STUN/TURN servers it is using. 690 3.6. Video Size Negotiation 692 Video size negotiation is the process through which a receiver can 693 use the "a=imageattr" SDP attribute [RFC6236] to indicate what video 694 frame sizes it is capable of receiving. A receiver may have hard 695 limits on what its video decoder can process, or it may have some 696 maximum set by policy. By specifying these limits in an 697 "a=imageattr" attribute, JSEP endpoints can attempt to ensure that 698 the remote sender transmits video at an acceptable resolution. 699 However, when communicating with a non-JSEP endpoint that does not 700 understand this attribute, any signaled limits may be exceeded, and 701 the JSEP implementation MUST handle this gracefully, e.g., by 702 discarding the video. 704 Note that certain codecs support transmission of samples with aspect 705 ratios other than 1.0 (i.e., non-square pixels). JSEP 706 implementations will not transmit non-square pixels, but SHOULD 707 receive and render such video with the correct aspect ratio. 708 However, sample aspect ratio has no impact on the size negotiation 709 described below; all dimensions are measured in pixels, whether 710 square or not. 712 3.6.1. Creating an imageattr Attribute 714 The receiver will first intersect any known local limits (e.g., 715 hardware decoder capababilities, local policy) to determine the 716 absolute minimum and maximum sizes it can receive. If there are no 717 known local limits, the "a=imageattr" attribute SHOULD be omitted. 718 If these local limits preclude receiving any video, i.e., the 719 degenerate case of no permitted resolutions, the "a=imageattr" 720 attribute MUST be omitted, and the m= section MUST be marked as 721 sendonly/inactive, as appropriate. 723 Otherwise, an "a=imageattr" attribute is created with "recv" 724 direction, and the resulting resolution space formed from the 725 aforementioned intersection is used to specify its minimum and 726 maximum x= and y= values. 728 The rules here express a single set of preferences, and therefore, 729 the "a=imageattr" q= value is not important. It SHOULD be set to 730 1.0. 732 The "a=imageattr" field is payload type specific. When all video 733 codecs supported have the same capabilities, use of a single 734 attribute, with the wildcard payload type (*), is RECOMMENDED. 735 However, when the supported video codecs have different limitations, 736 specific "a=imageattr" attributes MUST be inserted for each payload 737 type. 739 As an example, consider a system with a multiformat video decoder, 740 which is capable of decoding any resolution from 48x48 to 720p, In 741 this case, the implementation would generate this attribute: 743 a=imageattr:* recv [x=[48:1280],y=[48:720],q=1.0] 745 This declaration indicates that the receiver is capable of decoding 746 any image resolution from 48x48 up to 1280x720 pixels. 748 3.6.2. Interpreting an imageattr Attribute 750 [RFC6236] defines "a=imageattr" to be an advisory field. This means 751 that it does not absolutely constrain the video formats that the 752 sender can use, but gives an indication of the preferred values. 754 This specification prescribes more specific behavior. When a 755 MediaStreamTrack, which is producing video of a certain resolution 756 (the "track resolution"), is attached to a RtpSender, which is 757 encoding the track video at the same or lower resolution(s) (the 758 "encoder resolutions"), and a remote description is applied that 759 references the sender and contains valid "a=imageattr recv" 760 attributes, it MUST follow the rules below to ensure the sender does 761 not transmit a resolution that would exceed the size criteria 762 specified in the attributes. These rules MUST be followed as long as 763 the attributes remain present in the remote description, including 764 cases in which the track changes its resolution, or is replaced with 765 a different track. 767 Depending on how the RtpSender is configured, it may be producing a 768 single encoding at a certain resolution, or, if simulcast Section 3.7 769 has been negotiated, multiple encodings, each at their own specific 770 resolution. In addition, depending on the configuration, each 771 encoding may have the flexibility to reduce resolution when needed, 772 or may be locked to a specific output resolution. 774 For each encoding being produced by the RtpSender, the following 775 rules are applied to determine what should be transmitted: 777 o First, the most suitable "a=imageattr recv" attribute is selected. 778 This is performed by taking the attribute with the highest "q=" 779 value from the set of attributes that reference the media format 780 that has been selected for the specified encoding. If multiple 781 attributes have the same "q=" value, the one that appears first in 782 the m= section is used. Note that while JSEP endpoints will 783 include at most one "a=imageattr recv" attribute per media format, 784 JSEP endpoints may receive session descriptions from non-JSEP 785 endpoints with m= sections that contain multiple such attributes. 787 o If there is an applicable "a=imageattr recv" attribute for the 788 encoding, the limits from the attribute are then compared to the 789 encoder resolution. Only the specific limits mentioned below are 790 considered; any other values, such as picture aspect ratio, MUST 791 be ignored. When considering a MediaStreamTrack that is producing 792 rotated video, the unrotated resolution MUST be used for the 793 checks. This is required regardless of whether the receiver 794 supports performing receive-side rotation (e.g., through CVO 795 [TS26.114]), as it significantly simplifies the matching logic. 797 o If the attribute includes a "sar=" (sample aspect ratio) value set 798 to something other than "1.0", indicating the receiver wants to 799 receive non-square pixels, this cannot be satisfied and the sender 800 MUST NOT transmit the encoding. 802 o If the encoder resolution exceeds the maximum size permitted by 803 the attribute, and the encoder is allowed to adjust its 804 resolution, the encoder SHOULD apply downscaling in order to 805 satisfy the limits, although the downscaling MUST NOT change the 806 picture aspect ratio of the encoding. For example, if the encoder 807 resolution is 1280x720, and the attribute specified a maximum of 808 640x480, the expected output resolution would be 640x360. If 809 downscaling cannot be applied, the encoding MUST NOT be 810 transmitted, and an error SHOULD be raised to the application. 812 o If the encoder resolution is less than the minimum size permitted 813 by the attribute, the encoding MUST NOT be transmitted, and an 814 error SHOULD be raised to the application; the encoder MUST NOT 815 apply upscaling. JSEP implementations SHOULD avoid this situation 816 by allowing receipt of arbitrarily small resolutions, perhaps via 817 fallback to a software decoder. 819 3.7. Simulcast 821 JSEP supports simulcast transmission of a MediaStreamTrack, where 822 multiple encodings of the source media can be transmitted within the 823 context of a single m= section. The current JSEP API is designed to 824 allow applications to send simulcasted media but only to receive a 825 single encoding. This allows for multi-user scenarios where each 826 sending client sends multiple encodings to a server, which then, for 827 each receiving client, chooses the appropriate encoding to forward. 829 Applications request support for simulcast by configuring multiple 830 encodings on an RtpSender. Upon generation of an offer or answer, 831 these encodings are indicated via SDP markings on the corresponding 832 m= section, as described below. Receivers that understand simulcast 833 and are willing to receive it will also include SDP markings to 834 indicate their support, and JSEP endpoints will use these markings to 835 determine whether simulcast is permitted for a given RtpSender. If 836 simulcast support is not negotiated, the RtpSender will only use the 837 first configured encoding. 839 Note that the exact simulcast parameters are up to the sending 840 application. While the aforementioned SDP markings are provided to 841 ensure the remote side can receive and demux multiple simulcast 842 encodings, the specific resolutions and bitrates to be used for each 843 encoding are purely a send-side decision in JSEP. 845 JSEP currently does not provide a mechanism to configure receipt of 846 simulcast. This means that if simulcast is offered by the remote 847 endpoint, the answer generated by a JSEP endpoint will not indicate 848 support for receipt of simulcast, and as such the remote endpoint 849 will only send a single encoding per m= section. 851 In addition, JSEP does not provide a mechanism to handle an incoming 852 offer requesting simulcast from the JSEP endpoint. This means that 853 setting up simulcast in the case where the JSEP endpoint receives the 854 initial offer requires out-of-band signaling or SDP inspection. 855 However, in the case where the JSEP endpoint sets up simulcast in its 856 in initial offer, any established simulcast streams will continue to 857 work upon receipt of an incoming re-offer. Future versions of this 858 specification may add additional APIs to handle the incoming initial 859 offer scenario. 861 When using JSEP to transmit multiple encodings from a RtpSender, the 862 techniques from [I-D.ietf-mmusic-sdp-simulcast] and 863 [I-D.ietf-mmusic-rid] are used. Specifically, when multiple 864 encodings have been configured for a RtpSender, the m= section for 865 the RtpSender will include an "a=simulcast" attribute, as defined in 866 [I-D.ietf-mmusic-sdp-simulcast], Section 6.2, with a "send" simulcast 867 stream description that lists each desired encoding, and no "recv" 868 simulcast stream description. The m= section will also include an 869 "a=rid" attribute for each encoding, as specified in 870 [I-D.ietf-mmusic-rid], Section 4; the use of RID identifiers allows 871 the individual encodings to be disambiguated even though they are all 872 part of the same m= section. 874 3.8. Interactions With Forking 876 Some call signaling systems allow various types of forking where an 877 SDP Offer may be provided to more than one device. For example, SIP 878 [RFC3261] defines both a "Parallel Search" and "Sequential Search". 879 Although these are primarily signaling level issues that are outside 880 the scope of JSEP, they do have some impact on the configuration of 881 the media plane that is relevant. When forking happens at the 882 signaling layer, the JavaScript application responsible for the 883 signaling needs to make the decisions about what media should be sent 884 or received at any point of time, as well as which remote endpoint it 885 should communicate with; JSEP is used to make sure the media engine 886 can make the RTP and media perform as required by the application. 887 The basic operations that the applications can have the media engine 888 do are: 890 o Start exchanging media with a given remote peer, but keep all the 891 resources reserved in the offer. 893 o Start exchanging media with a given remote peer, and free any 894 resources in the offer that are not being used. 896 3.8.1. Sequential Forking 898 Sequential forking involves a call being dispatched to multiple 899 remote callees, where each callee can accept the call, but only one 900 active session ever exists at a time; no mixing of received media is 901 performed. 903 JSEP handles sequential forking well, allowing the application to 904 easily control the policy for selecting the desired remote endpoint. 905 When an answer arrives from one of the callees, the application can 906 choose to apply it either as a provisional answer, leaving open the 907 possibility of using a different answer in the future, or apply it as 908 a final answer, ending the setup flow. 910 In a "first-one-wins" situation, the first answer will be applied as 911 a final answer, and the application will reject any subsequent 912 answers. In SIP parlance, this would be ACK + BYE. 914 In a "last-one-wins" situation, all answers would be applied as 915 provisional answers, and any previous call leg will be terminated. 916 At some point, the application will end the setup process, perhaps 917 with a timer; at this point, the application could reapply the 918 pending remote description as a final answer. 920 3.8.2. Parallel Forking 922 Parallel forking involves a call being dispatched to multiple remote 923 callees, where each callee can accept the call, and multiple 924 simultaneous active signaling sessions can be established as a 925 result. If multiple callees send media at the same time, the 926 possibilities for handling this are described in [RFC3960], 927 Section 3.1. Most SIP devices today only support exchanging media 928 with a single device at a time, and do not try to mix multiple early 929 media audio sources, as that could result in a confusing situation. 930 For example, consider having a European ringback tone mixed together 931 with the North American ringback tone - the resulting sound would not 932 be like either tone, and would confuse the user. If the signaling 933 application wishes to only exchange media with one of the remote 934 endpoints at a time, then from a media engine point of view, this is 935 exactly like the sequential forking case. 937 In the parallel forking case where the JavaScript application wishes 938 to simultaneously exchange media with multiple peers, the flow is 939 slightly more complex, but the JavaScript application can follow the 940 strategy that [RFC3960] describes using UPDATE. The UPDATE approach 941 allows the signaling to set up a separate media flow for each peer 942 that it wishes to exchange media with. In JSEP, this offer used in 943 the UPDATE would be formed by simply creating a new PeerConnection 944 (see Section 4.1) and making sure that the same local media streams 945 have been added into this new PeerConnection. Then the new 946 PeerConnection object would produce a SDP offer that could be used by 947 the signaling to perform the UPDATE strategy discussed in [RFC3960]. 949 As a result of sharing the media streams, the application will end up 950 with N parallel PeerConnection sessions, each with a local and remote 951 description and their own local and remote addresses. The media flow 952 from these sessions can be managed using setDirection (see 953 Section 4.2.3), or the application can choose to play out the media 954 from all sessions mixed together. Of course, if the application 955 wants to only keep a single session, it can simply terminate the 956 sessions that it no longer needs. 958 4. Interface 960 This section details the basic operations that must be present to 961 implement JSEP functionality. The actual API exposed in the W3C API 962 may have somewhat different syntax, but should map easily to these 963 concepts. 965 4.1. PeerConnection 967 4.1.1. Constructor 969 The PeerConnection constructor allows the application to specify 970 global parameters for the media session, such as the STUN/TURN 971 servers and credentials to use when gathering candidates, as well as 972 the initial ICE candidate policy and pool size, and also the bundle 973 policy to use. 975 If an ICE candidate policy is specified, it functions as described in 976 Section 3.5.3, causing the JSEP implementation to only surface the 977 permitted candidates (including any implementation-internal 978 filtering) to the application, and only use those candidates for 979 connectivity checks. The set of available policies is as follows: 981 all: All candidates permitted by implementation policy will be 982 gathered and used. 984 relay: All candidates except relay candidates will be filtered out. 985 This obfuscates the location information that might be ascertained 986 by the remote peer from the received candidates. Depending on how 987 the application deploys and chooses relay servers, this could 988 obfuscate location to a metro or possibly even global level. 990 The default ICE candidate policy MUST be set to "all" as this is 991 generally the desired policy, and also typically reduces use of 992 application TURN server resources significantly. 994 If a size is specified for the ICE candidate pool, this indicates the 995 number of ICE components to pre-gather candidates for. Because pre- 996 gathering results in utilizing STUN/TURN server resources for 997 potentially long periods of time, this must only occur upon 998 application request, and therefore the default candidate pool size 999 MUST be zero. 1001 The application can specify its preferred policy regarding use of 1002 bundle, the multiplexing mechanism defined in 1003 [I-D.ietf-mmusic-sdp-bundle-negotiation]. Regardless of policy, the 1004 application will always try to negotiate bundle onto a single 1005 transport, and will offer a single bundle group across all m= 1006 sections; use of this single transport is contingent upon the 1007 answerer accepting bundle. However, by specifying a policy from the 1008 list below, the application can control exactly how aggressively it 1009 will try to bundle media streams together, which affects how it will 1010 interoperate with a non-bundle-aware endpoint. When negotiating with 1011 a non-bundle-aware endpoint, only the streams not marked as bundle- 1012 only streams will be established. 1014 The set of available policies is as follows: 1016 balanced: The first m= section of each type (audio, video, or 1017 application) will contain transport parameters, which will allow 1018 an answerer to unbundle that section. The second and any 1019 subsequent m= section of each type will be marked bundle-only. 1020 The result is that if there are N distinct media types, then 1021 candidates will be gathered for for N media streams. This policy 1022 balances desire to multiplex with the need to ensure basic audio 1023 and video can still be negotiated in legacy cases. When acting as 1024 answerer, if there is no bundle group in the offer, the 1025 implementation will reject all but the first m= section of each 1026 type. 1028 max-compat: All m= sections will contain transport parameters; none 1029 will be marked as bundle-only. This policy will allow all streams 1030 to be received by non-bundle-aware endpoints, but require separate 1031 candidates to be gathered for each media stream. 1033 max-bundle: Only the first m= section will contain transport 1034 parameters; all streams other than the first will be marked as 1035 bundle-only. This policy aims to minimize candidate gathering and 1036 maximize multiplexing, at the cost of less compatibility with 1037 legacy endpoints. When acting as answerer, the implementation 1038 will reject any m= sections other than the first m= section, 1039 unless they are in the same bundle group as that m= section. 1041 As it provides the best tradeoff between performance and 1042 compatibility with legacy endpoints, the default bundle policy MUST 1043 be set to "balanced". 1045 The application can specify its preferred policy regarding use of 1046 RTP/RTCP multiplexing [RFC5761] using one of the following policies: 1048 negotiate: The JSEP implementation will gather both RTP and RTCP 1049 candidates but also will offer "a=rtcp-mux", thus allowing for 1050 compatibility with either multiplexing or non-multiplexing 1051 endpoints. 1053 require: The JSEP implementation will only gather RTP candidates and 1054 will insert an "a=rtcp-mux-only" indication into any new m= 1055 sections in offers it generates. This halves the number of 1056 candidates that the offerer needs to gather. Applying a 1057 description with an m= section that does not contain an "a=rtcp- 1058 mux" attribute will cause an error to be returned. 1060 The default multiplexing policy MUST be set to "require". 1061 Implementations MAY choose to reject attempts by the application to 1062 set the multiplexing policy to "negotiate". 1064 4.1.2. addTrack 1066 The addTrack method adds a MediaStreamTrack to the PeerConnection, 1067 using the MediaStream argument to associate the track with other 1068 tracks in the same MediaStream, so that they can be added to the same 1069 "LS" group when creating an offer or answer. Adding tracks to the 1070 same "LS" group indicates that the playback of these tracks should be 1071 synchronized for proper lip sync, as described in [RFC5888], 1072 Section 7. addTrack attempts to minimize the number of transceivers 1073 as follows: If the PeerConnection is in the "have-remote-offer" 1074 state, the track will be attached to the first compatible transceiver 1075 that was created by the most recent call to setRemoteDescription() 1076 and does not have a local track. Otherwise, a new transceiver will 1077 be created, as described in Section 4.1.4. 1079 4.1.3. removeTrack 1081 The removeTrack method removes a MediaStreamTrack from the 1082 PeerConnection, using the RtpSender argument to indicate which sender 1083 should have its track removed. The sender's track is cleared, and 1084 the sender stops sending. Future calls to createOffer will mark the 1085 m= section associated with the sender as recvonly (if 1086 transceiver.direction is sendrecv) or as inactive (if 1087 transceiver.direction is sendonly). 1089 4.1.4. addTransceiver 1091 The addTransceiver method adds a new RtpTransceiver to the 1092 PeerConnection. If a MediaStreamTrack argument is provided, then the 1093 transceiver will be configured with that media type and the track 1094 will be attached to the transceiver. Otherwise, the application MUST 1095 explicitly specify the type; this mode is useful for creating 1096 recvonly transceivers as well as for creating transceivers to which a 1097 track can be attached at some later point. 1099 At the time of creation, the application can also specify a 1100 transceiver direction attribute, a set of MediaStreams which the 1101 transceiver is associated with (allowing LS group assignments), and a 1102 set of encodings for the media (used for simulcast as described in 1103 Section 3.7). 1105 4.1.5. createDataChannel 1107 The createDataChannel method creates a new data channel and attaches 1108 it to the PeerConnection. If no data channel currently exists for 1109 this PeerConnection, then a new offer/answer exchange is required. 1110 All data channels on a given PeerConnection share the same SCTP/DTLS 1111 association and therefore the same m= section, so subsequent creation 1112 of data channels does not have any impact on the JSEP state. 1114 The createDataChannel method also includes a number of arguments 1115 which are used by the PeerConnection (e.g., maxPacketLifetime) but 1116 are not reflected in the SDP and do not affect the JSEP state. 1118 4.1.6. createOffer 1120 The createOffer method generates a blob of SDP that contains a 1121 [RFC3264] offer with the supported configurations for the session, 1122 including descriptions of the media added to this PeerConnection, the 1123 codec/RTP/RTCP options supported by this implementation, and any 1124 candidates that have been gathered by the ICE agent. An options 1125 parameter may be supplied to provide additional control over the 1126 generated offer. This options parameter allows an application to 1127 trigger an ICE restart, for the purpose of reestablishing 1128 connectivity. 1130 In the initial offer, the generated SDP will contain all desired 1131 functionality for the session (functionality that is supported but 1132 not desired by default may be omitted); for each SDP line, the 1133 generation of the SDP will follow the process defined for generating 1134 an initial offer from the document that specifies the given SDP line. 1135 The exact handling of initial offer generation is detailed in 1136 Section 5.2.1 below. 1138 In the event createOffer is called after the session is established, 1139 createOffer will generate an offer to modify the current session 1140 based on any changes that have been made to the session, e.g., adding 1141 or stopping RtpTransceivers, or requesting an ICE restart. For each 1142 existing stream, the generation of each SDP line must follow the 1143 process defined for generating an updated offer from the RFC that 1144 specifies the given SDP line. For each new stream, the generation of 1145 the SDP must follow the process of generating an initial offer, as 1146 mentioned above. If no changes have been made, or for SDP lines that 1147 are unaffected by the requested changes, the offer will only contain 1148 the parameters negotiated by the last offer-answer exchange. The 1149 exact handling of subsequent offer generation is detailed in 1150 Section 5.2.2. below. 1152 Session descriptions generated by createOffer must be immediately 1153 usable by setLocalDescription; if a system has limited resources 1154 (e.g. a finite number of decoders), createOffer should return an 1155 offer that reflects the current state of the system, so that 1156 setLocalDescription will succeed when it attempts to acquire those 1157 resources. 1159 Calling this method may do things such as generating new ICE 1160 credentials, but does not change the PeerConnection state, trigger 1161 candidate gathering, or cause media to start or stop flowing. 1162 Specifically, the offer is not applied, and does not become the 1163 pending local description, until setLocalDescription is called. 1165 4.1.7. createAnswer 1167 The createAnswer method generates a blob of SDP that contains a 1168 [RFC3264] SDP answer with the supported configuration for the session 1169 that is compatible with the parameters supplied in the most recent 1170 call to setRemoteDescription, which MUST have been called prior to 1171 calling createAnswer. Like createOffer, the returned blob contains 1172 descriptions of the media added to this PeerConnection, the 1173 codec/RTP/RTCP options negotiated for this session, and any 1174 candidates that have been gathered by the ICE agent. An options 1175 parameter may be supplied to provide additional control over the 1176 generated answer. 1178 As an answer, the generated SDP will contain a specific configuration 1179 that specifies how the media plane should be established; for each 1180 SDP line, the generation of the SDP must follow the process defined 1181 for generating an answer from the document that specifies the given 1182 SDP line. The exact handling of answer generation is detailed in 1183 Section 5.3. below. 1185 Session descriptions generated by createAnswer must be immediately 1186 usable by setLocalDescription; like createOffer, the returned 1187 description should reflect the current state of the system. 1189 Calling this method may do things such as generating new ICE 1190 credentials, but does not change the PeerConnection state, trigger 1191 candidate gathering, or or cause a media state change. Specifically, 1192 the answer is not applied, and does not become the current local 1193 description, until setLocalDescription is called. 1195 4.1.8. SessionDescriptionType 1197 Session description objects (RTCSessionDescription) may be of type 1198 "offer", "pranswer", "answer" or "rollback". These types provide 1199 information as to how the description parameter should be parsed, and 1200 how the media state should be changed. 1202 "offer" indicates that a description should be parsed as an offer; 1203 said description may include many possible media configurations. A 1204 description used as an "offer" may be applied anytime the 1205 PeerConnection is in a stable state, or as an update to a previously 1206 supplied but unanswered "offer". 1208 "pranswer" indicates that a description should be parsed as an 1209 answer, but not a final answer, and so should not result in the 1210 freeing of allocated resources. It may result in the start of media 1211 transmission, if the answer does not specify an inactive media 1212 direction. A description used as a "pranswer" may be applied as a 1213 response to an "offer", or an update to a previously sent "pranswer". 1215 "answer" indicates that a description should be parsed as an answer, 1216 the offer-answer exchange should be considered complete, and any 1217 resources (decoders, candidates) that are no longer needed can be 1218 released. A description used as an "answer" may be applied as a 1219 response to an "offer", or an update to a previously sent "pranswer". 1221 The only difference between a provisional and final answer is that 1222 the final answer results in the freeing of any unused resources that 1223 were allocated as a result of the offer. As such, the application 1224 can use some discretion on whether an answer should be applied as 1225 provisional or final, and can change the type of the session 1226 description as needed. For example, in a serial forking scenario, an 1227 application may receive multiple "final" answers, one from each 1228 remote endpoint. The application could choose to accept the initial 1229 answers as provisional answers, and only apply an answer as final 1230 when it receives one that meets its criteria (e.g. a live user 1231 instead of voicemail). 1233 "rollback" is a special session description type implying that the 1234 state machine should be rolled back to the previous stable state, as 1235 described in Section 4.1.8.2. The contents MUST be empty. 1237 4.1.8.1. Use of Provisional Answers 1239 Most applications will not need to create answers using the 1240 "pranswer" type. While it is good practice to send an immediate 1241 response to an offer, in order to warm up the session transport and 1242 prevent media clipping, the preferred handling for a JSEP application 1243 is to create and send a "sendonly" final answer with a null 1244 MediaStreamTrack immediately after receiving the offer, which will 1245 prevent media from being sent by the caller, and allow media to be 1246 sent immediately upon answer by the callee. Later, when the callee 1247 actually accepts the call, the application can plug in the real 1248 MediaStreamTrack and create a new "sendrecv" offer to update the 1249 previous offer/answer pair and start bidirectional media flow. While 1250 this could also be done with a "sendonly" pranswer, followed by a 1251 "sendrecv" answer, the initial pranswer leaves the offer-answer 1252 exchange open, which means that the caller cannot send an updated 1253 offer during this time. 1255 As an example, consider a typical JSEP application that wants to set 1256 up audio and video as quickly as possible. When the callee receives 1257 an offer with audio and video MediaStreamTracks, it will send an 1258 immediate answer accepting these tracks as sendonly (meaning that the 1259 caller will not send the callee any media yet, and because the callee 1260 has not yet added its own MediaStreamTracks, the callee will not send 1261 any media either). It will then ask the user to accept the call and 1262 acquire the needed local tracks. Upon acceptance by the user, the 1263 application will plug in the tracks it has acquired, which, because 1264 ICE and DTLS handshaking have likely completed by this point, can 1265 start transmitting immediately. The application will also send a new 1266 offer to the remote side indicating call acceptance and moving the 1267 audio and video to be two-way media. A detailed example flow along 1268 these lines is shown in Section 7.3. 1270 Of course, some applications may not be able to perform this double 1271 offer-answer exchange, particularly ones that are attempting to 1272 gateway to legacy signaling protocols. In these cases, pranswer can 1273 still provide the application with a mechanism to warm up the 1274 transport. 1276 4.1.8.2. Rollback 1278 In certain situations it may be desirable to "undo" a change made to 1279 setLocalDescription or setRemoteDescription. Consider a case where a 1280 call is ongoing, and one side wants to change some of the session 1281 parameters; that side generates an updated offer and then calls 1282 setLocalDescription. However, the remote side, either before or 1283 after setRemoteDescription, decides it does not want to accept the 1284 new parameters, and sends a reject message back to the offerer. Now, 1285 the offerer, and possibly the answerer as well, need to return to a 1286 stable state and the previous local/remote description. To support 1287 this, we introduce the concept of "rollback". 1289 A rollback discards any proposed changes to the session, returning 1290 the state machine to the stable state, and setting the pending local 1291 and/or remote description (see Section 4.1.12 and Section 4.1.14) to 1292 null. Any resources or candidates that were allocated by the 1293 abandoned local description are discarded; any media that is received 1294 will be processed according to the previous local and remote 1295 descriptions. Rollback can only be used to cancel proposed changes; 1296 there is no support for rolling back from a stable state to a 1297 previous stable state. Note that this implies that once the answerer 1298 has performed setLocalDescription with his answer, this cannot be 1299 rolled back. 1301 A rollback will disassociate any RtpTransceivers that were associated 1302 with m= sections by the application of the rolled-back session 1303 description (see Section 5.9 and Section 5.8). This means that some 1304 RtpTransceivers that were previously associated will no longer be 1305 associated with any m= section; in such cases, the value of the 1306 RtpTransceiver's mid property MUST be set to null, and the mapping 1307 between the transceiver and its m= section index MUST be discarded. 1308 RtpTransceivers that were created by applying a remote offer that was 1309 subsequently rolled back MUST be stopped and removed from the 1310 PeerConnection. However, a RtpTransceiver MUST NOT be removed if a 1311 track was attached to the RtpTransceiver via the addTrack method. 1312 This is so that an application may call addTrack, then call 1313 setRemoteDescription with an offer, then roll back that offer, then 1314 call createOffer and have a m= section for the added track appear in 1315 the generated offer. 1317 A rollback is performed by supplying a session description of type 1318 "rollback" with empty contents to either setLocalDescription or 1319 setRemoteDescription. The effect MUST be the same regardless of 1320 whether setLocalDescription or setRemoteDescription is called. 1322 A rollback may be performed if the PeerConnection is in any state 1323 except for "stable". This means that both offers and provisional 1324 answers can be rolled back. If a rollback is attempted in the 1325 "stable" state, processing MUST stop and an error MUST be returned. 1327 4.1.9. setLocalDescription 1329 The setLocalDescription method instructs the PeerConnection to apply 1330 the supplied session description as its local configuration. The 1331 type field indicates whether the description should be processed as 1332 an offer, provisional answer, final answer, or rollback; offers and 1333 answers are checked differently, using the various rules that exist 1334 for each SDP line. 1336 This API changes the local media state; among other things, it sets 1337 up local resources for receiving and decoding media. In order to 1338 successfully handle scenarios where the application wants to offer to 1339 change from one media format to a different, incompatible format, the 1340 PeerConnection must be able to simultaneously support use of both the 1341 current and pending local descriptions (e.g., support the codecs that 1342 exist in either description). This dual processing begins when the 1343 PeerConnection enters the "have-local-offer" state, and continues 1344 until setRemoteDescription is called with either a final answer, at 1345 which point the PeerConnection can fully adopt the pending local 1346 description, or a rollback, which results in a revert to the current 1347 local description. 1349 This API indirectly controls the candidate gathering process. When a 1350 local description is supplied, and the number of transports currently 1351 in use does not match the number of transports needed by the local 1352 description, the PeerConnection will create transports as needed and 1353 begin gathering candidates for each transport, using ones from the 1354 candidate pool if available. 1356 If setRemoteDescription was previously called with an offer, and 1357 setLocalDescription is called with an answer (provisional or final), 1358 and the media directions are compatible, and media is available to 1359 send, this will result in the starting of media transmission. 1361 4.1.10. setRemoteDescription 1363 The setRemoteDescription method instructs the PeerConnection to apply 1364 the supplied session description as the desired remote configuration. 1365 As in setLocalDescription, the type field of the description 1366 indicates how it should be processed. 1368 This API changes the local media state; among other things, it sets 1369 up local resources for sending and encoding media. 1371 If setLocalDescription was previously called with an offer, and 1372 setRemoteDescription is called with an answer (provisional or final), 1373 and the media directions are compatible, and media is available to 1374 send, this will result in the starting of media transmission. 1376 4.1.11. currentLocalDescription 1378 The currentLocalDescription method returns the current negotiated 1379 local description - i.e., the local description from the last 1380 successful offer/answer exchange - in addition to any local 1381 candidates that have been generated by the ICE agent since the local 1382 description was set. 1384 A null object will be returned if an offer/answer exchange has not 1385 yet been completed. 1387 4.1.12. pendingLocalDescription 1389 The pendingLocalDescription method returns a copy of the local 1390 description currently in negotiation - i.e., a local offer set 1391 without any corresponding remote answer - in addition to any local 1392 candidates that have been generated by the ICE agent since the local 1393 description was set. 1395 A null object will be returned if the state of the PeerConnection is 1396 "stable" or "have-remote-offer". 1398 4.1.13. currentRemoteDescription 1400 The currentRemoteDescription method returns a copy of the current 1401 negotiated remote description - i.e., the remote description from the 1402 last successful offer/answer exchange - in addition to any remote 1403 candidates that have been supplied via processIceMessage since the 1404 remote description was set. 1406 A null object will be returned if an offer/answer exchange has not 1407 yet been completed. 1409 4.1.14. pendingRemoteDescription 1411 The pendingRemoteDescription method returns a copy of the remote 1412 description currently in negotiation - i.e., a remote offer set 1413 without any corresponding local answer - in addition to any remote 1414 candidates that have been supplied via processIceMessage since the 1415 remote description was set. 1417 A null object will be returned if the state of the PeerConnection is 1418 "stable" or "have-local-offer". 1420 4.1.15. canTrickleIceCandidates 1422 The canTrickleIceCandidates property indicates whether the remote 1423 side supports receiving trickled candidates. There are three 1424 potential values: 1426 null: No SDP has been received from the other side, so it is not 1427 known if it can handle trickle. This is the initial value before 1428 setRemoteDescription() is called. 1430 true: SDP has been received from the other side indicating that it 1431 can support trickle. 1433 false: SDP has been received from the other side indicating that it 1434 cannot support trickle. 1436 As described in Section 3.5.2, JSEP implementations always provide 1437 candidates to the application individually, consistent with what is 1438 needed for Trickle ICE. However, applications can use the 1439 canTrickleIceCandidates property to determine whether their peer can 1440 actually do Trickle ICE, i.e., whether it is safe to send an initial 1441 offer or answer followed later by candidates as they are gathered. 1442 As "true" is the only value that definitively indicates remote 1443 Trickle ICE support, an application which compares 1444 canTrickleIceCandidates against "true" will by default attempt Half 1445 Trickle on initial offers and Full Trickle on subsequent interactions 1446 with a Trickle ICE-compatible agent. 1448 4.1.16. setConfiguration 1450 The setConfiguration method allows the global configuration of the 1451 PeerConnection, which was initially set by constructor parameters, to 1452 be changed during the session. The effects of this method call 1453 depend on when it is invoked, and differ depending on which specific 1454 parameters are changed: 1456 o Any changes to the STUN/TURN servers to use affect the next 1457 gathering phase. If an ICE gathering phase has already started or 1458 completed, the 'needs-ice-restart' bit mentioned in Section 3.5.1 1459 will be set. This will cause the next call to createOffer to 1460 generate new ICE credentials, for the purpose of forcing an ICE 1461 restart and kicking off a new gathering phase, in which the new 1462 servers will be used. If the ICE candidate pool has a nonzero 1463 size, and a local description has not yet been applied, any 1464 existing candidates will be discarded, and new candidates will be 1465 gathered from the new servers. 1467 o Any change to the ICE candidate policy affects the next gathering 1468 phase. If an ICE gathering phase has already started or 1469 completed, the 'needs-ice-restart' bit will be set. Either way, 1470 changes to the policy have no effect on the candidate pool, 1471 because pooled candidates are not made available to the 1472 application until a gathering phase occurs, and so any necessary 1473 filtering can still be done on any pooled candidates. 1475 o The ICE candidate pool size MUST NOT be changed after applying a 1476 local description. If a local description has not yet been 1477 applied, any changes to the ICE candidate pool size take effect 1478 immediately; if increased, additional candidates are pre-gathered; 1479 if decreased, the now-superfluous candidates are discarded. 1481 o The bundle and RTCP-multiplexing policies MUST NOT be changed 1482 after the construction of the PeerConnection. 1484 This call may result in a change to the state of the ICE Agent. 1486 4.1.17. addIceCandidate 1488 The addIceCandidate method provides an update to the ICE agent via an 1489 IceCandidate object Section 3.5.2.1. If the IceCandidate's candidate 1490 field is filled in, the IceCandidate is treated as a new remote ICE 1491 candidate, which will be added to the current and/or pending remote 1492 description according to the rules defined for Trickle ICE. 1493 Otherwise, the IceCandidate is treated as an end-of-candidates 1494 indication, as defined in [I-D.ietf-ice-trickle]. 1496 In either case, the m= section index, MID, and ufrag fields from the 1497 supplied IceCandidate are used to determine which m= section and ICE 1498 candidate generation the IceCandidate belongs to, as described in 1499 Section 3.5.2.1 above. In the case of an end-of-candidates 1500 indication, the absence of both the m= section index and MID fields 1501 is interpreted to mean that the indication applies to all m= sections 1502 in the specified ICE candidate generation. However, if both fields 1503 are absent for a new remote candidate, this MUST be treated as an 1504 invalid condition, as specified below. 1506 If any IceCandidate fields contain invalid values, or an error occurs 1507 during the processing of the IceCandidate object, the supplied 1508 IceCandidate MUST be ignored and an error MUST be returned. 1510 Otherwise, the new remote candidate or end-of-candidates indication 1511 is supplied to the ICE agent. In the case of a new remote candidate, 1512 connectivity checks will be sent to the new candidate. 1514 4.2. RtpTransceiver 1516 4.2.1. stop 1518 The stop method stops an RtpTransceiver. This will cause future 1519 calls to createOffer to generate a zero port for the associated m= 1520 section. See below for more details. 1522 4.2.2. stopped 1524 The stopped property indicates whether the transceiver has been 1525 stopped, either by a call to stopTransceiver or by applying an answer 1526 that rejects the associated m= section. In either of these cases, it 1527 is set to "true", and otherwise will be set to "false". 1529 A stopped RtpTransceiver does not send any outgoing RTP or RTCP or 1530 process any incoming RTP or RTCP. It cannot be restarted. 1532 4.2.3. setDirection 1534 The setDirection method sets the direction of a transceiver, which 1535 affects the direction property of the associated m= section on future 1536 calls to createOffer and createAnswer. The permitted values for 1537 direction are "recvonly", "sendrecv", "sendonly", and "inactive", 1538 mirroring the identically-named directional attributes defined in 1539 [RFC4566], Section 6. 1541 When creating offers, the transceiver direction is directly reflected 1542 in the output, even for re-offers. When creating answers, the 1543 transceiver direction is intersected with the offered direction, as 1544 explained in Section 5.3 below. 1546 Note that while setDirection sets the direction property of the 1547 transceiver immediately (Section 4.2.4), this property does not 1548 immediately affect whether the transceiver's RtpSender will send or 1549 its RtpReceiver will receive. The direction in effect is represented 1550 by the currentDirection property, which is only updated when an 1551 answer is applied. 1553 4.2.4. direction 1555 The direction property indicates the last value passed into 1556 setDirection. If setDirection has never been called, it is set to 1557 the direction the transceiver was initialized with. 1559 4.2.5. currentDirection 1561 The currentDirection property indicates the last negotiated direction 1562 for the transceiver's associated m= section. More specifically, it 1563 indicates the [RFC3264] directional attribute of the associated m= 1564 section in the last applied answer (including provisional answers), 1565 with "send" and "recv" directions reversed if it was a remote answer. 1566 For example, if the directional attribute for the associated m= 1567 section in a remote answer is "recvonly", currentDirection is set to 1568 "sendonly". 1570 If an answer that references this transceiver has not yet been 1571 applied, or if the transceiver is stopped, currentDirection is set to 1572 null. 1574 4.2.6. setCodecPreferences 1576 The setCodecPreferences method sets the codec preferences of a 1577 transceiver, which in turn affect the presence and order of codecs of 1578 the associated m= section on future calls to createOffer and 1579 createAnswer. Note that setCodecPreferences does not directly affect 1580 which codec the implementation decides to send. It only affects 1581 which codecs the implementation indicates that it prefers to receive, 1582 via the offer or answer. Even when a codec is excluded by 1583 setCodecPreferences, it still may be used to send until the next 1584 offer/answer exchange discards it. 1586 The codec preferences of an RtpTransceiver can cause codecs to be 1587 excluded by subsequent calls to createOffer and createAnswer, in 1588 which case the corresponding media formats in the associated m= 1589 section will be excluded. The codec preferences cannot add media 1590 formats that would otherwise not be present. 1592 The codec preferences of an RtpTransceiver can also determine the 1593 order of codecs in subsequent calls to createOffer and createAnswer, 1594 in which case the order of the media formats in the associated m= 1595 section will follow the specified preferences. 1597 5. SDP Interaction Procedures 1599 This section describes the specific procedures to be followed when 1600 creating and parsing SDP objects. 1602 5.1. Requirements Overview 1604 JSEP implementations must comply with the specifications listed below 1605 that govern the creation and processing of offers and answers. 1607 5.1.1. Usage Requirements 1609 All session descriptions handled by JSEP implementations, both local 1610 and remote, MUST indicate support for the following specifications. 1611 If any of these are absent, this omission MUST be treated as an 1612 error. 1614 o ICE, as specified in [RFC5245], MUST be used. Note that the 1615 remote endpoint may use a Lite implementation; implementations 1616 MUST properly handle remote endpoints which do ICE-Lite. 1618 o DTLS [RFC6347] or DTLS-SRTP [RFC5763], MUST be used, as 1619 appropriate for the media type, as specified in 1620 [I-D.ietf-rtcweb-security-arch] 1622 The SDES SRTP keying mechanism from [RFC4568] MUST NOT be used, as 1623 discussed in [I-D.ietf-rtcweb-security-arch]. 1625 5.1.2. Profile Names and Interoperability 1627 For media m= sections, JSEP implementations MUST support the 1628 "UDP/TLS/RTP/SAVPF" profile specified in [RFC5764], and MUST indicate 1629 this profile for each media m= line they produce in an offer. For 1630 data m= sections, implementations MUST support the "UDP/DTLS/SCTP" 1631 profile and MUST indicate this profile for each data m= line they 1632 produce in an offer. Although these profiles are formally associated 1633 with UDP, ICE can select either UDP [RFC5245] or TCP [RFC6544] 1634 transport depending on network conditions, even when advertising a 1635 UDP profile. 1637 Unfortunately, in an attempt at compatibility, some endpoints 1638 generate other profile strings even when they mean to support one of 1639 these profiles. For instance, an endpoint might generate "RTP/AVP" 1640 but supply "a=fingerprint" and "a=rtcp-fb" attributes, indicating its 1641 willingness to support "UDP/TLS/RTP/SAVPF" or "TCP/TLS/RTP/SAVPF". 1642 In order to simplify compatibility with such endpoints, JSEP 1643 implementations MUST follow the following rules when processing the 1644 media m= sections in a received offer: 1646 o Any profile in the offer matching one of the following MUST be 1647 accepted: 1649 * "RTP/AVP" (Defined in [RFC4566], Section 8.2.2) 1651 * "RTP/AVPF" (Defined in [RFC4585], Section 9) 1653 * "RTP/SAVP" (Defined in [RFC3711], Section 12) 1655 * "RTP/SAVPF" (Defined in [RFC5124], Section 6) 1657 * "TCP/DTLS/RTP/SAVP" (Defined in [RFC7850], Section 3.4) 1659 * "TCP/DTLS/RTP/SAVPF" (Defined in [RFC7850], Section 3.5) 1661 * "UDP/TLS/RTP/SAVP" (Defined in [RFC5764], Section 9) 1663 * "UDP/TLS/RTP/SAVPF" (Defined in [RFC5764], Section 9) 1665 o The profile in any "m=" line in any generated answer MUST exactly 1666 match the profile provided in the offer. 1668 o Because DTLS-SRTP is REQUIRED, the choice of SAVP or AVP has no 1669 effect; support for DTLS-SRTP is determined by the presence of one 1670 or more "a=fingerprint" attribute. Note that lack of an 1671 "a=fingerprint" attribute will lead to negotiation failure. 1673 o The use of AVPF or AVP simply controls the timing rules used for 1674 RTCP feedback. If AVPF is provided, or an "a=rtcp-fb" attribute 1675 is present, assume AVPF timing, i.e., a default value of "trr- 1676 int=0". Otherwise, assume that AVPF is being used in an AVP 1677 compatible mode and use a value of "trr-int=4000". 1679 o For data m= sections, implementations MUST support receiving the 1680 "UDP/DTLS/SCTP", "TCP/DTLS/SCTP", or "DTLS/SCTP" (for backwards 1681 compatibility) profiles. 1683 Note that re-offers by JSEP implementations MUST use the correct 1684 profile strings even if the initial offer/answer exchange used an 1685 (incorrect) older profile string. This simplifies JSEP behavior, 1686 with minimal downside, as any remote endpoint that fails to handle 1687 such a re-offer will also fail to handle a JSEP endpoint's initial 1688 offer. 1690 5.2. Constructing an Offer 1692 When createOffer is called, a new SDP description must be created 1693 that includes the functionality specified in 1694 [I-D.ietf-rtcweb-rtp-usage]. The exact details of this process are 1695 explained below. 1697 5.2.1. Initial Offers 1699 When createOffer is called for the first time, the result is known as 1700 the initial offer. 1702 The first step in generating an initial offer is to generate session- 1703 level attributes, as specified in [RFC4566], Section 5. 1704 Specifically: 1706 o The first SDP line MUST be "v=0", as specified in [RFC4566], 1707 Section 5.1 1709 o The second SDP line MUST be an "o=" line, as specified in 1710 [RFC4566], Section 5.2. The value of the field SHOULD 1711 be "-". The sess-id MUST be representable by a 64-bit signed 1712 integer, and the initial value MUST be less than (2**62)-1, as 1713 required by [RFC3264]. It is RECOMMENDED that the sess-id be 1714 constructed by generating a 64-bit quantity with the two highest 1715 bits being set to zero and the remaining 62 bits being 1716 cryptographically random. The value of the 1717 tuple SHOULD be set to a non-meaningful address, 1718 such as IN IP4 0.0.0.0, to prevent leaking the local address in 1719 this field. As mentioned in [RFC4566], the entire o= line needs 1720 to be unique, but selecting a random number for is 1721 sufficient to accomplish this. 1723 o The third SDP line MUST be a "s=" line, as specified in [RFC4566], 1724 Section 5.3; to match the "o=" line, a single dash SHOULD be used 1725 as the session name, e.g. "s=-". Note that this differs from the 1726 advice in [RFC4566] which proposes a single space, but as both 1727 "o=" and "s=" are meaningless in JSEP, having the same meaningless 1728 value seems clearer. 1730 o Session Information ("i="), URI ("u="), Email Address ("e="), 1731 Phone Number ("p="), Repeat Times ("r="), and Time Zones ("z=") 1732 lines are not useful in this context and SHOULD NOT be included. 1734 o Encryption Keys ("k=") lines do not provide sufficient security 1735 and MUST NOT be included. 1737 o A "t=" line MUST be added, as specified in [RFC4566], Section 5.9; 1738 both and SHOULD be set to zero, e.g. "t=0 1739 0". 1741 o An "a=ice-options" line with the "trickle" option MUST be added, 1742 as specified in [I-D.ietf-ice-trickle], Section 4. 1744 o If WebRTC identity is being used, an "a=identity" line as 1745 described in [I-D.ietf-rtcweb-security-arch], Section 5. 1747 The next step is to generate m= sections, as specified in [RFC4566], 1748 Section 5.14. An m= section is generated for each RtpTransceiver 1749 that has been added to the PeerConnection, excluding any stopped 1750 RtpTransceivers. This is done in the order the RtpTransceivers were 1751 added to the PeerConnection. 1753 For each m= section generated for an RtpTransceiver, establish a 1754 mapping between the transceiver and the index of the generated m= 1755 section. 1757 Each m= section, provided it is not marked as bundle-only, MUST 1758 generate a unique set of ICE credentials and gather its own unique 1759 set of ICE candidates. Bundle-only m= sections MUST NOT contain any 1760 ICE credentials and MUST NOT gather any candidates. 1762 For DTLS, all m= sections MUST use all the certificate(s) that have 1763 been specified for the PeerConnection; as a result, they MUST all 1764 have the same [RFC8122] fingerprint value(s), or these value(s) MUST 1765 be session-level attributes. 1767 Each m= section should be generated as specified in [RFC4566], 1768 Section 5.14. For the m= line itself, the following rules MUST be 1769 followed: 1771 o If the m= section is marked as bundle-only, then the port value 1772 MUST be set to 0. Otherwise, the port value is set to the port of 1773 the default ICE candidate for this m= section, but given that no 1774 candidates are available yet, the "dummy" port value of 9 1775 (Discard) MUST be used, as indicated in [I-D.ietf-ice-trickle], 1776 Section 5.1. 1778 o To properly indicate use of DTLS, the field MUST be set to 1779 "UDP/TLS/RTP/SAVPF", as specified in [RFC5764], Section 8. 1781 o If codec preferences have been set for the associated transceiver, 1782 media formats MUST be generated in the corresponding order, and 1783 MUST exclude any codecs not present in the codec preferences. 1785 o Unless excluded by the above restrictions, the media formats MUST 1786 include the mandatory audio/video codecs as specified in 1787 [RFC7874], Section 3, and [RFC7742], Section 5. 1789 The m= line MUST be followed immediately by a "c=" line, as specified 1790 in [RFC4566], Section 5.7. Again, as no candidates are available 1791 yet, the "c=" line must contain the "dummy" value "IN IP4 0.0.0.0", 1792 as defined in [I-D.ietf-ice-trickle], Section 5.1. 1794 [I-D.ietf-mmusic-sdp-mux-attributes] groups SDP attributes into 1795 different categories. To avoid unnecessary duplication when 1796 bundling, attributes of category IDENTICAL or TRANSPORT MUST NOT be 1797 repeated in bundled m= sections, repeating the guidance from 1798 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 8.1. This includes 1799 m= sections for which bundling has been negotiated and is still 1800 desired, as well as m= sections marked as bundle-only. 1802 The following attributes, which are of a category other than 1803 IDENTICAL or TRANSPORT, MUST be included in each m= section: 1805 o An "a=mid" line, as specified in [RFC5888], Section 4. All MID 1806 values MUST be generated in a fashion that does not leak user 1807 information, e.g., randomly or using a per-PeerConnection counter, 1808 and SHOULD be 3 bytes or less, to allow them to efficiently fit 1809 into the RTP header extension defined in 1810 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 14. Note that 1811 this does not set the RtpTransceiver mid property, as that only 1812 occurs when the description is applied. The generated MID value 1813 can be considered a "proposed" MID at this point. 1815 o A direction attribute which is the same as that of the associated 1816 transceiver. 1818 o For each media format on the m= line, "a=rtpmap" and "a=fmtp" 1819 lines, as specified in [RFC4566], Section 6, and [RFC3264], 1820 Section 5.1. 1822 o For each primary codec where RTP retransmission should be used, a 1823 corresponding "a=rtpmap" line indicating "rtx" with the clock rate 1824 of the primary codec and an "a=fmtp" line that references the 1825 payload type of the primary codec, as specified in [RFC4588], 1826 Section 8.1. 1828 o For each supported FEC mechanism, "a=rtpmap" and "a=fmtp" lines, 1829 as specified in [RFC4566], Section 6. The FEC mechanisms that 1830 MUST be supported are specified in [I-D.ietf-rtcweb-fec], 1831 Section 6, and specific usage for each media type is outlined in 1832 Sections 4 and 5. 1834 o If this m= section is for media with configurable durations of 1835 media per packet, e.g., audio, an "a=maxptime" line, indicating 1836 the maximum amount of media, specified in milliseconds, that can 1837 be encapsulated in each packet, as specified in [RFC4566], 1838 Section 6. This value is set to the smallest of the maximum 1839 duration values across all the codecs included in the m= section. 1841 o If this m= section is for video media, and there are known 1842 limitations on the size of images which can be decoded, an 1843 "a=imageattr" line, as specified in Section 3.6. 1845 o For each supported RTP header extension, an "a=extmap" line, as 1846 specified in [RFC5285], Section 5. The list of header extensions 1847 that SHOULD/MUST be supported is specified in 1848 [I-D.ietf-rtcweb-rtp-usage], Section 5.2. Any header extensions 1849 that require encryption MUST be specified as indicated in 1850 [RFC6904], Section 4. 1852 o For each supported RTCP feedback mechanism, an "a=rtcp-fb" line, 1853 as specified in [RFC4585], Section 4.2. The list of RTCP feedback 1854 mechanisms that SHOULD/MUST be supported is specified in 1855 [I-D.ietf-rtcweb-rtp-usage], Section 5.1. 1857 o If the RtpTransceiver has a sendrecv or sendonly direction: 1859 * For each MediaStream that was associated with the transceiver 1860 when it was created via addTrack or addTransceiver, an "a=msid" 1861 line, as specified in [I-D.ietf-mmusic-msid], Section 2. If a 1862 MediaStreamTrack is attached to the transceiver's RtpSender, 1863 the "a=msid" lines MUST use that track's ID. If no 1864 MediaStreamTrack is attached, a valid ID MUST be generated, in 1865 the same way that the implementation generates IDs for local 1866 tracks. 1868 * If no MediaStream is associated with the transceiver, a single 1869 "a=msid" line with the special value "-" in place of the 1870 MediaStream ID, as specified in [I-D.ietf-mmusic-msid], 1871 Section 3. The track ID MUST be selected as described above. 1873 o If the RtpTransceiver has a sendrecv or sendonly direction, and 1874 the application has specified RID values or has specified more 1875 than one encoding in the RtpSenders's parameters, an "a=rid" line 1876 for each encoding specified. The "a=rid" line is specified in 1877 [I-D.ietf-mmusic-rid], and its direction MUST be "send". If the 1878 application has chosen a RID value, it MUST be used as the rid- 1879 identifier; otherwise a RID value MUST be generated by the 1880 implementation. RID values MUST be generated in a fashion that 1881 does not leak user information, e.g., randomly or using a per- 1882 PeerConnection counter, and SHOULD be 3 bytes or less, to allow 1883 them to efficiently fit into the RTP header extension defined in 1884 [I-D.ietf-avtext-rid], Section 3. If no encodings have been 1885 specified, or only one encoding is specified but without a RID 1886 value, then no "a=rid" lines are generated. 1888 o If the RtpTransceiver has a sendrecv or sendonly direction and 1889 more than one "a=rid" line has been generated, an "a=simulcast" 1890 line, with direction "send", as defined in 1891 [I-D.ietf-mmusic-sdp-simulcast], Section 6.2. The list of RIDs 1892 MUST include all of the RID identifiers used in the "a=rid" lines 1893 for this m= section. 1895 o If the bundle policy for this PeerConnection is set to "max- 1896 bundle", and this is not the first m= section, or the bundle 1897 policy is set to "balanced", and this is not the first m= section 1898 for this media type, an "a=bundle-only" line. 1900 The following attributes, which are of category IDENTICAL or 1901 TRANSPORT, MUST appear only in "m=" sections which either have a 1902 unique address or which are associated with the bundle-tag. (In 1903 initial offers, this means those "m=" sections which do not contain 1904 an "a=bundle-only" attribute.) 1906 o "a=ice-ufrag" and "a=ice-pwd" lines, as specified in [RFC5245], 1907 Section 15.4. 1909 o For each desired digest algorithm, one or more "a=fingerprint" 1910 lines for each of the endpoint's certificates, as specified in 1911 [RFC8122], Section 5. 1913 o An "a=setup" line, as specified in [RFC4145], Section 4, and 1914 clarified for use in DTLS-SRTP scenarios in [RFC5763], Section 5. 1915 The role value in the offer MUST be "actpass". 1917 o An "a=tls-id" line, as specified in [I-D.ietf-mmusic-dtls-sdp], 1918 Section 5.2. 1920 o An "a=rtcp" line, as specified in [RFC3605], Section 2.1, 1921 containing the dummy value "9 IN IP4 0.0.0.0", because no 1922 candidates have yet been gathered. 1924 o An "a=rtcp-mux" line, as specified in [RFC5761], Section 5.1.3. 1926 o If the RTP/RTCP multiplexing policy is "require", an "a=rtcp-mux- 1927 only" line, as specified in [I-D.ietf-mmusic-mux-exclusive], 1928 Section 4. 1930 o An "a=rtcp-rsize" line, as specified in [RFC5506], Section 5. 1932 Lastly, if a data channel has been created, a m= section MUST be 1933 generated for data. The field MUST be set to "application" 1934 and the field MUST be set to "UDP/DTLS/SCTP" 1935 [I-D.ietf-mmusic-sctp-sdp]. The "fmt" value MUST be set to "webrtc- 1936 datachannel" as specified in [I-D.ietf-mmusic-sctp-sdp], Section 4.1. 1938 Within the data m= section, an "a=mid" line MUST be generated and 1939 included as described above, along with an "a=sctp-port" line 1940 referencing the SCTP port number, as defined in 1941 [I-D.ietf-mmusic-sctp-sdp], Section 5.1, and, if appropriate, an 1942 "a=max-message-size" line, as defined in [I-D.ietf-mmusic-sctp-sdp], 1943 Section 6.1. 1945 As discussed above, the following attributes of category IDENTICAL or 1946 TRANSPORT are included only if the data m= section either has a 1947 unique address or is associated with the bundle-tag (e.g., if it is 1948 the only m= section): 1950 o "a=ice-ufrag" 1952 o "a=ice-pwd" 1954 o "a=fingerprint" 1956 o "a=setup" 1957 o "a=tls-id" 1959 Once all m= sections have been generated, a session-level "a=group" 1960 attribute MUST be added as specified in [RFC5888]. This attribute 1961 MUST have semantics "BUNDLE", and MUST include the mid identifiers of 1962 each m= section. The effect of this is that the JSEP implementation 1963 offers all m= sections as one bundle group. However, whether the m= 1964 sections are bundle-only or not depends on the bundle policy. 1966 The next step is to generate session-level lip sync groups as defined 1967 in [RFC5888], Section 7. For each MediaStream referenced by more 1968 than one RtpTransceiver (by passing those MediaStreams as arguments 1969 to the addTrack and addTransceiver methods), a group of type "LS" 1970 MUST be added that contains the mid values for each RtpTransceiver. 1972 Attributes which SDP permits to either be at the session level or the 1973 media level SHOULD generally be at the media level even if they are 1974 identical. This assists development and debugging by making it 1975 easier to understand individual media sections, especially if one of 1976 a set of initially identical attributes is subsequently changed. 1977 However, implementations MAY choose to aggregate attributes at the 1978 session level and JSEP implementations MUST be prepared to receive 1979 attributes in either location. 1981 Attributes other than the ones specified above MAY be included, 1982 except for the following attributes which are specifically 1983 incompatible with the requirements of [I-D.ietf-rtcweb-rtp-usage], 1984 and MUST NOT be included: 1986 o "a=crypto" 1988 o "a=key-mgmt" 1990 o "a=ice-lite" 1992 Note that when bundle is used, any additional attributes that are 1993 added MUST follow the advice in [I-D.ietf-mmusic-sdp-mux-attributes] 1994 on how those attributes interact with bundle. 1996 Note that these requirements are in some cases stricter than those of 1997 SDP. Implementations MUST be prepared to accept compliant SDP even 1998 if it would not conform to the requirements for generating SDP in 1999 this specification. 2001 5.2.2. Subsequent Offers 2003 When createOffer is called a second (or later) time, or is called 2004 after a local description has already been installed, the processing 2005 is somewhat different than for an initial offer. 2007 If the previous offer was not applied using setLocalDescription, 2008 meaning the PeerConnection is still in the "stable" state, the steps 2009 for generating an initial offer should be followed, subject to the 2010 following restriction: 2012 o The fields of the "o=" line MUST stay the same except for the 2013 field, which MUST increment by one on each call 2014 to createOffer if the offer might differ from the output of the 2015 previous call to createOffer; implementations MAY opt to increment 2016 on every call. The value of the generated 2017 is independent of the of the 2018 current local description; in particular, in the case where the 2019 current version is N, an offer is created and applied with version 2020 N+1, and then that offer is rolled back so that the current 2021 version is again N, the next generated offer will still have 2022 version N+2. 2024 Note that if the application creates an offer by reading 2025 currentLocalDescription instead of calling createOffer, the returned 2026 SDP may be different than when setLocalDescription was originally 2027 called, due to the addition of gathered ICE candidates, but the 2028 will not have changed. There are no known 2029 scenarios in which this causes problems, but if this is a concern, 2030 the solution is simply to use createOffer to ensure a unique 2031 . 2033 If the previous offer was applied using setLocalDescription, but a 2034 corresponding answer from the remote side has not yet been applied, 2035 meaning the PeerConnection is still in the "have-local-offer" state, 2036 an offer is generated by following the steps in the "stable" state 2037 above, along with these exceptions: 2039 o The "s=" and "t=" lines MUST stay the same. 2041 o If any RtpTransceiver has been added, and there exists an m= 2042 section with a zero port in the current local description or the 2043 current remote description, that m= section MUST be recycled by 2044 generating an m= section for the added RtpTransceiver as if the m= 2045 section were being added to the session description (including a 2046 new MID value), and placing it at the same index as the m= section 2047 with a zero port. 2049 o If an RtpTransceiver is stopped and is not associated with an m= 2050 section, an m= section MUST NOT be generated for it. This 2051 prevents adding back RtpTransceivers whose m= sections were 2052 recycled and used for a new RtpTransceiver in a previous offer/ 2053 answer exchange, as described above. 2055 o If an RtpTransceiver has been stopped and is associated with an m= 2056 section, and the m= section is not being recycled as described 2057 above, an m= section MUST be generated for it with the port set to 2058 zero and all "a=msid" lines removed. 2060 o For RtpTransceivers that are not stopped, the "a=msid" line(s) 2061 MUST stay the same if they are present in the current description, 2062 regardless of changes to the transceiver's direction or track. If 2063 no "a=msid" line is present in the current description, "a=msid" 2064 line(s) MUST be generated according to the same rules as for an 2065 initial offer. 2067 o Each "m=" and c=" line MUST be filled in with the port, protocol, 2068 and address of the default candidate for the m= section, as 2069 described in [RFC5245], Section 4.3. If ICE checking has already 2070 completed for one or more candidate pairs and a candidate pair is 2071 in active use, then that pair MUST be used, even if ICE has not 2072 yet completed. Note that this differs from the guidance in 2073 [RFC5245], Section 9.1.2.2, which only refers to offers created 2074 when ICE has completed. In each case, if no RTP candidates have 2075 yet been gathered, dummy values MUST be used, as described above. 2077 o Each "a=mid" line MUST stay the same. 2079 o Each "a=ice-ufrag" and "a=ice-pwd" line MUST stay the same, unless 2080 the ICE configuration has changed (either changes to the supported 2081 STUN/TURN servers, or the ICE candidate policy), or the 2082 "IceRestart" option ( Section 5.2.3.1 was specified. If the m= 2083 section is bundled into another m= section, it still MUST NOT 2084 contain any ICE credentials. 2086 o If the m= section is not bundled into another m= section, its 2087 "a=rtcp" attribute line MUST be filled in with the port and 2088 address of the default RTCP candidate, as indicated in [RFC5761], 2089 Section 5.1.3. If no RTCP candidates have yet been gathered, 2090 dummy values MUST be used, as described in the initial offer 2091 section above. 2093 o If the m= section is not bundled into another m= section, for each 2094 candidate that has been gathered during the most recent gathering 2095 phase (see Section 3.5.1), an "a=candidate" line MUST be added, as 2096 defined in [RFC5245], Section 4.3., paragraph 3. If candidate 2097 gathering for the section has completed, an "a=end-of-candidates" 2098 attribute MUST be added, as described in [I-D.ietf-ice-trickle], 2099 Section 9.3. If the m= section is bundled into another m= 2100 section, both "a=candidate" and "a=end-of-candidates" MUST be 2101 omitted. 2103 o For RtpTransceivers that are still present, the "a=rid" lines MUST 2104 stay the same. 2106 o For RtpTransceivers that are still present, any "a=simulcast" line 2107 MUST stay the same. 2109 If the previous offer was applied using setLocalDescription, and a 2110 corresponding answer from the remote side has been applied using 2111 setRemoteDescription, meaning the PeerConnection is in the "have- 2112 remote-pranswer" or "stable" states, an offer is generated based on 2113 the negotiated session descriptions by following the steps mentioned 2114 for the "have-local-offer" state above. 2116 In addition, for each existing, non-recycled, non-rejected m= section 2117 in the new offer, the following adjustments are made based on the 2118 contents of the corresponding m= section in the current local or 2119 remote description, as appropriate: 2121 o The m= line and corresponding "a=rtpmap" and "a=fmtp" lines MUST 2122 only include media formats which have not been excluded by the 2123 codec preferences of the associated transceiver, and MUST include 2124 all currently available formats. Media formats that were 2125 previously offered but are no longer available (e.g., a shared 2126 hardware codec) MAY be excluded. 2128 o Unless codec preferences have been set for the associated 2129 transceiver, the media formats on the m= line MUST be generated in 2130 the same order as in the most recent answer. Any media formats 2131 that were not present in the most recent answer MUST be added 2132 after all existing formats. 2134 o The RTP header extensions MUST only include those that are present 2135 in the most recent answer. 2137 o The RTCP feedback mechanisms MUST only include those that are 2138 present in the most recent answer, except for the case of format- 2139 specific mechanisms that are referencing a newly-added media 2140 format. 2142 o The "a=rtcp" line MUST NOT be added if the most recent answer 2143 included an "a=rtcp-mux" line. 2145 o The "a=rtcp-mux" line MUST be the same as that in the most recent 2146 answer. 2148 o The "a=rtcp-mux-only" line MUST NOT be added. 2150 o The "a=rtcp-rsize" line MUST NOT be added unless present in the 2151 most recent answer. 2153 o An "a=bundle-only" line MUST NOT be added, as indicated in 2154 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 6. Instead, 2155 JSEP implementations MUST simply omit parameters in the IDENTICAL 2156 and TRANSPORT categories for bundled m= sections, as described in 2157 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 8.1. 2159 o Note that if media m= sections are bundled into a data m= section, 2160 then certain TRANSPORT and IDENTICAL attributes may appear in the 2161 data m= section even if they would otherwise only be appropriate 2162 for a media m= section (e.g., "a=rtcp-mux"). This cannot happen 2163 in initial offers because in the initial offer JSEP 2164 implementations always list media m= sections (if any) before the 2165 data m= section (if any), and at least one of those media m= 2166 sections will not have the "a=bundle-only" attribute. Therefore, 2167 in initial offers, any "a=bundle-only" m= sections will be bundled 2168 into a preceding non-bundle-only media m= section. 2170 The "a=group:BUNDLE" attribute MUST include the MID identifiers 2171 specified in the bundle group in the most recent answer, minus any m= 2172 sections that have been marked as rejected, plus any newly added or 2173 re-enabled m= sections. In other words, the bundle attribute must 2174 contain all m= sections that were previously bundled, as long as they 2175 are still alive, as well as any new m= sections. 2177 "a=group:LS" attributes are generated in the same way as for initial 2178 offers, with the additional stipulation that any lip sync groups that 2179 were present in the most recent answer MUST continue to exist and 2180 MUST contain any previously existing MID identifiers, as long as the 2181 identified m= sections still exist and are not rejected, and the 2182 group still contains at least two MID identifiers. This ensures that 2183 any synchronized "recvonly" m= sections continue to be synchronized 2184 in the new offer. 2186 5.2.3. Options Handling 2188 The createOffer method takes as a parameter an RTCOfferOptions 2189 object. Special processing is performed when generating a SDP 2190 description if the following options are present. 2192 5.2.3.1. IceRestart 2194 If the "IceRestart" option is specified, with a value of "true", the 2195 offer MUST indicate an ICE restart by generating new ICE ufrag and 2196 pwd attributes, as specified in [RFC5245], Section 9.1.1.1. If this 2197 option is specified on an initial offer, it has no effect (since a 2198 new ICE ufrag and pwd are already generated). Similarly, if the ICE 2199 configuration has changed, this option has no effect, since new ufrag 2200 and pwd attributes will be generated automatically. This option is 2201 primarily useful for reestablishing connectivity in cases where 2202 failures are detected by the application. 2204 5.2.3.2. VoiceActivityDetection 2206 Silence suppression, also known as discontinuous transmission 2207 ("DTX"), can reduce the bandwidth used for audio by switching to a 2208 special encoding when voice activity is not detected, at the cost of 2209 some fidelity. 2211 If the "VoiceActivityDetection" option is specified, with a value of 2212 "true", the offer MUST indicate support for silence suppression in 2213 the audio it receives by including comfort noise ("CN") codecs for 2214 each offered audio codec, as specified in [RFC3389], Section 5.1, 2215 except for codecs that have their own internal silence suppression 2216 support. For codecs that have their own internal silence suppression 2217 support, the appropriate fmtp parameters for that codec MUST be 2218 specified to indicate that silence suppression for received audio is 2219 desired. For example, when using the Opus codec [RFC6716], the 2220 "usedtx=1" parameter, specified in [RFC7587], would be used in the 2221 offer. 2223 If the "VoiceActivityDetection" option is specified, with a value of 2224 "false", the JSEP implementation MUST NOT emit "CN" codecs. For 2225 codecs that have their own internal silence suppression support, the 2226 appropriate fmtp parameters for that codec MUST be specified to 2227 indicate that silence suppression for received audio is not desired. 2228 For example, when using the Opus codec, the "usedtx=0" parameter 2229 would be specified in the offer. In addition, the implementation 2230 MUST NOT use silence suppression for media it generates, regardless 2231 of whether the "CN" codecs or related fmtp parameters appear in the 2232 peer's description. The impact of these rules is that silence 2233 suppression in JSEP depends on mutual agreement of both sides, which 2234 ensures consistent handling regardless of which codec is used. 2236 The "VoiceActivityDetection" option does not have any impact on the 2237 setting of the "vad" value in the signaling of the client to mixer 2238 audio level header extension described in [RFC6464], Section 4. 2240 5.3. Generating an Answer 2242 When createAnswer is called, a new SDP description must be created 2243 that is compatible with the supplied remote description as well as 2244 the requirements specified in [I-D.ietf-rtcweb-rtp-usage]. The exact 2245 details of this process are explained below. 2247 5.3.1. Initial Answers 2249 When createAnswer is called for the first time after a remote 2250 description has been provided, the result is known as the initial 2251 answer. If no remote description has been installed, an answer 2252 cannot be generated, and an error MUST be returned. 2254 Note that the remote description SDP may not have been created by a 2255 JSEP endpoint and may not conform to all the requirements listed in 2256 Section 5.2. For many cases, this is not a problem. However, if any 2257 mandatory SDP attributes are missing, or functionality listed as 2258 mandatory-to-use above is not present, this MUST be treated as an 2259 error, and MUST cause the affected m= sections to be marked as 2260 rejected. 2262 The first step in generating an initial answer is to generate 2263 session-level attributes. The process here is identical to that 2264 indicated in the initial offers section above, except that the 2265 "a=ice-options" line, with the "trickle" option as specified in 2266 [I-D.ietf-ice-trickle], Section 4, is only included if such an option 2267 was present in the offer. 2269 The next step is to generate session-level lip sync groups, as 2270 defined in [RFC5888], Section 7. For each group of type "LS" present 2271 in the offer, select the local RtpTransceivers that are referenced by 2272 the MID values in the specified group, and determine which of them 2273 either reference a common local MediaStream (specified in the calls 2274 to addTrack/addTransceiver used to create them), or have no 2275 MediaStream to reference because they were not created by addTrack/ 2276 addTransceiver. If at least two such RtpTransceivers exist, a group 2277 of type "LS" with the mid values of these RtpTransceivers MUST be 2278 added. Otherwise the offered "LS" group MUST be ignored and no 2279 corresponding group generated in the answer. 2281 As a simple example, consider the following offer of a single audio 2282 and single video track contained in the same MediaStream. SDP lines 2283 not relevant to this example have been removed for clarity. As 2284 explained in Section 5.2, a group of type "LS" has been added that 2285 references each track's RtpTransceiver. 2287 a=group:LS a1 v1 2288 m=audio 10000 UDP/TLS/RTP/SAVPF 0 2289 a=mid:a1 2290 a=msid:ms1 mst1a 2291 m=video 10001 UDP/TLS/RTP/SAVPF 96 2292 a=mid:v1 2293 a=msid:ms1 mst1v 2295 If the answerer uses a single MediaStream when it adds its tracks, 2296 both of its transceivers will reference this stream, and so the 2297 subsequent answer will contain a "LS" group identical to that in the 2298 offer, as shown below: 2300 a=group:LS a1 v1 2301 m=audio 20000 UDP/TLS/RTP/SAVPF 0 2302 a=mid:a1 2303 a=msid:ms2 mst2a 2304 m=video 20001 UDP/TLS/RTP/SAVPF 96 2305 a=mid:v1 2306 a=msid:ms2 mst2v 2308 However, if the answerer groups its tracks into separate 2309 MediaStreams, its transceivers will reference different streams, and 2310 so the subsequent answer will not contain a "LS" group. 2312 m=audio 20000 UDP/TLS/RTP/SAVPF 0 2313 a=mid:a1 2314 a=msid:ms2a mst2a 2315 m=video 20001 UDP/TLS/RTP/SAVPF 96 2316 a=mid:v1 2317 a=msid:ms2b mst2v 2319 Finally, if the answerer does not add any tracks, its transceivers 2320 will not reference any MediaStreams, causing the preferences of the 2321 offerer to be maintained, and so the subsequent answer will contain 2322 an identical "LS" group. 2324 a=group:LS a1 v1 2325 m=audio 20000 UDP/TLS/RTP/SAVPF 0 2326 a=mid:a1 2327 a=recvonly 2328 m=video 20001 UDP/TLS/RTP/SAVPF 96 2329 a=mid:v1 2330 a=recvonly 2332 The Section 7.2 example later in this document shows a more involved 2333 case of "LS" group generation. 2335 The next step is to generate m= sections for each m= section that is 2336 present in the remote offer, as specified in [RFC3264], Section 6. 2337 For the purposes of this discussion, any session-level attributes in 2338 the offer that are also valid as media-level attributes are 2339 considered to be present in each m= section. Each offered m= section 2340 will have an associated RtpTransceiver, as described in Section 5.9. 2341 If there are more RtpTransceivers than there are m= sections, the 2342 unmatched RtpTransceivers will need to be associated in a subsequent 2343 offer. 2345 For each offered m= section, if any of the following conditions are 2346 true, the corresponding m= section in the answer MUST be marked as 2347 rejected by setting the port in the m= line to zero, as indicated in 2348 [RFC3264], Section 6, and further processing for this m= section can 2349 be skipped: 2351 o The associated RtpTransceiver has been stopped. 2353 o None of the offered media formats are supported and, if 2354 applicable, allowed by codec preferences. 2356 o The bundle policy is "max-bundle", and this is not the first m= 2357 section or in the same bundle group as the first m= section. 2359 o The bundle policy is "balanced", and this is not the first m= 2360 section for this media type or in the same bundle group as the 2361 first m= section for this media type. 2363 Otherwise, each m= section in the answer should then be generated as 2364 specified in [RFC3264], Section 6.1. For the m= line itself, the 2365 following rules must be followed: 2367 o The port value would normally be set to the port of the default 2368 ICE candidate for this m= section, but given that no candidates 2369 are available yet, the "dummy" port value of 9 (Discard) MUST be 2370 used, as indicated in [I-D.ietf-ice-trickle], Section 5.1. 2372 o The field MUST be set to exactly match the field 2373 for the corresponding m= line in the offer. 2375 o If codec preferences have been set for the associated transceiver, 2376 media formats MUST be generated in the corresponding order, 2377 regardless of what was offered, and MUST exclude any codecs not 2378 present in the codec preferences. 2380 o Otherwise, the media formats on the m= line MUST be generated in 2381 the same order as those offered in the current remote description, 2382 excluding any currently unsupported formats. Any currently 2383 available media formats that are not present in the current remote 2384 description MUST be added after all existing formats. 2386 o In either case, the media formats in the answer MUST include at 2387 least one format that is present in the offer, but MAY include 2388 formats that are locally supported but not present in the offer, 2389 as mentioned in [RFC3264], Section 6.1. If no common format 2390 exists, the m= section is rejected as described above. 2392 The m= line MUST be followed immediately by a "c=" line, as specified 2393 in [RFC4566], Section 5.7. Again, as no candidates are available 2394 yet, the "c=" line must contain the "dummy" value "IN IP4 0.0.0.0", 2395 as defined in [I-D.ietf-ice-trickle], Section 5.1. 2397 If the offer supports bundle, all m= sections to be bundled must use 2398 the same ICE credentials and candidates; all m= sections not being 2399 bundled must use unique ICE credentials and candidates. Each m= 2400 section MUST contain the following attributes (which are of attribute 2401 types other than IDENTICAL and TRANSPORT): 2403 o If and only if present in the offer, an "a=mid" line, as specified 2404 in [RFC5888], Section 9.1. The "mid" value MUST match that 2405 specified in the offer. 2407 o A direction attribute, determined by applying the rules regarding 2408 the offered direction specified in [RFC3264], Section 6.1, and 2409 then intersecting with the direction of the associated 2410 RtpTransceiver. For example, in the case where an m= section is 2411 offered as "sendonly", and the local transceiver is set to 2412 "sendrecv", the result in the answer is a "recvonly" direction. 2414 o For each media format on the m= line, "a=rtpmap" and "a=fmtp" 2415 lines, as specified in [RFC4566], Section 6, and [RFC3264], 2416 Section 6.1. 2418 o If "rtx" is present in the offer, for each primary codec where RTP 2419 retransmission should be used, a corresponding "a=rtpmap" line 2420 indicating "rtx" with the clock rate of the primary codec and an 2421 "a=fmtp" line that references the payload type of the primary 2422 codec, as specified in [RFC4588], Section 8.1. 2424 o For each supported FEC mechanism, "a=rtpmap" and "a=fmtp" lines, 2425 as specified in [RFC4566], Section 6. The FEC mechanisms that 2426 MUST be supported are specified in [I-D.ietf-rtcweb-fec], 2427 Section 6, and specific usage for each media type is outlined in 2428 Sections 4 and 5. 2430 o If this m= section is for media with configurable durations of 2431 media per packet, e.g., audio, an "a=maxptime" line, as described 2432 in Section 5.2. 2434 o If this m= section is for video media, and there are known 2435 limitations on the size of images which can be decoded, an 2436 "a=imageattr" line, as specified in Section 3.6. 2438 o For each supported RTP header extension that is present in the 2439 offer, an "a=extmap" line, as specified in [RFC5285], Section 5. 2440 The list of header extensions that SHOULD/MUST be supported is 2441 specified in [I-D.ietf-rtcweb-rtp-usage], Section 5.2. Any header 2442 extensions that require encryption MUST be specified as indicated 2443 in [RFC6904], Section 4. 2445 o For each supported RTCP feedback mechanism that is present in the 2446 offer, an "a=rtcp-fb" line, as specified in [RFC4585], 2447 Section 4.2. The list of RTCP feedback mechanisms that SHOULD/ 2448 MUST be supported is specified in [I-D.ietf-rtcweb-rtp-usage], 2449 Section 5.1. 2451 o If the RtpTransceiver has a sendrecv or sendonly direction: 2453 * For each MediaStream that was associated with the transceiver 2454 when it was created via addTrack or addTransceiver, an "a=msid" 2455 line, as specified in [I-D.ietf-mmusic-msid], Section 2. If a 2456 MediaStreamTrack is attached to the transceiver's RtpSender, 2457 the "a=msid" lines MUST use that track's ID. If no 2458 MediaStreamTrack is attached, a valid ID MUST be generated, in 2459 the same way that the implementation generates IDs for local 2460 tracks. 2462 * If no MediaStream is associated with the transceiver, a single 2463 "a=msid" line with the special value "-" in place of the 2464 MediaStream ID, as specified in [I-D.ietf-mmusic-msid], 2465 Section 3. The track ID MUST be selected as described above. 2467 Each m= section which is not bundled into another m= section, MUST 2468 contain the following attributes (which are of category IDENTICAL or 2469 TRANSPORT): 2471 o "a=ice-ufrag" and "a=ice-pwd" lines, as specified in [RFC5245], 2472 Section 15.4. 2474 o For each desired digest algorithm, one or more "a=fingerprint" 2475 lines for each of the endpoint's certificates, as specified in 2476 [RFC8122], Section 5. 2478 o An "a=setup" line, as specified in [RFC4145], Section 4, and 2479 clarified for use in DTLS-SRTP scenarios in [RFC5763], Section 5. 2480 The role value in the answer MUST be "active" or "passive". When 2481 the offer contains the "actpass" value, as will always be the case 2482 with JSEP endpoints, the answerer SHOULD use the "active" role. 2483 Offers from non-JSEP endpoints MAY send other values for 2484 "a=setup", in which case the answer MUST use a value consistent 2485 with the value in the offer. 2487 o An "a=tls-id" line, as specified in [I-D.ietf-mmusic-dtls-sdp], 2488 Section 5.3. 2490 o If present in the offer, an "a=rtcp-mux" line, as specified in 2491 [RFC5761], Section 5.1.3. Otherwise, an "a=rtcp" line, as 2492 specified in [RFC3605], Section 2.1, containing the dummy value "9 2493 IN IP4 0.0.0.0" (because no candidates have yet been gathered). 2495 o If present in the offer, an "a=rtcp-rsize" line, as specified in 2496 [RFC5506], Section 5. 2498 If a data channel m= section has been offered, a m= section MUST also 2499 be generated for data. The field MUST be set to 2500 "application" and the and fields MUST be set to exactly 2501 match the fields in the offer. 2503 Within the data m= section, an "a=mid" line MUST be generated and 2504 included as described above, along with an "a=sctp-port" line 2505 referencing the SCTP port number, as defined in 2506 [I-D.ietf-mmusic-sctp-sdp], Section 5.1, and, if appropriate, an 2507 "a=max-message-size" line, as defined in [I-D.ietf-mmusic-sctp-sdp], 2508 Section 6.1. 2510 As discussed above, the following attributes of category IDENTICAL or 2511 TRANSPORT are included only if the data m= section is not bundled 2512 into another m= section: 2514 o "a=ice-ufrag" 2515 o "a=ice-pwd" 2517 o "a=fingerprint" 2519 o "a=setup" 2521 o "a=tls-id" 2523 Note that if media m= sections are bundled into a data m= section, 2524 then certain TRANSPORT and IDENTICAL attributes may also appear in 2525 the data m= section even if they would otherwise only be appropriate 2526 for a media m= section (e.g., "a=rtcp-mux"). 2528 If "a=group" attributes with semantics of "BUNDLE" are offered, 2529 corresponding session-level "a=group" attributes MUST be added as 2530 specified in [RFC5888]. These attributes MUST have semantics 2531 "BUNDLE", and MUST include the all mid identifiers from the offered 2532 bundle groups that have not been rejected. Note that regardless of 2533 the presence of "a=bundle-only" in the offer, no m= sections in the 2534 answer should have an "a=bundle-only" line. 2536 Attributes that are common between all m= sections MAY be moved to 2537 session-level, if explicitly defined to be valid at session-level. 2539 The attributes prohibited in the creation of offers are also 2540 prohibited in the creation of answers. 2542 5.3.2. Subsequent Answers 2544 When createAnswer is called a second (or later) time, or is called 2545 after a local description has already been installed, the processing 2546 is somewhat different than for an initial answer. 2548 If the previous answer was not applied using setLocalDescription, 2549 meaning the PeerConnection is still in the "have-remote-offer" state, 2550 the steps for generating an initial answer should be followed, 2551 subject to the following restriction: 2553 o The fields of the "o=" line MUST stay the same except for the 2554 field, which MUST increment if the session 2555 description changes in any way from the previously generated 2556 answer. 2558 If any session description was previously supplied to 2559 setLocalDescription, an answer is generated by following the steps in 2560 the "have-remote-offer" state above, along with these exceptions: 2562 o The "s=" and "t=" lines MUST stay the same. 2564 o Each "m=" and c=" line MUST be filled in with the port and address 2565 of the default candidate for the m= section, as described in 2566 [RFC5245], Section 4.3. Note, however, that the m= line protocol 2567 need not match the default candidate, because this protocol value 2568 must instead match what was supplied in the offer, as described 2569 above. 2571 o Each "a=ice-ufrag" and "a=ice-pwd" line MUST stay the same, unless 2572 the m= section is restarting, in which case new ICE credentials 2573 must be created as specified in [RFC5245], Section 9.2.1.1. If 2574 the m= section is bundled into another m= section, it still MUST 2575 NOT contain any ICE credentials. 2577 o Each "a=setup" line MUST use an "active" or "passive" role value 2578 consistent with the existing DTLS association, if the association 2579 is being continued by the offerer. 2581 o RTCP multiplexing must be used, and an "a=rtcp-mux" line inserted 2582 if and only if the m= section previously used RTCP multiplexing. 2584 o If the m= section is not bundled into another m= section and RTCP 2585 multiplexing is not active, an "a=rtcp" attribute line MUST be 2586 filled in with the port and address of the default RTCP candidate. 2587 If no RTCP candidates have yet been gathered, dummy values MUST be 2588 used, as described in the initial answer section above. 2590 o If the m= section is not bundled into another m= section, for each 2591 candidate that has been gathered during the most recent gathering 2592 phase (see Section 3.5.1), an "a=candidate" line MUST be added, as 2593 defined in [RFC5245], Section 4.3., paragraph 3. If candidate 2594 gathering for the section has completed, an "a=end-of-candidates" 2595 attribute MUST be added, as described in [I-D.ietf-ice-trickle], 2596 Section 9.3. If the m= section is bundled into another m= 2597 section, both "a=candidate" and "a=end-of-candidates" MUST be 2598 omitted. 2600 o For RtpTransceivers that are not stopped, the "a=msid" line(s) 2601 MUST stay the same, regardless of changes to the transceiver's 2602 direction or track. If no "a=msid" line is present in the current 2603 description, "a=msid" line(s) MUST be generated according to the 2604 same rules as for an initial answer. 2606 5.3.3. Options Handling 2608 The createAnswer method takes as a parameter an RTCAnswerOptions 2609 object. The set of parameters for RTCAnswerOptions is different than 2610 those supported in RTCOfferOptions; the IceRestart option is 2611 unnecessary, as ICE credentials will automatically be changed for all 2612 m= sections where the offerer chose to perform ICE restart. 2614 The following options are supported in RTCAnswerOptions. 2616 5.3.3.1. VoiceActivityDetection 2618 Silence suppression in the answer is handled as described in 2619 Section 5.2.3.2, with one exception: if support for silence 2620 suppression was not indicated in the offer, the 2621 VoiceActivityDetection parameter has no effect, and the answer should 2622 be generated as if VoiceActivityDetection was set to false. This is 2623 done on a per-codec basis (e.g., if the offerer somehow offered 2624 support for CN but set "usedtx=0" for Opus, setting 2625 VoiceActivityDetection to true would result in an answer with CN 2626 codecs and "usedtx=0"). The impact of this rule is that an answerer 2627 will not try to use silence suppression with any endpoint that does 2628 not offer it, making silence suppression support bilateral even with 2629 non-JSEP endpoints. 2631 5.4. Modifying an Offer or Answer 2633 The SDP returned from createOffer or createAnswer MUST NOT be changed 2634 before passing it to setLocalDescription. If precise control over 2635 the SDP is needed, the aforementioned createOffer/createAnswer 2636 options or RtpTransceiver APIs MUST be used. 2638 After calling setLocalDescription with an offer or answer, the 2639 application MAY modify the SDP to reduce its capabilities before 2640 sending it to the far side, as long as it follows the rules above 2641 that define a valid JSEP offer or answer. Likewise, an application 2642 that has received an offer or answer from a peer MAY modify the 2643 received SDP, subject to the same constraints, before calling 2644 setRemoteDescription. 2646 As always, the application is solely responsible for what it sends to 2647 the other party, and all incoming SDP will be processed by the JSEP 2648 implementation to the extent of its capabilities. It is an error to 2649 assume that all SDP is well-formed; however, one should be able to 2650 assume that any implementation of this specification will be able to 2651 process, as a remote offer or answer, unmodified SDP coming from any 2652 other implementation of this specification. 2654 5.5. Processing a Local Description 2656 When a SessionDescription is supplied to setLocalDescription, the 2657 following steps MUST be performed: 2659 o If the description is of type "rollback", follow the processing 2660 defined in Section 4.1.8.2 and skip the processing described in 2661 the rest of this section. 2663 o Otherwise, the type of the SessionDescription is checked against 2664 the current state of the PeerConnection: 2666 * If the type is "offer", the PeerConnection state MUST be either 2667 "stable" or "have-local-offer". 2669 * If the type is "pranswer" or "answer", the PeerConnection state 2670 MUST be either "have-remote-offer" or "have-local-pranswer". 2672 o If the type is not correct for the current state, processing MUST 2673 stop and an error MUST be returned. 2675 o The SessionDescription is then checked to ensure that its contents 2676 are identical to those generated in the last call to createOffer/ 2677 createAnswer, and thus have not been altered, as discussed in 2678 Section 5.4; otherwise, processing MUST stop and an error MUST be 2679 returned. 2681 o Next, the SessionDescription is parsed into a data structure, as 2682 described in Section 5.7 below. 2684 o Finally, the parsed SessionDescription is applied as described in 2685 Section 5.8 below. 2687 5.6. Processing a Remote Description 2689 When a SessionDescription is supplied to setRemoteDescription, the 2690 following steps MUST be performed: 2692 o If the description is of type "rollback", follow the processing 2693 defined in Section 4.1.8.2 and skip the processing described in 2694 the rest of this section. 2696 o Otherwise, the type of the SessionDescription is checked against 2697 the current state of the PeerConnection: 2699 * If the type is "offer", the PeerConnection state MUST be either 2700 "stable" or "have-remote-offer". 2702 * If the type is "pranswer" or "answer", the PeerConnection state 2703 MUST be either "have-local-offer" or "have-remote-pranswer". 2705 o If the type is not correct for the current state, processing MUST 2706 stop and an error MUST be returned. 2708 o Next, the SessionDescription is parsed into a data structure, as 2709 described in Section 5.7 below. If parsing fails for any reason, 2710 processing MUST stop and an error MUST be returned. 2712 o Finally, the parsed SessionDescription is applied as described in 2713 Section 5.9 below. 2715 5.7. Parsing a Session Description 2717 The SDP contained in the session description object consists of a 2718 sequence of text lines, each containing a key-value expression, as 2719 described in [RFC4566], Section 5. The SDP is read, line-by-line, 2720 and converted to a data structure that contains the deserialized 2721 information. However, SDP allows many types of lines, not all of 2722 which are relevant to JSEP applications. For each line, the 2723 implementation will first ensure it is syntactically correct 2724 according to its defining ABNF, check that it conforms to [RFC4566] 2725 and [RFC3264] semantics, and then either parse and store or discard 2726 the provided value, as described below. 2728 If any line is not well-formed, or cannot be parsed as described, the 2729 parser MUST stop with an error and reject the session description, 2730 even if the value is to be discarded. This ensures that 2731 implementations do not accidentally misinterpret ambiguous SDP. 2733 5.7.1. Session-Level Parsing 2735 First, the session-level lines are checked and parsed. These lines 2736 MUST occur in a specific order, and with a specific syntax, as 2737 defined in [RFC4566], Section 5. Note that while the specific line 2738 types (e.g. "v=", "c=") MUST occur in the defined order, lines of the 2739 same type (typically "a=") can occur in any order. 2741 The following non-attribute lines are not meaningful in the JSEP 2742 context and MAY be discarded once they have been checked. 2744 The "c=" line MUST be checked for syntax but its value is only 2745 used for ICE mismatch detection, as defined in [RFC5245], 2746 Section 6.1. Note that JSEP implementations should never 2747 encounter this condition because ICE is required for WebRTC. 2749 The "i=", "u=", "e=", "p=", "t=", "r=", "z=", and "k=" lines are 2750 not used by this specification; they MUST be checked for syntax 2751 but their values are not used. 2753 The remaining non-attribute lines are processed as follows: 2755 The "v=" line MUST have a version of 0, as specified in [RFC4566], 2756 Section 5.1. 2758 The "o=" line MUST be parsed as specified in [RFC4566], 2759 Section 5.2. 2761 The "b=" line, if present, MUST be parsed as specified in 2762 [RFC4566], Section 5.8, and the bwtype and bandwidth values 2763 stored. 2765 Finally, the attribute lines are processed. Specific processing MUST 2766 be applied for the following session-level attribute ("a=") lines: 2768 o Any "a=group" lines are parsed as specified in [RFC5888], 2769 Section 5, and the group's semantics and mids are stored. 2771 o If present, a single "a=ice-lite" line is parsed as specified in 2772 [RFC5245], Section 15.3, and a value indicating the presence of 2773 ice-lite is stored. 2775 o If present, a single "a=ice-ufrag" line is parsed as specified in 2776 [RFC5245], Section 15.4, and the ufrag value is stored. 2778 o If present, a single "a=ice-pwd" line is parsed as specified in 2779 [RFC5245], Section 15.4, and the password value is stored. 2781 o If present, a single "a=ice-options" line is parsed as specified 2782 in [RFC5245], Section 15.5, and the set of specified options is 2783 stored. 2785 o Any "a=fingerprint" lines are parsed as specified in [RFC8122], 2786 Section 5, and the set of fingerprint and algorithm values is 2787 stored. 2789 o If present, a single "a=setup" line is parsed as specified in 2790 [RFC4145], Section 4, and the setup value is stored. 2792 o If present, a single "a=tls-id" line is parsed as specified in 2793 [I-D.ietf-mmusic-dtls-sdp] Section 5, and the tls-id value is 2794 stored. 2796 o Any "a=identity" lines are parsed and the identity values stored 2797 for subsequent verification, as specified 2798 [I-D.ietf-rtcweb-security-arch], Section 5. 2800 o Any "a=extmap" lines are parsed as specified in [RFC5285], 2801 Section 5, and their values are stored. 2803 Other attributes that are not relevant to JSEP may also be present, 2804 and implementations SHOULD process any that they recognize. As 2805 required by [RFC4566], Section 5.13, unknown attribute lines MUST be 2806 ignored. 2808 Once all the session-level lines have been parsed, processing 2809 continues with the lines in m= sections. 2811 5.7.2. Media Section Parsing 2813 Like the session-level lines, the media section lines MUST occur in 2814 the specific order and with the specific syntax defined in [RFC4566], 2815 Section 5. 2817 The "m=" line itself MUST be parsed as described in [RFC4566], 2818 Section 5.14, and the media, port, proto, and fmt values stored. 2820 Following the "m=" line, specific processing MUST be applied for the 2821 following non-attribute lines: 2823 o As with the "c=" line at the session level, the "c=" line MUST be 2824 parsed according to [RFC4566], Section 5.7, but its value is not 2825 used. 2827 o The "b=" line, if present, MUST be parsed as specified in 2828 [RFC4566], Section 5.8, and the bwtype and bandwidth values 2829 stored. 2831 Specific processing MUST also be applied for the following attribute 2832 lines: 2834 o If present, a single "a=ice-ufrag" line is parsed as specified in 2835 [RFC5245], Section 15.4, and the ufrag value is stored. 2837 o If present, a single "a=ice-pwd" line is parsed as specified in 2838 [RFC5245], Section 15.4, and the password value is stored. 2840 o If present, a single "a=ice-options" line is parsed as specified 2841 in [RFC5245], Section 15.5, and the set of specified options is 2842 stored. 2844 o Any "a=candidate" attributes MUST be parsed as specified in 2845 [RFC5245], Section 15.1, and their values stored. 2847 o Any "a=remote-candidates" attributes MUST be parsed as specified 2848 in [RFC5245], Section 15.2, but their values are ignored. 2850 o If present, a single "a=end-of-candidates" attribute MUST be 2851 parsed as specified in [I-D.ietf-ice-trickle], Section 8.2, and 2852 its presence or absence flagged and stored. 2854 o Any "a=fingerprint" lines are parsed as specified in [RFC8122], 2855 Section 5, and the set of fingerprint and algorithm values is 2856 stored. 2858 If the "m=" proto value indicates use of RTP, as described in 2859 Section 5.1.2 above, the following attribute lines MUST be processed: 2861 o The "m=" fmt value MUST be parsed as specified in [RFC4566], 2862 Section 5.14, and the individual values stored. 2864 o Any "a=rtpmap" or "a=fmtp" lines MUST be parsed as specified in 2865 [RFC4566], Section 6, and their values stored. 2867 o If present, a single "a=ptime" line MUST be parsed as described in 2868 [RFC4566], Section 6, and its value stored. 2870 o If present, a single "a=maxptime" line MUST be parsed as described 2871 in [RFC4566], Section 6, and its value stored. 2873 o If present, a single direction attribute line (e.g. "a=sendrecv") 2874 MUST be parsed as described in [RFC4566], Section 6, and its value 2875 stored. 2877 o Any "a=ssrc" attributes MUST be parsed as specified in [RFC5576], 2878 Section 4.1, and their values stored. 2880 o Any "a=extmap" attributes MUST be parsed as specified in 2881 [RFC5285], Section 5, and their values stored. 2883 o Any "a=rtcp-fb" attributes MUST be parsed as specified in 2884 [RFC4585], Section 4.2., and their values stored. 2886 o If present, a single "a=rtcp-mux" attribute MUST be parsed as 2887 specified in [RFC5761], Section 5.1.3, and its presence or absence 2888 flagged and stored. 2890 o If present, a single "a=rtcp-mux-only" attribute MUST be parsed as 2891 specified in [I-D.ietf-mmusic-mux-exclusive], Section 3, and its 2892 presence or absence flagged and stored. 2894 o If present, a single "a=rtcp-rsize" attribute MUST be parsed as 2895 specified in [RFC5506], Section 5, and its presence or absence 2896 flagged and stored. 2898 o If present, a single "a=rtcp" attribute MUST be parsed as 2899 specified in [RFC3605], Section 2.1, but its value is ignored, as 2900 this information is superfluous when using ICE. 2902 o If present, "a=msid" attributes MUST be parsed as specified in 2903 [I-D.ietf-mmusic-msid], Section 3.2, and their values stored. 2905 o Any "a=imageattr" attributes MUST be parsed as specified in 2906 [RFC6236], Section 3, and their values stored. 2908 o Any "a=rid" lines MUST be parsed as specified in 2909 [I-D.ietf-mmusic-rid], Section 10, and their values stored. 2911 o If present, a single "a=simulcast" line MUST be parsed as 2912 specified in [I-D.ietf-mmusic-sdp-simulcast], and its values 2913 stored. 2915 Otherwise, if the "m=" proto value indicates use of SCTP, the 2916 following attribute lines MUST be processed: 2918 o The "m=" fmt value MUST be parsed as specified in 2919 [I-D.ietf-mmusic-sctp-sdp], Section 4.3, and the application 2920 protocol value stored. 2922 o An "a=sctp-port" attribute MUST be present, and it MUST be parsed 2923 as specified in [I-D.ietf-mmusic-sctp-sdp], Section 5.2, and the 2924 value stored. 2926 o If present, a single "a=max-message-size" attribute MUST be parsed 2927 as specified in [I-D.ietf-mmusic-sctp-sdp], Section 6, and the 2928 value stored. Otherwise, use the specified default. 2930 Other attributes that are not relevant to JSEP may also be present, 2931 and implementations SHOULD process any that they recognize. As 2932 required by [RFC4566], Section 5.13, unknown attribute lines MUST be 2933 ignored. 2935 5.7.3. Semantics Verification 2937 Assuming parsing completes successfully, the parsed description is 2938 then evaluated to ensure internal consistency as well as proper 2939 support for mandatory features. Specifically, the following checks 2940 are performed: 2942 o For each m= section, valid values for each of the mandatory-to-use 2943 features enumerated in Section 5.1.1 MUST be present. These 2944 values MAY either be present at the media level, or inherited from 2945 the session level. 2947 * ICE ufrag and password values, which MUST comply with the size 2948 limits specified in [RFC5245], Section 15.4. 2950 * tls-id value, which MUST be set according to 2951 [I-D.ietf-mmusic-dtls-sdp], Section 5. If this is a re-offer 2952 and the tls-id value is different from that presently in use, 2953 the DTLS connection is not being continued and the remote 2954 description MUST be part of an ICE restart, together with new 2955 ufrag and password values. If this is an answer, the tls-id 2956 value, if present, MUST be the same as in the offer. 2958 * DTLS setup value, which MUST be set according to the rules 2959 specified in [RFC5763], Section 5 and MUST be consistent with 2960 the selected role of the current DTLS connection, if one exists 2961 and is being continued. 2963 * DTLS fingerprint values, where at least one fingerprint MUST be 2964 present. 2966 o All RID values referenced in an "a=simulcast" line MUST exist as 2967 "a=rid" lines. 2969 o Each m= section is also checked to ensure prohibited features are 2970 not used. 2972 o If the RTP/RTCP multiplexing policy is "require", each m= section 2973 MUST contain an "a=rtcp-mux" attribute. If an m= section contains 2974 an "a=rtcp-mux-only" attribute, that section MUST also contain an 2975 "a=rtcp-mux" attribute. 2977 o If an m= section was present in the previous answer, the state of 2978 RTP/RTCP multiplexing MUST match what was previously negotiated. 2980 If this session description is of type "pranswer" or "answer", the 2981 following additional checks are applied: 2983 o The session description must follow the rules defined in 2984 [RFC3264], Section 6, including the requirement that the number of 2985 m= sections MUST exactly match the number of m= sections in the 2986 associated offer. 2988 o For each m= section, the media type and protocol values MUST 2989 exactly match the media type and protocol values in the 2990 corresponding m= section in the associated offer. 2992 If any of the preceding checks failed, processing MUST stop and an 2993 error MUST be returned. 2995 5.8. Applying a Local Description 2997 The following steps are performed at the media engine level to apply 2998 a local description. If an error is returned, the session MUST be 2999 restored to the state it was in before performing these steps. 3001 First, m= sections are processed. For each m= section, the following 3002 steps MUST be performed; if any parameters are out of bounds, or 3003 cannot be applied, processing MUST stop and an error MUST be 3004 returned. 3006 o If this m= section is new, begin gathering candidates for it, as 3007 defined in [RFC5245], Section 4.1.1, unless it is definitively 3008 being bundled (either this is an offer and the m= section is 3009 marked bundle-only, or it is an answer and the m= section is 3010 bundled into into another m= section.) 3012 o Or, if the ICE ufrag and password values have changed, trigger the 3013 ICE agent to start an ICE restart, and begin gathering new 3014 candidates for the m= section as described in [RFC5245], 3015 Section 9.1.1.1. If this description is an answer, also start 3016 checks on that media section as defined in [RFC5245], 3017 Section 9.3.1.1. 3019 o If the m= section proto value indicates use of RTP: 3021 * If there is no RtpTransceiver associated with this m= section, 3022 find one and associate it with this m= section according to the 3023 following steps. Note that this situation will only occur when 3024 applying an offer. 3026 + Find the RtpTransceiver that corresponds to this m= section, 3027 using the mapping between transceivers and m= section 3028 indices established when creating the offer. 3030 + Set the value of this RtpTransceiver's mid property to the 3031 MID of the m= section. 3033 * If RTCP mux is indicated, prepare to demux RTP and RTCP from 3034 the RTP ICE component, as specified in [RFC5761], 3035 Section 5.1.3. 3037 * For each specified RTP header extension, establish a mapping 3038 between the extension ID and URI, as described in [RFC5285], 3039 Section 6. 3041 * If the MID header extension is supported, prepare to demux RTP 3042 streams intended for this m= section based on the MID header 3043 extension, as described in 3044 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 15. 3046 * For each specified media format, establish a mapping between 3047 the payload type and the actual media format, as described in 3048 [RFC3264], Section 6.1. In addition, prepare to demux RTP 3049 streams intended for this m= section based on the media formats 3050 supported by this m= section, as described in 3051 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 10.2. 3053 * For each specified "rtx" media format, establish a mapping 3054 between the RTX payload type and its associated primary payload 3055 type, as described in [RFC4588], Sections 8.6 and 8.7. 3057 * If the directional attribute is of type "sendrecv" or 3058 "recvonly", enable receipt and decoding of media. 3060 Finally, if this description is of type "pranswer" or "answer", 3061 follow the processing defined in Section 5.10 below. 3063 5.9. Applying a Remote Description 3065 The following steps are performed to apply a remote description. If 3066 an error is returned, the session MUST be restored to the state it 3067 was in before performing these steps. 3069 If the answer contains any "a=ice-options" attributes where "trickle" 3070 is listed as an attribute, update the PeerConnection canTrickle 3071 property to be true. Otherwise, set this property to false. 3073 The following steps MUST be performed for attributes at the session 3074 level; if any parameters are out of bounds, or cannot be applied, 3075 processing MUST stop and an error MUST be returned. 3077 o For any specified "CT" bandwidth value, set this as the limit for 3078 the maximum total bitrate for all m= sections, as specified in 3079 [RFC4566], Section 5.8. Within this overall limit, the 3080 implementation can dynamically decide how to best allocate the 3081 available bandwidth between m= sections, respecting any specific 3082 limits that have been specified for individual m= sections. 3084 o For any specified "RR" or "RS" bandwidth values, handle as 3085 specified in [RFC3556], Section 2. 3087 o Any "AS" bandwidth value MUST be ignored, as the meaning of this 3088 construct at the session level is not well defined. 3090 For each m= section, the following steps MUST be performed; if any 3091 parameters are out of bounds, or cannot be applied, processing MUST 3092 stop and an error MUST be returned. 3094 o If the ICE ufrag or password changed from the previous remote 3095 description: [RFC5245]. 3097 * If the description is of type "offer", the implementation MUST 3098 note that an ICE restart is needed, as described in [RFC5245], 3099 Section 9.1.1.1. 3101 * If the description is of type "answer" or "pranswer", then 3102 check to see if the current local description is an ICE 3103 restart, and if not, generate an error. If the PeerConnection 3104 state is "have-remote-pranswer", and the ICE ufrag or password 3105 changed from the previous provisional answer, then signal the 3106 ICE agent to discard any previous ICE check list state for the 3107 m= section. Finally, signal the ICE agent to begin checks as 3108 described in [RFC5245], Section 9.3.1.1. 3110 o If the current local description indicates an ICE restart, and 3111 either the ICE ufrag or password has not changed from the previous 3112 remote description, as prescribed by [RFC5245], Section 9.2.1.1, 3113 generate an error. 3115 o Configure the ICE components associated with this media section to 3116 use the supplied ICE remote ufrag and password for their 3117 connectivity checks. 3119 o Pair any supplied ICE candidates with any gathered local 3120 candidates, as described in [RFC5245], Section 5.7, and start 3121 connectivity checks with the appropriate credentials. 3123 o If an "a=end-of-candidates" attribute is present, process the end- 3124 of-candidates indication as described in [I-D.ietf-ice-trickle], 3125 Section 11. 3127 o If the m= section proto value indicates use of RTP: 3129 * If the m= section is being recycled (see Section 5.2.2), 3130 dissociate the currently associated RtpTransceiver by setting 3131 its mid property to null, and discard the mapping between the 3132 transceiver and its m= section index. 3134 * If the m= section is not associated with any RtpTransceiver 3135 (possibly because it was dissociated in the previous step), 3136 either find an RtpTransceiver or create one according to the 3137 following steps: 3139 + If the m= section is sendrecv or recvonly, and there are 3140 RtpTransceivers of the same type that were added to the 3141 PeerConnection by addTrack and are not associated with any 3142 m= section and are not stopped, find the first (according to 3143 the canonical order described in Section 5.2.1) such 3144 RtpTransceiver. 3146 + If no RtpTransceiver was found in the previous step, create 3147 one with a recvonly direction. 3149 + Associate the found or created RtpTransceiver with the m= 3150 section by setting the value of the RtpTransceiver's mid 3151 property to the MID of the m= section, and establish a 3152 mapping between the transceiver and the index of the m= 3153 section. If the m= section does not include a MID (i.e., 3154 the remote endpoint does not support the MID extension), 3155 generate a value for the RtpTransceiver mid property, 3156 following the guidance for "a=mid" mentioned in 3157 Section 5.2.1. 3159 * For each specified media format that is also supported by the 3160 local implementation, establish a mapping between the specified 3161 payload type and the media format, as described in [RFC3264], 3162 Section 6.1. Specifically, this means that the implementation 3163 records the payload type to be used in outgoing RTP packets 3164 when sending each specified media format, as well as the 3165 relative preference for each format that is indicated in their 3166 ordering. If any indicated media format is not supported by 3167 the local implementation, it MUST be ignored. 3169 * For each specified "rtx" media format, establish a mapping 3170 between the RTX payload type and its associated primary payload 3171 type, as described in [RFC4588], Section 4. If any referenced 3172 primary payload types are not present, this MUST result in an 3173 error. Note that RTX payload types may refer to primary 3174 payload types which are not supported by the local media 3175 implementation, in which case, the RTX payload type MUST also 3176 be ignored. 3178 * For each specified fmtp parameter that is supported by the 3179 local implementation, enable them on the associated media 3180 formats. 3182 * For each specified SSRC that is signaled in the m= section, 3183 prepare to demux RTP streams intended for this m= section using 3184 that SSRC, as described in 3185 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 10.2. 3187 * For each specified RTP header extension that is also supported 3188 by the local implementation, establish a mapping between the 3189 extension ID and URI, as described in [RFC5285], Section 5. 3190 Specifically, this means that the implementation records the 3191 extension ID to be used in outgoing RTP packets when sending 3192 each specified header extension. If any indicated RTP header 3193 extension is not supported by the local implementation, it MUST 3194 be ignored. 3196 * For each specified RTCP feedback mechanism that is supported by 3197 the local implementation, enable them on the associated media 3198 formats. 3200 * For any specified "TIAS" bandwidth value, set this value as a 3201 constraint on the maximum RTP bitrate to be used when sending 3202 media, as specified in [RFC3890]. If a "TIAS" value is not 3203 present, but an "AS" value is specified, generate a "TIAS" 3204 value using this formula: 3206 TIAS = AS * 1000 * 0.95 - (50 * 40 * 8) 3208 The 50 is based on 50 packets per second, the 40 is based on an 3209 estimate of total header size, the 1000 changes the unit from 3210 kbps to bps (as required by TIAS), and the 0.95 is to allocate 3211 5% to RTCP. "TIAS" is used in preference to "AS" because it 3212 provides more accurate control of bandwidth. 3214 * For any "RR" or "RS" bandwidth values, handle as specified in 3215 [RFC3556], Section 2. 3217 * Any specified "CT" bandwidth value MUST be ignored, as the 3218 meaning of this construct at the media level is not well 3219 defined. 3221 * If the m= section is of type audio: 3223 + For each specified "CN" media format, configure silence 3224 suppression for all supported media formats with the same 3225 clockrate, as described in [RFC3389], Section 5, except for 3226 formats that have their own internal silence suppression 3227 mechanisms. Silence suppression for such formats (e.g., 3228 Opus) is controlled via fmtp parameters, as discussed in 3229 Section 5.2.3.2. 3231 + For each specified "telephone-event" media format, enable 3232 DTMF transmission for all supported media formats with the 3233 same clockrate, as described in [RFC4733], Section 2.5.1.2. 3234 If there are any supported media formats that do not have a 3235 corresponding telephone-event format, disable DTMF 3236 transmission for those formats. 3238 + For any specified "ptime" value, configure the available 3239 media formats to use the specified packet size when sending. 3240 If the specified size is not supported for a media format, 3241 use the next closest value instead. 3243 Finally, if this description is of type "pranswer" or "answer", 3244 follow the processing defined in Section 5.10 below. 3246 5.10. Applying an Answer 3248 In addition to the steps mentioned above for processing a local or 3249 remote description, the following steps are performed when processing 3250 a description of type "pranswer" or "answer". 3252 For each m= section, the following steps MUST be performed: 3254 o If the m= section has been rejected (i.e. port is set to zero in 3255 the answer), stop any reception or transmission of media for this 3256 section, and, unless a non-rejected m= section is bundled with 3257 this m= section, discard any associated ICE components, as 3258 described in [RFC5245], Section 9.2.1.3. 3260 o If the remote DTLS fingerprint has been changed or the tls-id has 3261 changed, tear down the DTLS connection. This includes the case 3262 when the PeerConnection state is "have-remote-pranswer". If a 3263 DTLS connection needs to be torn down but the answer does not 3264 indicate an ICE restart or, in the case of "have-remote-pranswer", 3265 new ICE credentials, an error MUST be generated. If an ICE 3266 restart is performed without a change in tls-id or fingerprint, 3267 then the same DTLS connection is continued over the new ICE 3268 channel. 3270 o If no valid DTLS connection exists, prepare to start a DTLS 3271 connection, using the specified roles and fingerprints, on any 3272 underlying ICE components, once they are active. 3274 o If the m= section proto value indicates use of RTP: 3276 * If the m= section references RTCP feedback mechanisms that were 3277 not present in the corresponding m= section in the offer, this 3278 indicates a negotiation problem and MUST result in an error. 3279 However, new media formats and new RTP header extension values 3280 are permitted in the answer, as described in [RFC3264], 3281 Section 7, and [RFC5285], Section 6. 3283 * If the m= section has RTCP mux enabled, discard the RTCP ICE 3284 component, if one exists, and begin or continue muxing RTCP 3285 over the RTP ICE component, as specified in [RFC5761], 3286 Section 5.1.3. Otherwise, prepare to transmit RTCP over the 3287 RTCP ICE component; if no RTCP ICE component exists, because 3288 RTCP mux was previously enabled, this MUST result in an error. 3290 * If the m= section has reduced-size RTCP enabled, configure the 3291 RTCP transmission for this m= section to use reduced-size RTCP, 3292 as specified in [RFC5506]. 3294 * If the directional attribute in the answer indicates that the 3295 JSEP implementation should be sending media ("sendonly" for 3296 local answers, "recvonly" for remote answers, or "sendrecv" for 3297 either type of answer), choose the media format to send as the 3298 most preferred media format from the remote description that is 3299 also locally supported, as discussed in [RFC3264], Sections 6.1 3300 and 7, and start transmitting RTP media using that format once 3301 the underlying transport layers have been established. If an 3302 SSRC has not already been chosen for this outgoing RTP stream, 3303 choose a random one. If media is already being transmitted, 3304 the same SSRC SHOULD be used unless the clockrate of the new 3305 codec is different, in which case a new SSRC MUST be chosen, as 3306 specified in [RFC7160], Section 3.1. 3308 * The payload type mapping from the remote description is used to 3309 determine payload types for the outgoing RTP streams, including 3310 the payload type for the send media format chosen above. Any 3311 RTP header extensions that were negotiated should be included 3312 in the outgoing RTP streams, using the extension mapping from 3313 the remote description; if the RID header extension has been 3314 negotiated, and RID values are specified, include the RID 3315 header extension in the outgoing RTP streams, as indicated in 3316 [I-D.ietf-mmusic-rid], Section 4. 3318 * If the m= section is of type audio, and silence suppression was 3319 configured for the send media format as a result of processing 3320 the remote description, and is also enabled for that format in 3321 the local description, use silence suppression for outgoing 3322 media, in accordance with the guidance in Section 5.2.3.2. If 3323 these conditions are not met, silence suppression MUST NOT be 3324 used for outgoing media. 3326 * If simulcast has been negotiated, send the number of Source RTP 3327 Streams as specified in [I-D.ietf-mmusic-sdp-simulcast], 3328 Section 6.2.2. 3330 * If the send media format chosen above has a corresponding "rtx" 3331 media format, or a FEC mechanism has been negotiated, establish 3332 a Redundancy RTP Stream with a random SSRC for each Source RTP 3333 Stream, and start or continue transmitting RTX/FEC packets as 3334 needed. 3336 * If the send media format chosen above has a corresponding "red" 3337 media format of the same clockrate, allow redundant encoding 3338 using the specified format for resiliency purposes, as 3339 discussed in [I-D.ietf-rtcweb-fec], Section 3.2. Note that 3340 unlike RTX or FEC media formats, the "red" format is 3341 transmitted on the Source RTP Stream, not the Redundancy RTP 3342 Stream. 3344 * Enable the RTCP feedback mechanisms referenced in the media 3345 section for all Source RTP Streams using the specified media 3346 formats. Specifically, begin or continue sending the requested 3347 feedback types and reacting to received feedback, as specified 3348 in [RFC4585], Section 4.2. When sending RTCP feedback, follow 3349 the rules and recommendations from [RFC8108] Section 5.4.1, to 3350 select which SSRC to use. 3352 * If the directional attribute in the answer indicates that the 3353 JSEP implementation should not be sending media ("recvonly" for 3354 local answers, "sendonly" for remote answers, or "inactive" for 3355 either type of answer) stop transmitting all RTP media, but 3356 continue sending RTCP, as described in [RFC3264], Section 5.1. 3358 o If the m= section proto value indicates use of SCTP: 3360 * If an SCTP association exists, and the remote SCTP port has 3361 changed, discard the existing SCTP association. This includes 3362 the case when the PeerConnection state is "have-remote- 3363 pranswer". 3365 * If no valid SCTP association exists, prepare to initiate a SCTP 3366 association over the associated ICE component and DTLS 3367 connection, using the local SCTP port value from the local 3368 description, and the remote SCTP port value from the remote 3369 description, as described in [I-D.ietf-mmusic-sctp-sdp], 3370 Section 10.2. 3372 If the answer contains valid bundle groups, discard any ICE 3373 components for the m= sections that will be bundled onto the primary 3374 ICE components in each bundle, and begin muxing these m= sections 3375 accordingly, as described in 3376 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 8.2. 3378 If the description is of type "answer", and there are still remaining 3379 candidates in the ICE candidate pool, discard them. 3381 6. Processing RTP/RTCP 3383 When bundling, associating incoming RTP/RTCP with the proper m= 3384 section is defined in [I-D.ietf-mmusic-sdp-bundle-negotiation], 3385 Section 10.2. When not bundling, the proper m= section is clear from 3386 the ICE component over which the RTP/RTCP is received. 3388 Once the proper m= section(s) are known, RTP/RTCP is delivered to the 3389 RtpTransceiver(s) associated with the m= section(s) and further 3390 processing of the RTP/RTCP is done at the RtpTransceiver level. This 3391 includes using RID [I-D.ietf-mmusic-rid] to distinguish between 3392 multiple Encoded Streams, as well as determine which Source RTP 3393 stream should be repaired by a given Redundancy RTP stream. 3395 7. Examples 3397 Note that this example section shows several SDP fragments. To 3398 format in 72 columns, some of the lines in SDP have been split into 3399 multiple lines, where leading whitespace indicates that a line is a 3400 continuation of the previous line. In addition, some blank lines 3401 have been added to improve readability but are not valid in SDP. 3403 More examples of SDP for WebRTC call flows, including examples with 3404 IPv6 addresses, can be found in [I-D.ietf-rtcweb-sdp]. 3406 7.1. Simple Example 3408 This section shows a very simple example that sets up a minimal audio 3409 / video call between two JSEP endpoints without using trickle ICE. 3410 The example in the following section provides a more detailed example 3411 of what could happen in a JSEP session. 3413 The code flow below shows Alice's endpoint initiating the session to 3414 Bob's endpoint. The messages from the JavaScript application in 3415 Alice's browser to the JavaScript in Bob's browser, abbreviated as 3416 AliceJS and BobJS respectively, are assumed to flow over some 3417 signaling protocol via a web server. The JavaScript on both Alice's 3418 side and Bob's side waits for all candidates before sending the offer 3419 or answer, so the offers and answers are complete; trickle ICE is not 3420 used. The user agents (JSEP implementations) in Alice and Bob's 3421 browsers, abbreviated as AliceUA and BobUA respectively, are using 3422 the default bundle policy of "balanced", and the default RTCP mux 3423 policy of "require". 3425 // set up local media state 3426 AliceJS->AliceUA: create new PeerConnection 3427 AliceJS->AliceUA: addTrack with two tracks: audio and video 3428 AliceJS->AliceUA: createOffer to get offer 3429 AliceJS->AliceUA: setLocalDescription with offer 3430 AliceUA->AliceJS: multiple onicecandidate events with candidates 3432 // wait for ICE gathering to complete 3433 AliceUA->AliceJS: onicecandidate event with null candidate 3434 AliceJS->AliceUA: get |offer-A1| from pendingLocalDescription 3436 // |offer-A1| is sent over signaling protocol to Bob 3437 AliceJS->WebServer: signaling with |offer-A1| 3438 WebServer->BobJS: signaling with |offer-A1| 3440 // |offer-A1| arrives at Bob 3441 BobJS->BobUA: create a PeerConnection 3442 BobJS->BobUA: setRemoteDescription with |offer-A1| 3443 BobUA->BobJS: ontrack events for audio and video tracks 3445 // Bob accepts call 3446 BobJS->BobUA: addTrack with local tracks 3447 BobJS->BobUA: createAnswer 3448 BobJS->BobUA: setLocalDescription with answer 3449 BobUA->BobJS: multiple onicecandidate events with candidates 3451 // wait for ICE gathering to complete 3452 BobUA->BobJS: onicecandidate event with null candidate 3453 BobJS->BobUA: get |answer-A1| from currentLocalDescription 3455 // |answer-A1| is sent over signaling protocol to Alice 3456 BobJS->WebServer: signaling with |answer-A1| 3457 WebServer->AliceJS: signaling with |answer-A1| 3459 // |answer-A1| arrives at Alice 3460 AliceJS->AliceUA: setRemoteDescription with |answer-A1| 3461 AliceUA->AliceJS: ontrack events for audio and video tracks 3463 // media flows 3464 BobUA->AliceUA: media sent from Bob to Alice 3465 AliceUA->BobUA: media sent from Alice to Bob 3467 The SDP for |offer-A1| looks like: 3469 v=0 3470 o=- 4962303333179871722 1 IN IP4 0.0.0.0 3471 s=- 3472 t=0 0 3473 a=ice-options:trickle 3474 a=group:BUNDLE a1 v1 3475 a=group:LS a1 v1 3477 m=audio 10100 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3478 c=IN IP4 203.0.113.100 3479 a=mid:a1 3480 a=sendrecv 3481 a=rtpmap:96 opus/48000/2 3482 a=rtpmap:0 PCMU/8000 3483 a=rtpmap:8 PCMA/8000 3484 a=rtpmap:97 telephone-event/8000 3485 a=rtpmap:98 telephone-event/48000 3486 a=fmtp:97 0-15 3487 a=fmtp:98 0-15 3488 a=maxptime:120 3489 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3490 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3491 a=msid:47017fee-b6c1-4162-929c-a25110252400 3492 f83006c5-a0ff-4e0a-9ed9-d3e6747be7d9 3493 a=ice-ufrag:ETEn 3494 a=ice-pwd:OtSK0WpNtpUjkY4+86js7ZQl 3495 a=fingerprint:sha-256 3496 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04: 3497 BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3498 a=setup:actpass 3499 a=tls-id:1 3500 a=rtcp:10101 IN IP4 203.0.113.100 3501 a=rtcp-mux 3502 a=rtcp-rsize 3503 a=candidate:1 1 udp 2113929471 203.0.113.100 10100 typ host 3504 a=candidate:1 2 udp 2113929470 203.0.113.100 10101 typ host 3505 a=end-of-candidates 3507 m=video 10102 UDP/TLS/RTP/SAVPF 100 101 102 103 3508 c=IN IP4 203.0.113.100 3509 a=mid:v1 3510 a=sendrecv 3511 a=rtpmap:100 VP8/90000 3512 a=rtpmap:101 H264/90000 3513 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 3514 a=rtpmap:102 rtx/90000 3515 a=fmtp:102 apt=100 3516 =rtpmap:103 rtx/90000 3517 a=fmtp:103 apt=101 3518 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3519 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 3520 a=rtcp-fb:100 ccm fir 3521 a=rtcp-fb:100 nack 3522 a=rtcp-fb:100 nack pli 3523 a=msid:47017fee-b6c1-4162-929c-a25110252400 3524 f30bdb4a-5db8-49b5-bcdc-e0c9a23172e0 3525 a=ice-ufrag:BGKk 3526 a=ice-pwd:mqyWsAjvtKwTGnvhPztQ9mIf 3527 a=fingerprint:sha-256 3528 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04: 3529 BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3530 a=setup:actpass 3531 a=tls-id:1 3532 a=rtcp:10103 IN IP4 203.0.113.100 3533 a=rtcp-mux 3534 a=rtcp-rsize 3535 a=candidate:1 1 udp 2113929471 203.0.113.100 10102 typ host 3536 a=candidate:1 2 udp 2113929470 203.0.113.100 10103 typ host 3537 a=end-of-candidates 3539 The SDP for |answer-A1| looks like: 3541 v=0 3542 o=- 6729291447651054566 1 IN IP4 0.0.0.0 3543 s=- 3544 t=0 0 3545 a=ice-options:trickle 3546 a=group:BUNDLE a1 v1 3547 a=group:LS a1 v1 3549 m=audio 10200 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3550 c=IN IP4 203.0.113.200 3551 a=mid:a1 3552 a=sendrecv 3553 a=rtpmap:96 opus/48000/2 3554 a=rtpmap:0 PCMU/8000 3555 a=rtpmap:8 PCMA/8000 3556 a=rtpmap:97 telephone-event/8000 3557 a=rtpmap:98 telephone-event/48000 3558 a=fmtp:97 0-15 3559 a=fmtp:98 0-15 3560 a=maxptime:120 3561 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3562 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3563 a=msid:61317484-2ed4-49d7-9eb7-1414322a7aae 3564 5a7b57b8-f043-4bd1-a45d-09d4dfa31226 3566 a=ice-ufrag:6sFv 3567 a=ice-pwd:cOTZKZNVlO9RSGsEGM63JXT2 3568 a=fingerprint:sha-256 3569 6B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35: 3570 DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3571 a=setup:active 3572 a=tls-id:1 3573 a=rtcp-mux 3574 a=rtcp-rsize 3575 a=candidate:1 1 udp 2113929471 203.0.113.200 10200 typ host 3576 a=end-of-candidates 3578 m=video 10200 UDP/TLS/RTP/SAVPF 100 101 102 103 3579 c=IN IP4 203.0.113.200 3580 a=mid:v1 3581 a=sendrecv 3582 a=rtpmap:100 VP8/90000 3583 a=rtpmap:101 H264/90000 3584 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 3585 a=rtpmap:102 rtx/90000 3586 a=fmtp:102 apt=100 3587 =rtpmap:103 rtx/90000 3588 a=fmtp:103 apt=101 3589 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3590 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 3591 a=rtcp-fb:100 ccm fir 3592 a=rtcp-fb:100 nack 3593 a=rtcp-fb:100 nack pli 3594 a=msid:61317484-2ed4-49d7-9eb7-1414322a7aae 3595 4ea4d4a1-2fda-4511-a9cc-1b32c2e59552 3597 7.2. Detailed Example 3599 This section shows a more involved example of a session between two 3600 JSEP endpoints. Trickle ICE is used in full trickle mode, with a 3601 bundle policy of "max-bundle", an RTCP mux policy of "require", and a 3602 single TURN server. Initially, both Alice and Bob establish an audio 3603 channel and a data channel. Later, Bob adds two video flows, one for 3604 his video feed, and one for screensharing, both supporting FEC, and 3605 with the video feed configured for simulcast. Alice accepts these 3606 video flows, but does not add video flows of her own, so they are 3607 handled as recvonly. Alice also specifies a maximum video decoder 3608 resolution. 3610 // set up local media state 3611 AliceJS->AliceUA: create new PeerConnection 3612 AliceJS->AliceUA: addTrack with an audio track 3613 AliceJS->AliceUA: createDataChannel to get data channel 3614 AliceJS->AliceUA: createOffer to get |offer-B1| 3615 AliceJS->AliceUA: setLocalDescription with |offer-B1| 3617 // |offer-B1| is sent over signaling protocol to Bob 3618 AliceJS->WebServer: signaling with |offer-B1| 3619 WebServer->BobJS: signaling with |offer-B1| 3621 // |offer-B1| arrives at Bob 3622 BobJS->BobUA: create a PeerConnection 3623 BobJS->BobUA: setRemoteDescription with |offer-B1| 3624 BobUA->BobJS: ontrack with audio track from Alice 3626 // candidates are sent to Bob 3627 AliceUA->AliceJS: onicecandidate (host) |offer-B1-candidate-1| 3628 AliceJS->WebServer: signaling with |offer-B1-candidate-1| 3629 AliceUA->AliceJS: onicecandidate (srflx) |offer-B1-candidate-2| 3630 AliceJS->WebServer: signaling with |offer-B1-candidate-2| 3631 AliceUA->AliceJS: onicecandidate (relay) |offer-B1-candidate-3| 3632 AliceJS->WebServer: signaling with |offer-B1-candidate-3| 3634 WebServer->BobJS: signaling with |offer-B1-candidate-1| 3635 BobJS->BobUA: addIceCandidate with |offer-B1-candidate-1| 3636 WebServer->BobJS: signaling with |offer-B1-candidate-2| 3637 BobJS->BobUA: addIceCandidate with |offer-B1-candidate-2| 3638 WebServer->BobJS: signaling with |offer-B1-candidate-3| 3639 BobJS->BobUA: addIceCandidate with |offer-B1-candidate-3| 3641 // Bob accepts call 3642 BobJS->BobUA: addTrack with local audio 3643 BobJS->BobUA: createDataChannel to get data channel 3644 BobJS->BobUA: createAnswer to get |answer-B1| 3645 BobJS->BobUA: setLocalDescription with |answer-B1| 3647 // |answer-B1| is sent to Alice 3648 BobJS->WebServer: signaling with |answer-B1| 3649 WebServer->AliceJS: signaling with |answer-B1| 3650 AliceJS->AliceUA: setRemoteDescription with |answer-B1| 3651 AliceUA->AliceJS: ontrack event with audio track from Bob 3653 // candidates are sent to Alice 3654 BobUA->BobJS: onicecandidate (host) |answer-B1-candidate-1| 3655 BobJS->WebServer: signaling with |answer-B1-candidate-1| 3656 BobUA->BobJS: onicecandidate (srflx) |answer-B1-candidate-2| 3657 BobJS->WebServer: signaling with |answer-B1-candidate-2| 3658 BobUA->BobJS: onicecandidate (relay) |answer-B1-candidate-3| 3659 BobJS->WebServer: signaling with |answer-B1-candidate-3| 3660 WebServer->AliceJS: signaling with |answer-B1-candidate-1| 3661 AliceJS->AliceUA: addIceCandidate with |answer-B1-candidate-1| 3662 WebServer->AliceJS: signaling with |answer-B1-candidate-2| 3663 AliceJS->AliceUA: addIceCandidate with |answer-B1-candidate-2| 3664 WebServer->AliceJS: signaling with |answer-B1-candidate-3| 3665 AliceJS->AliceUA: addIceCandidate with |answer-B1-candidate-3| 3667 // data channel opens 3668 BobUA->BobJS: ondatachannel event 3669 AliceUA->AliceJS: ondatachannel event 3670 BobUA->BobJS: onopen 3671 AliceUA->AliceJS: onopen 3673 // media is flowing between endpoints 3674 BobUA->AliceUA: audio+data sent from Bob to Alice 3675 AliceUA->BobUA: audio+data sent from Alice to Bob 3677 // some time later Bob adds two video streams 3678 // note, no candidates exchanged, because of bundle 3679 BobJS->BobUA: addTrack with first video stream 3680 BobJS->BobUA: addTrack with second video stream 3681 BobJS->BobUA: createOffer to get |offer-B2| 3682 BobJS->BobUA: setLocalDescription with |offer-B2| 3684 // |offer-B2| is sent to Alice 3685 BobJS->WebServer: signaling with |offer-B2| 3686 WebServer->AliceJS: signaling with |offer-B2| 3687 AliceJS->AliceUA: setRemoteDescription with |offer-B2| 3688 AliceUA->AliceJS: ontrack event with first video track 3689 AliceUA->AliceJS: ontrack event with second video track 3690 AliceJS->AliceUA: createAnswer to get |answer-B2| 3691 AliceJS->AliceUA: setLocalDescription with |answer-B2| 3693 // |answer-B2| is sent over signaling protocol to Bob 3694 AliceJS->WebServer: signaling with |answer-B2| 3695 WebServer->BobJS: signaling with |answer-B2| 3696 BobJS->BobUA: setRemoteDescription with |answer-B2| 3698 // media is flowing between endpoints 3699 BobUA->AliceUA: audio+video+data sent from Bob to Alice 3700 AliceUA->BobUA: audio+video+data sent from Alice to Bob 3702 The SDP for |offer-B1| looks like: 3704 v=0 3705 o=- 4962303333179871723 1 IN IP4 0.0.0.0 3706 s=- 3707 t=0 0 3708 a=ice-options:trickle 3709 a=group:BUNDLE a1 d1 3711 m=audio 9 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3712 c=IN IP4 0.0.0.0 3713 a=mid:a1 3714 a=sendrecv 3715 a=rtpmap:96 opus/48000/2 3716 a=rtpmap:0 PCMU/8000 3717 a=rtpmap:8 PCMA/8000 3718 a=rtpmap:97 telephone-event/8000 3719 a=rtpmap:98 telephone-event/48000 3720 a=fmtp:97 0-15 3721 a=fmtp:98 0-15 3722 a=maxptime:120 3723 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3724 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3725 a=msid:57017fee-b6c1-4162-929c-a25110252400 3726 e83006c5-a0ff-4e0a-9ed9-d3e6747be7d9 3727 a=ice-ufrag:ATEn 3728 a=ice-pwd:AtSK0WpNtpUjkY4+86js7ZQl 3729 a=fingerprint:sha-256 3730 29:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04: 3731 BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3732 a=setup:actpass 3733 a=tls-id:1 3734 a=rtcp-mux 3735 a=rtcp-mux-only 3736 a=rtcp-rsize 3738 m=application 0 UDP/DTLS/SCTP webrtc-datachannel 3739 c=IN IP4 0.0.0.0 3740 a=mid:d1 3741 a=sctp-port:5000 3742 a=max-message-size:65536 3743 a=bundle-only 3745 |offer-B1-candidate-1| looks like: 3747 ufrag ATEn 3748 index 0 3749 mid a1 3750 attr candidate:1 1 udp 2113929471 203.0.113.100 10100 typ host 3752 |offer-B1-candidate-2| looks like: 3754 ufrag ATEn 3755 index 0 3756 mid a1 3757 attr candidate:1 1 udp 1845494015 198.51.100.100 11100 typ srflx 3758 raddr 203.0.113.100 rport 10100 3760 |offer-B1-candidate-3| looks like: 3762 ufrag ATEn 3763 index 0 3764 mid a1 3765 attr candidate:1 1 udp 255 192.0.2.100 12100 typ relay 3766 raddr 198.51.100.100 rport 11100 3768 The SDP for |answer-B1| looks like: 3770 v=0 3771 o=- 7729291447651054566 1 IN IP4 0.0.0.0 3772 s=- 3773 t=0 0 3774 a=ice-options:trickle 3775 a=group:BUNDLE a1 d1 3777 m=audio 9 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3778 c=IN IP4 0.0.0.0 3779 a=mid:a1 3780 a=sendrecv 3781 a=rtpmap:96 opus/48000/2 3782 a=rtpmap:0 PCMU/8000 3783 a=rtpmap:8 PCMA/8000 3784 a=rtpmap:97 telephone-event/8000 3785 a=rtpmap:98 telephone-event/48000 3786 a=fmtp:97 0-15 3787 a=fmtp:98 0-15 3788 a=maxptime:120 3789 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3790 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3791 a=msid:71317484-2ed4-49d7-9eb7-1414322a7aae 3792 6a7b57b8-f043-4bd1-a45d-09d4dfa31226 3793 a=ice-ufrag:7sFv 3794 a=ice-pwd:dOTZKZNVlO9RSGsEGM63JXT2 3795 a=fingerprint:sha-256 3796 7B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35: 3797 DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3798 a=setup:active 3799 a=tls-id:1 3800 a=rtcp-mux 3801 a=rtcp-mux-only 3802 a=rtcp-rsize 3804 m=application 9 UDP/DTLS/SCTP webrtc-datachannel 3805 c=IN IP4 0.0.0.0 3806 a=mid:d1 3807 a=sctp-port:5000 3808 a=max-message-size:65536 3810 |answer-B1-candidate-1| looks like: 3812 ufrag 7sFv 3813 index 0 3814 mid a1 3815 attr candidate:1 1 udp 2113929471 203.0.113.200 10200 typ host 3817 |answer-B1-candidate-2| looks like: 3819 ufrag 7sFv 3820 index 0 3821 mid a1 3822 attr candidate:1 1 udp 1845494015 198.51.100.200 11200 typ srflx 3823 raddr 203.0.113.200 rport 10200 3825 |answer-B1-candidate-3| looks like: 3827 ufrag 7sFv 3828 index 0 3829 mid a1 3830 attr candidate:1 1 udp 255 192.0.2.200 12200 typ relay 3831 raddr 198.51.100.200 rport 11200 3833 The SDP for |offer-B2| is shown below. In addition to the new m= 3834 sections for video, both of which are offering FEC, and one of which 3835 is offering simulcast, note the increment of the version number in 3836 the o= line, changes to the c= line, indicating the local candidate 3837 that was selected, and the inclusion of gathered candidates as 3838 a=candidate lines. 3840 v=0 3841 o=- 7729291447651054566 2 IN IP4 0.0.0.0 3842 s=- 3843 t=0 0 3844 a=ice-options:trickle 3845 a=group:BUNDLE a1 d1 v1 v2 3846 a=group:LS a1 v1 3848 m=audio 12200 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3849 c=IN IP4 192.0.2.200 3850 a=mid:a1 3851 a=sendrecv 3852 a=rtpmap:96 opus/48000/2 3853 a=rtpmap:0 PCMU/8000 3854 a=rtpmap:8 PCMA/8000 3855 a=rtpmap:97 telephone-event/8000 3856 a=rtpmap:98 telephone-event/48000 3857 a=fmtp:97 0-15 3858 a=fmtp:98 0-15 3859 a=maxptime:120 3860 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3861 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3862 a=msid:71317484-2ed4-49d7-9eb7-1414322a7aae 3863 6a7b57b8-f043-4bd1-a45d-09d4dfa31226 3864 a=ice-ufrag:7sFv 3865 a=ice-pwd:dOTZKZNVlO9RSGsEGM63JXT2 3866 a=fingerprint:sha-256 3867 7B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35: 3868 DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3869 a=setup:actpass 3870 a=tls-id:1 3871 a=rtcp-mux 3872 a=rtcp-mux-only 3873 a=rtcp-rsize 3874 a=candidate:1 1 udp 2113929471 203.0.113.200 10200 typ host 3875 a=candidate:1 1 udp 1845494015 198.51.100.200 11200 typ srflx 3876 raddr 203.0.113.200 rport 10200 3877 a=candidate:1 1 udp 255 192.0.2.200 12200 typ relay 3878 raddr 198.51.100.200 rport 11200 3879 a=end-of-candidates 3881 m=application 12200 UDP/DTLS/SCTP webrtc-datachannel 3882 c=IN IP4 192.0.2.200 3883 a=mid:d1 3884 a=sctp-port:5000 3885 a=max-message-size:65536 3887 m=video 12200 UDP/TLS/RTP/SAVPF 100 101 102 103 104 3888 c=IN IP4 192.0.2.200 3889 a=mid:v1 3890 a=sendrecv 3891 a=rtpmap:100 VP8/90000 3892 a=rtpmap:101 H264/90000 3893 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 3894 a=rtpmap:102 rtx/90000 3895 a=fmtp:102 apt=100 3896 =rtpmap:103 rtx/90000 3897 a=fmtp:103 apt=101 3898 a=rtpmap:104 flexfec/90000 3899 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3900 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 3901 a=rtcp-fb:100 ccm fir 3902 a=rtcp-fb:100 nack 3903 a=rtcp-fb:100 nack pli 3904 a=msid:71317484-2ed4-49d7-9eb7-1414322a7aae 3905 5ea4d4a1-2fda-4511-a9cc-1b32c2e59552 3906 a=rid:1 send 3907 a=rid:2 send 3908 a=rid:3 send 3909 a=simulcast:send 1;2;3 3911 m=video 12200 UDP/TLS/RTP/SAVPF 100 101 102 103 104 3912 c=IN IP4 192.0.2.200 3913 a=mid:v2 3914 a=sendrecv 3915 a=rtpmap:100 VP8/90000 3916 a=rtpmap:101 H264/90000 3917 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 3918 a=rtpmap:102 rtx/90000 3919 a=fmtp:102 apt=100 3920 =rtpmap:103 rtx/90000 3921 a=fmtp:103 apt=101 3922 a=rtpmap:104 flexfec/90000 3923 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3924 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 3925 a=rtcp-fb:100 ccm fir 3926 a=rtcp-fb:100 nack 3927 a=rtcp-fb:100 nack pli 3928 a=msid:81317484-2ed4-49d7-9eb7-1414322a7aae 3929 6ea4d4a1-2fda-4511-a9cc-1b32c2e59552 3931 The SDP for |answer-B2| is shown below. In addition to the 3932 acceptance of the video m= sections, the use of a=recvonly to 3933 indicate one-way video, and the use of a=imageattr to limit the 3934 received resolution, note the use of setup:passive to maintain the 3935 existing DTLS roles. 3937 v=0 3938 o=- 4962303333179871723 2 IN IP4 0.0.0.0 3939 s=- 3940 t=0 0 3941 a=ice-options:trickle 3942 a=group:BUNDLE a1 d1 v1 v2 3943 a=group:LS a1 v1 3945 m=audio 12100 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3946 c=IN IP4 192.0.2.100 3947 a=mid:a1 3948 a=sendrecv 3949 a=rtpmap:96 opus/48000/2 3950 a=rtpmap:0 PCMU/8000 3951 a=rtpmap:8 PCMA/8000 3952 a=rtpmap:97 telephone-event/8000 3953 a=rtpmap:98 telephone-event/48000 3954 a=fmtp:97 0-15 3955 a=fmtp:98 0-15 3956 a=maxptime:120 3957 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3958 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3959 a=msid:57017fee-b6c1-4162-929c-a25110252400 3960 e83006c5-a0ff-4e0a-9ed9-d3e6747be7d9 3961 a=ice-ufrag:ATEn 3962 a=ice-pwd:AtSK0WpNtpUjkY4+86js7ZQl 3963 a=fingerprint:sha-256 3964 29:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04: 3965 BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3966 a=setup:passive 3967 a=tls-id:1 3968 a=rtcp-mux 3969 a=rtcp-mux-only 3970 a=rtcp-rsize 3971 a=candidate:1 1 udp 2113929471 203.0.113.100 10100 typ host 3972 a=candidate:1 1 udp 1845494015 198.51.100.100 11100 typ srflx 3973 raddr 203.0.113.100 rport 10100 3974 a=candidate:1 1 udp 255 192.0.2.100 12100 typ relay 3975 raddr 198.51.100.100 rport 11100 3976 a=end-of-candidates 3978 m=application 12100 UDP/DTLS/SCTP webrtc-datachannel 3979 c=IN IP4 192.0.2.100 3980 a=mid:d1 3981 a=sctp-port:5000 3982 a=max-message-size:65536 3984 m=video 12100 UDP/TLS/RTP/SAVPF 100 101 102 103 3985 c=IN IP4 192.0.2.100 3986 a=mid:v1 3987 a=recvonly 3988 a=rtpmap:100 VP8/90000 3989 a=rtpmap:101 H264/90000 3990 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 3991 a=rtpmap:102 rtx/90000 3992 a=fmtp:102 apt=100 3993 =rtpmap:103 rtx/90000 3994 a=fmtp:103 apt=101 3995 a=imageattr:100 recv [x=[48:1920],y=[48:1080],q=1.0] 3996 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 3997 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 3998 a=rtcp-fb:100 ccm fir 3999 a=rtcp-fb:100 nack 4000 a=rtcp-fb:100 nack pli 4002 m=video 12100 UDP/TLS/RTP/SAVPF 100 101 102 103 4003 c=IN IP4 192.0.2.100 4004 a=mid:v2 4005 a=recvonly 4006 a=rtpmap:100 VP8/90000 4007 a=rtpmap:101 H264/90000 4008 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 4009 a=rtpmap:102 rtx/90000 4010 a=fmtp:102 apt=100 4011 =rtpmap:103 rtx/90000 4012 a=fmtp:103 apt=101 4013 a=imageattr:100 recv [x=[48:1920],y=[48:1080],q=1.0] 4014 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4015 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 4016 a=rtcp-fb:100 ccm fir 4017 a=rtcp-fb:100 nack 4018 a=rtcp-fb:100 nack pli 4020 7.3. Early Transport Warmup Example 4022 This example demonstrates the early warmup technique described in 4023 Section 4.1.8.1. Here, Alice's endpoint sends an offer to Bob's 4024 endpoint to start an audio/video call. Bob immediately responds with 4025 an answer that accepts the audio/video m= sections, but marks them as 4026 sendonly (from his perspective), meaning that Alice will not yet send 4027 media. This allows the JSEP implementation to start negotiating ICE 4028 and DTLS immediately. Bob's endpoint then prompts him to answer the 4029 call, and when he does, his endpoint sends a second offer which 4030 enables the audio and video m= sections, and thereby bidirectional 4031 media transmission. The advantage of such a flow is that as soon as 4032 the first answer is received, the implementation can proceed with ICE 4033 and DTLS negotiation and establish the session transport. If the 4034 transport setup completes before the second offer is sent, then media 4035 can be transmitted immediately by the callee immediately upon 4036 answering the call, minimizing perceived post-dial-delay. The second 4037 offer/answer exchange can also change the preferred codecs or other 4038 session parameters. 4040 This example also makes use of the "relay" ICE candidate policy 4041 described in Section 3.5.3 to minimize the ICE gathering and checking 4042 needed. 4044 // set up local media state 4045 AliceJS->AliceUA: create new PeerConnection with "relay" ICE policy 4046 AliceJS->AliceUA: addTrack with two tracks: audio and video 4047 AliceJS->AliceUA: createOffer to get |offer-C1| 4048 AliceJS->AliceUA: setLocalDescription with |offer-C1| 4050 // |offer-C1| is sent over signaling protocol to Bob 4051 AliceJS->WebServer: signaling with |offer-C1| 4052 WebServer->BobJS: signaling with |offer-C1| 4054 // |offer-C1| arrives at Bob 4055 BobJS->BobUA: create new PeerConnection with "relay" ICE policy 4056 BobJS->BobUA: setRemoteDescription with |offer-C1| 4057 BobUA->BobJS: ontrack events for audio and video 4059 // a relay candidate is sent to Bob 4060 AliceUA->AliceJS: onicecandidate (relay) |offer-C1-candidate-1| 4061 AliceJS->WebServer: signaling with |offer-C1-candidate-1| 4063 WebServer->BobJS: signaling with |offer-C1-candidate-1| 4064 BobJS->BobUA: addIceCandidate with |offer-C1-candidate-1| 4066 // Bob prepares an early answer to warmup the transport 4067 BobJS->BobUA: addTransceiver with null audio and video tracks 4068 BobJS->BobUA: transceiver.setDirection(sendonly) for both 4069 BobJS->BobUA: createAnswer 4070 BobJS->BobUA: setLocalDescription with answer 4072 // |answer-C1| is sent over signaling protocol to Alice 4073 BobJS->WebServer: signaling with |answer-C1| 4074 WebServer->AliceJS: signaling with |answer-C1| 4076 // |answer-C1| (sendonly) arrives at Alice 4077 AliceJS->AliceUA: setRemoteDescription with |answer-C1| 4078 AliceUA->AliceJS: ontrack events for audio and video 4080 // a relay candidate is sent to Alice 4081 BobUA->BobJS: onicecandidate (relay) |answer-B1-candidate-1| 4082 BobJS->WebServer: signaling with |answer-B1-candidate-1| 4084 WebServer->AliceJS: signaling with |answer-B1-candidate-1| 4085 AliceJS->AliceUA: addIceCandidate with |answer-B1-candidate-1| 4087 // ICE and DTLS establish while call is ringing 4089 // Bob accepts call, starts media, and sends new offer 4090 BobJS->BobUA: transceiver.setTrack with audio and video tracks 4091 BobUA->AliceUA: media sent from Bob to Alice 4092 BobJS->BobUA: transceiver.setDirection(sendrecv) for both 4093 transceivers 4094 BobJS->BobUA: createOffer 4095 BobJS->BobUA: setLocalDescription with offer 4097 // |offer-C2| is sent over signaling protocol to Alice 4098 BobJS->WebServer: signaling with |offer-C2| 4099 WebServer->AliceJS: signaling with |offer-C2| 4101 // |offer-C2| (sendrecv) arrives at Alice 4102 AliceJS->AliceUA: setRemoteDescription with |offer-C2| 4103 AliceJS->AliceUA: createAnswer 4104 AliceJS->AliceUA: setLocalDescription with |answer-C2| 4105 AliceUA->BobUA: media sent from Alice to Bob 4107 // |answer-C2| is sent over signaling protocol to Bob 4108 AliceJS->WebServer: signaling with |answer-C2| 4109 WebServer->BobJS: signaling with |answer-C2| 4110 BobJS->BobUA: setRemoteDescription with |answer-C2| 4112 The SDP for |offer-C1| looks like: 4114 v=0 4115 o=- 1070771854436052752 1 IN IP4 0.0.0.0 4116 s=- 4117 t=0 0 4118 a=ice-options:trickle 4119 a=group:BUNDLE a1 v1 4120 a=group:LS a1 v1 4122 m=audio 9 UDP/TLS/RTP/SAVPF 96 0 8 97 98 4123 c=IN IP4 0.0.0.0 4124 a=mid:a1 4125 a=sendrecv 4126 a=rtpmap:96 opus/48000/2 4127 a=rtpmap:0 PCMU/8000 4128 a=rtpmap:8 PCMA/8000 4129 a=rtpmap:97 telephone-event/8000 4130 a=rtpmap:98 telephone-event/48000 4131 a=fmtp:97 0-15 4132 a=fmtp:98 0-15 4133 a=maxptime:120 4134 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4135 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 4136 a=msid:bbce3ba6-abfc-ac63-d00a-e15b286f8fce 4137 e80098db-7159-3c06-229a-00df2a9b3dbc 4139 a=ice-ufrag:4ZcD 4140 a=ice-pwd:ZaaG6OG7tCn4J/lehAGz+HHD 4141 a=fingerprint:sha-256 4142 C4:68:F8:77:6A:44:F1:98:6D:7C:9F:47:EB:E3:34:A4: 4143 0A:AA:2D:49:08:28:70:2E:1F:AE:18:7D:4E:3E:66:BF 4144 a=setup:actpass 4145 a=tls-id:1 4146 a=rtcp-mux 4147 a=rtcp-mux-only 4148 a=rtcp-rsize 4150 m=video 0 UDP/TLS/RTP/SAVPF 100 101 102 103 4151 c=IN IP4 0.0.0.0 4152 a=mid:v1 4153 a=sendrecv 4154 a=rtpmap:100 VP8/90000 4155 a=rtpmap:101 H264/90000 4156 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 4157 a=rtpmap:102 rtx/90000 4158 a=fmtp:102 apt=100 4159 =rtpmap:103 rtx/90000 4160 a=fmtp:103 apt=101 4161 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4162 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 4163 a=rtcp-fb:100 ccm fir 4164 a=rtcp-fb:100 nack 4165 a=rtcp-fb:100 nack pli 4166 a=msid:bbce3ba6-abfc-ac63-d00a-e15b286f8fce 4167 ac701365-eb06-42df-cc93-7f22bc308789 4168 a=bundle-only 4170 |offer-C1-candidate-1| looks like: 4172 ufrag 4ZcD 4173 index 0 4174 mid a1 4175 attr candidate:1 1 udp 255 192.0.2.100 12100 typ relay 4176 raddr 0.0.0.0 rport 0 4178 The SDP for |answer-C1| looks like: 4180 v=0 4181 o=- 6386516489780559513 1 IN IP4 0.0.0.0 4182 s=- 4183 t=0 0 4184 a=ice-options:trickle 4185 a=group:BUNDLE a1 v1 4186 a=group:LS a1 v1 4188 m=audio 9 UDP/TLS/RTP/SAVPF 96 0 8 97 98 4189 c=IN IP4 0.0.0.0 4190 a=mid:a1 4191 a=sendonly 4192 a=rtpmap:96 opus/48000/2 4193 a=rtpmap:0 PCMU/8000 4194 a=rtpmap:8 PCMA/8000 4195 a=rtpmap:97 telephone-event/8000 4196 a=rtpmap:98 telephone-event/48000 4197 a=fmtp:97 0-15 4198 a=fmtp:98 0-15 4199 a=maxptime:120 4200 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4201 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 4202 a=msid:751f239e-4ae0-c549-aa3d-890de772998b 4203 04b5a445-82cc-c9e8-9ffe-c24d0ef4b0ff 4204 a=ice-ufrag:TpaA 4205 a=ice-pwd:t2Ouhc67y8JcCaYZxUUTgKw/ 4206 a=fingerprint:sha-256 4207 A2:F3:A5:6D:4C:8C:1E:B2:62:10:4A:F6:70:61:C4:FC: 4208 3C:E0:01:D6:F3:24:80:74:DA:7C:3E:50:18:7B:CE:4D 4209 a=setup:active 4210 a=tls-id:1 4211 a=rtcp-mux 4212 a=rtcp-mux-only 4213 a=rtcp-rsize 4215 m=video 9 UDP/TLS/RTP/SAVPF 100 101 102 103 4216 c=IN IP4 0.0.0.0 4217 a=mid:v1 4218 a=sendonly 4219 a=rtpmap:100 VP8/90000 4220 a=rtpmap:101 H264/90000 4221 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 4222 a=rtpmap:102 rtx/90000 4223 a=fmtp:102 apt=100 4224 =rtpmap:103 rtx/90000 4225 a=fmtp:103 apt=101 4226 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4227 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 4228 a=rtcp-fb:100 ccm fir 4229 a=rtcp-fb:100 nack 4230 a=rtcp-fb:100 nack pli 4231 a=msid:751f239e-4ae0-c549-aa3d-890de772998b 4232 39292672-c102-d075-f580-5826f31ca958 4234 |answer-C1-candidate-1| looks like: 4236 ufrag TpaA 4237 index 0 4238 mid a1 4239 attr candidate:1 1 udp 255 192.0.2.200 12200 typ relay 4240 raddr 0.0.0.0 rport 0 4242 The SDP for |offer-C2| looks like: 4244 v=0 4245 o=- 6386516489780559513 2 IN IP4 0.0.0.0 4246 s=- 4247 t=0 0 4248 a=ice-options:trickle 4249 a=group:BUNDLE a1 v1 4250 a=group:LS a1 v1 4252 m=audio 12200 UDP/TLS/RTP/SAVPF 96 0 8 97 98 4253 c=IN IP4 192.0.2.200 4254 a=mid:a1 4255 a=sendrecv 4256 a=rtpmap:96 opus/48000/2 4257 a=rtpmap:0 PCMU/8000 4258 a=rtpmap:8 PCMA/8000 4259 a=rtpmap:97 telephone-event/8000 4260 a=rtpmap:98 telephone-event/48000 4261 a=fmtp:97 0-15 4262 a=fmtp:98 0-15 4263 a=maxptime:120 4264 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4265 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 4266 a=msid:751f239e-4ae0-c549-aa3d-890de772998b 4267 04b5a445-82cc-c9e8-9ffe-c24d0ef4b0ff 4268 a=ice-ufrag:TpaA 4269 a=ice-pwd:t2Ouhc67y8JcCaYZxUUTgKw/ 4270 a=fingerprint:sha-256 4271 A2:F3:A5:6D:4C:8C:1E:B2:62:10:4A:F6:70:61:C4:FC: 4272 3C:E0:01:D6:F3:24:80:74:DA:7C:3E:50:18:7B:CE:4D 4273 a=setup:actpass 4274 a=tls-id:1 4275 a=rtcp-mux 4276 a=rtcp-mux-only 4277 a=rtcp-rsize 4278 a=candidate:1 1 udp 255 192.0.2.200 12200 typ relay 4279 raddr 0.0.0.0 rport 0 4280 a=end-of-candidates 4282 m=video 12200 UDP/TLS/RTP/SAVPF 100 101 102 103 4283 c=IN IP4 192.0.2.200 4284 a=mid:v1 4285 a=sendrecv 4286 a=rtpmap:100 VP8/90000 4287 a=rtpmap:101 H264/90000 4288 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 4289 a=rtpmap:102 rtx/90000 4290 a=fmtp:102 apt=100 4291 =rtpmap:103 rtx/90000 4292 a=fmtp:103 apt=101 4293 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4294 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 4295 a=rtcp-fb:100 ccm fir 4296 a=rtcp-fb:100 nack 4297 a=rtcp-fb:100 nack pli 4298 a=msid:751f239e-4ae0-c549-aa3d-890de772998b 4299 39292672-c102-d075-f580-5826f31ca958 4301 The SDP for |answer-C2| looks like: 4303 v=0 4304 o=- 1070771854436052752 2 IN IP4 0.0.0.0 4305 s=- 4306 t=0 0 4307 a=ice-options:trickle 4308 a=group:BUNDLE a1 v1 4309 a=group:LS a1 v1 4311 m=audio 12100 UDP/TLS/RTP/SAVPF 96 0 8 97 98 4312 c=IN IP4 192.0.2.100 4313 a=mid:a1 4314 a=sendrecv 4315 a=rtpmap:96 opus/48000/2 4316 a=rtpmap:0 PCMU/8000 4317 a=rtpmap:8 PCMA/8000 4318 a=rtpmap:97 telephone-event/8000 4319 a=rtpmap:98 telephone-event/48000 4320 a=fmtp:97 0-15 4321 a=fmtp:98 0-15 4322 a=maxptime:120 4323 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4324 a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level 4325 a=msid:bbce3ba6-abfc-ac63-d00a-e15b286f8fce 4326 e80098db-7159-3c06-229a-00df2a9b3dbc 4327 a=ice-ufrag:4ZcD 4328 a=ice-pwd:ZaaG6OG7tCn4J/lehAGz+HHD 4329 a=fingerprint:sha-256 4330 C4:68:F8:77:6A:44:F1:98:6D:7C:9F:47:EB:E3:34:A4: 4331 0A:AA:2D:49:08:28:70:2E:1F:AE:18:7D:4E:3E:66:BF 4332 a=setup:passive 4333 a=tls-id:1 4334 a=rtcp-mux 4335 a=rtcp-mux-only 4336 a=rtcp-rsize 4337 a=candidate:1 1 udp 255 192.0.2.100 12100 typ relay 4338 raddr 0.0.0.0 rport 0 4339 a=end-of-candidates 4341 m=video 12100 UDP/TLS/RTP/SAVPF 100 101 102 103 4342 c=IN IP4 192.0.2.100 4343 a=mid:v1 4344 a=sendrecv 4345 a=rtpmap:100 VP8/90000 4346 a=rtpmap:101 H264/90000 4347 a=fmtp:101 packetization-mode=1;profile-level-id=42e01f 4348 a=rtpmap:102 rtx/90000 4349 a=fmtp:102 apt=100 4350 =rtpmap:103 rtx/90000 4351 a=fmtp:103 apt=101 4352 a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid 4353 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id 4354 a=rtcp-fb:100 ccm fir 4355 a=rtcp-fb:100 nack 4356 a=rtcp-fb:100 nack pli 4357 a=msid:bbce3ba6-abfc-ac63-d00a-e15b286f8fce 4358 ac701365-eb06-42df-cc93-7f22bc308789 4360 8. Security Considerations 4362 The IETF has published separate documents 4363 [I-D.ietf-rtcweb-security-arch] [I-D.ietf-rtcweb-security] describing 4364 the security architecture for WebRTC as a whole. The remainder of 4365 this section describes security considerations for this document. 4367 While formally the JSEP interface is an API, it is better to think of 4368 it is an Internet protocol, with the application JavaScript being 4369 untrustworthy from the perspective of the JSEP implementation. Thus, 4370 the threat model of [RFC3552] applies. In particular, JavaScript can 4371 call the API in any order and with any inputs, including malicious 4372 ones. This is particularly relevant when we consider the SDP which 4373 is passed to setLocalDescription(). While correct API usage requires 4374 that the application pass in SDP which was derived from createOffer() 4375 or createAnswer(), there is no guarantee that applications do so. 4376 The JSEP implementation MUST be prepared for the JavaScript to pass 4377 in bogus data instead. 4379 Conversely, the application programmer needs to be aware that the 4380 JavaScript does not have complete control of endpoint behavior. One 4381 case that bears particular mention is that editing ICE candidates out 4382 of the SDP or suppressing trickled candidates does not have the 4383 expected behavior: implementations will still perform checks from 4384 those candidates even if they are not sent to the other side. Thus, 4385 for instance, it is not possible to prevent the remote peer from 4386 learning your public IP address by removing server reflexive 4387 candidates. Applications which wish to conceal their public IP 4388 address should instead configure the ICE agent to use only relay 4389 candidates. 4391 9. IANA Considerations 4393 This document requires no actions from IANA. 4395 10. Acknowledgements 4397 Harald Alvestrand, Taylor Brandstetter, Suhas Nandakumar, and Peter 4398 Thatcher provided significant text for this draft. Bernard Aboba, 4399 Adam Bergkvist, Dan Burnett, Ben Campbell, Alissa Cooper, Richard 4400 Ejzak, Stefan Hakansson, Ted Hardie, Christer Holmberg Andrew Hutton, 4401 Randell Jesup, Matthew Kaufman, Anant Narayanan, Adam Roach, Robert 4402 Sparks, Neil Stratford, Martin Thomson, Sean Turner, and Magnus 4403 Westerlund all provided valuable feedback on this proposal. 4405 11. References 4407 11.1. Normative References 4409 [I-D.ietf-avtext-rid] 4410 Roach, A., Nandakumar, S., and P. Thatcher, "RTP Stream 4411 Identifier Source Description (SDES)", draft-ietf-avtext- 4412 rid-09 (work in progress), October 2016. 4414 [I-D.ietf-ice-trickle] 4415 Ivov, E., Rescorla, E., Uberti, J., and P. Saint-Andre, 4416 "Trickle ICE: Incremental Provisioning of Candidates for 4417 the Interactive Connectivity Establishment (ICE) 4418 Protocol", draft-ietf-ice-trickle-13 (work in progress), 4419 July 2017. 4421 [I-D.ietf-mmusic-dtls-sdp] 4422 Holmberg, C. and R. Shpount, "Using the SDP Offer/Answer 4423 Mechanism for DTLS", draft-ietf-mmusic-dtls-sdp-28 (work 4424 in progress), August 2017. 4426 [I-D.ietf-mmusic-msid] 4427 Alvestrand, H., "WebRTC MediaStream Identification in the 4428 Session Description Protocol", draft-ietf-mmusic-msid-16 4429 (work in progress), February 2017. 4431 [I-D.ietf-mmusic-mux-exclusive] 4432 Holmberg, C., "Indicating Exclusive Support of RTP/RTCP 4433 Multiplexing using SDP", draft-ietf-mmusic-mux- 4434 exclusive-12 (work in progress), May 2017. 4436 [I-D.ietf-mmusic-rid] 4437 Thatcher, P., Zanaty, M., Nandakumar, S., Burman, B., 4438 Roach, A., and B. Campen, "RTP Payload Format 4439 Restrictions", draft-ietf-mmusic-rid-11 (work in 4440 progress), July 2017. 4442 [I-D.ietf-mmusic-sctp-sdp] 4443 Holmberg, C., Shpount, R., Loreto, S., and G. Camarillo, 4444 "Session Description Protocol (SDP) Offer/Answer 4445 Procedures For Stream Control Transmission Protocol (SCTP) 4446 over Datagram Transport Layer Security (DTLS) Transport.", 4447 draft-ietf-mmusic-sctp-sdp-26 (work in progress), April 4448 2017. 4450 [I-D.ietf-mmusic-sdp-bundle-negotiation] 4451 Holmberg, C., Alvestrand, H., and C. Jennings, 4452 "Negotiating Media Multiplexing Using the Session 4453 Description Protocol (SDP)", draft-ietf-mmusic-sdp-bundle- 4454 negotiation-38 (work in progress), April 2017. 4456 [I-D.ietf-mmusic-sdp-mux-attributes] 4457 Nandakumar, S., "A Framework for SDP Attributes when 4458 Multiplexing", draft-ietf-mmusic-sdp-mux-attributes-16 4459 (work in progress), December 2016. 4461 [I-D.ietf-mmusic-sdp-simulcast] 4462 Burman, B., Westerlund, M., Nandakumar, S., and M. Zanaty, 4463 "Using Simulcast in SDP and RTP Sessions", draft-ietf- 4464 mmusic-sdp-simulcast-10 (work in progress), July 2017. 4466 [I-D.ietf-rtcweb-fec] 4467 Uberti, J., "WebRTC Forward Error Correction 4468 Requirements", draft-ietf-rtcweb-fec-06 (work in 4469 progress), July 2017. 4471 [I-D.ietf-rtcweb-rtp-usage] 4472 Perkins, C., Westerlund, M., and J. Ott, "Web Real-Time 4473 Communication (WebRTC): Media Transport and Use of RTP", 4474 draft-ietf-rtcweb-rtp-usage-26 (work in progress), March 4475 2016. 4477 [I-D.ietf-rtcweb-security] 4478 Rescorla, E., "Security Considerations for WebRTC", draft- 4479 ietf-rtcweb-security-08 (work in progress), February 2015. 4481 [I-D.ietf-rtcweb-security-arch] 4482 Rescorla, E., "WebRTC Security Architecture", draft-ietf- 4483 rtcweb-security-arch-12 (work in progress), June 2016. 4485 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 4486 Requirement Levels", BCP 14, RFC 2119, 4487 DOI 10.17487/RFC2119, March 1997, 4488 . 4490 [RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, 4491 A., Peterson, J., Sparks, R., Handley, M., and E. 4492 Schooler, "SIP: Session Initiation Protocol", RFC 3261, 4493 DOI 10.17487/RFC3261, June 2002, . 4496 [RFC3264] Rosenberg, J. and H. Schulzrinne, "An Offer/Answer Model 4497 with Session Description Protocol (SDP)", RFC 3264, 4498 DOI 10.17487/RFC3264, June 2002, . 4501 [RFC3552] Rescorla, E. and B. Korver, "Guidelines for Writing RFC 4502 Text on Security Considerations", BCP 72, RFC 3552, 4503 DOI 10.17487/RFC3552, July 2003, . 4506 [RFC3605] Huitema, C., "Real Time Control Protocol (RTCP) attribute 4507 in Session Description Protocol (SDP)", RFC 3605, 4508 DOI 10.17487/RFC3605, October 2003, . 4511 [RFC3711] Baugher, M., McGrew, D., Naslund, M., Carrara, E., and K. 4512 Norrman, "The Secure Real-time Transport Protocol (SRTP)", 4513 RFC 3711, DOI 10.17487/RFC3711, March 2004, 4514 . 4516 [RFC3890] Westerlund, M., "A Transport Independent Bandwidth 4517 Modifier for the Session Description Protocol (SDP)", 4518 RFC 3890, DOI 10.17487/RFC3890, September 2004, 4519 . 4521 [RFC4145] Yon, D. and G. Camarillo, "TCP-Based Media Transport in 4522 the Session Description Protocol (SDP)", RFC 4145, 4523 DOI 10.17487/RFC4145, September 2005, . 4526 [RFC4566] Handley, M., Jacobson, V., and C. Perkins, "SDP: Session 4527 Description Protocol", RFC 4566, DOI 10.17487/RFC4566, 4528 July 2006, . 4530 [RFC4585] Ott, J., Wenger, S., Sato, N., Burmeister, C., and J. Rey, 4531 "Extended RTP Profile for Real-time Transport Control 4532 Protocol (RTCP)-Based Feedback (RTP/AVPF)", RFC 4585, 4533 DOI 10.17487/RFC4585, July 2006, . 4536 [RFC5124] Ott, J. and E. Carrara, "Extended Secure RTP Profile for 4537 Real-time Transport Control Protocol (RTCP)-Based Feedback 4538 (RTP/SAVPF)", RFC 5124, DOI 10.17487/RFC5124, February 4539 2008, . 4541 [RFC5245] Rosenberg, J., "Interactive Connectivity Establishment 4542 (ICE): A Protocol for Network Address Translator (NAT) 4543 Traversal for Offer/Answer Protocols", RFC 5245, 4544 DOI 10.17487/RFC5245, April 2010, . 4547 [RFC5285] Singer, D. and H. Desineni, "A General Mechanism for RTP 4548 Header Extensions", RFC 5285, DOI 10.17487/RFC5285, July 4549 2008, . 4551 [RFC5761] Perkins, C. and M. Westerlund, "Multiplexing RTP Data and 4552 Control Packets on a Single Port", RFC 5761, 4553 DOI 10.17487/RFC5761, April 2010, . 4556 [RFC5888] Camarillo, G. and H. Schulzrinne, "The Session Description 4557 Protocol (SDP) Grouping Framework", RFC 5888, 4558 DOI 10.17487/RFC5888, June 2010, . 4561 [RFC6236] Johansson, I. and K. Jung, "Negotiation of Generic Image 4562 Attributes in the Session Description Protocol (SDP)", 4563 RFC 6236, DOI 10.17487/RFC6236, May 2011, 4564 . 4566 [RFC6347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 4567 Security Version 1.2", RFC 6347, DOI 10.17487/RFC6347, 4568 January 2012, . 4570 [RFC6716] Valin, JM., Vos, K., and T. Terriberry, "Definition of the 4571 Opus Audio Codec", RFC 6716, DOI 10.17487/RFC6716, 4572 September 2012, . 4574 [RFC6904] Lennox, J., "Encryption of Header Extensions in the Secure 4575 Real-time Transport Protocol (SRTP)", RFC 6904, 4576 DOI 10.17487/RFC6904, April 2013, . 4579 [RFC7160] Petit-Huguenin, M. and G. Zorn, Ed., "Support for Multiple 4580 Clock Rates in an RTP Session", RFC 7160, 4581 DOI 10.17487/RFC7160, April 2014, . 4584 [RFC7587] Spittka, J., Vos, K., and JM. Valin, "RTP Payload Format 4585 for the Opus Speech and Audio Codec", RFC 7587, 4586 DOI 10.17487/RFC7587, June 2015, . 4589 [RFC7742] Roach, A., "WebRTC Video Processing and Codec 4590 Requirements", RFC 7742, DOI 10.17487/RFC7742, March 2016, 4591 . 4593 [RFC7850] Nandakumar, S., "Registering Values of the SDP 'proto' 4594 Field for Transporting RTP Media over TCP under Various 4595 RTP Profiles", RFC 7850, DOI 10.17487/RFC7850, April 2016, 4596 . 4598 [RFC7874] Valin, JM. and C. Bran, "WebRTC Audio Codec and Processing 4599 Requirements", RFC 7874, DOI 10.17487/RFC7874, May 2016, 4600 . 4602 [RFC8108] Lennox, J., Westerlund, M., Wu, Q., and C. Perkins, 4603 "Sending Multiple RTP Streams in a Single RTP Session", 4604 RFC 8108, DOI 10.17487/RFC8108, March 2017, 4605 . 4607 [RFC8122] Lennox, J. and C. Holmberg, "Connection-Oriented Media 4608 Transport over the Transport Layer Security (TLS) Protocol 4609 in the Session Description Protocol (SDP)", RFC 8122, 4610 DOI 10.17487/RFC8122, March 2017, . 4613 11.2. Informative References 4615 [I-D.ietf-mmusic-trickle-ice-sip] 4616 Ivov, E., Stach, T., Marocco, E., and C. Holmberg, "A 4617 Session Initiation Protocol (SIP) usage for Trickle ICE", 4618 draft-ietf-mmusic-trickle-ice-sip-08 (work in progress), 4619 July 2017. 4621 [I-D.ietf-rtcweb-ip-handling] 4622 Uberti, J. and G. Shieh, "WebRTC IP Address Handling 4623 Requirements", draft-ietf-rtcweb-ip-handling-04 (work in 4624 progress), July 2017. 4626 [I-D.ietf-rtcweb-sdp] 4627 Nandakumar, S. and C. Jennings, "Annotated Example SDP for 4628 WebRTC", draft-ietf-rtcweb-sdp-06 (work in progress), 4629 April 2017. 4631 [RFC3389] Zopf, R., "Real-time Transport Protocol (RTP) Payload for 4632 Comfort Noise (CN)", RFC 3389, DOI 10.17487/RFC3389, 4633 September 2002, . 4635 [RFC3556] Casner, S., "Session Description Protocol (SDP) Bandwidth 4636 Modifiers for RTP Control Protocol (RTCP) Bandwidth", 4637 RFC 3556, DOI 10.17487/RFC3556, July 2003, 4638 . 4640 [RFC3960] Camarillo, G. and H. Schulzrinne, "Early Media and Ringing 4641 Tone Generation in the Session Initiation Protocol (SIP)", 4642 RFC 3960, DOI 10.17487/RFC3960, December 2004, 4643 . 4645 [RFC4568] Andreasen, F., Baugher, M., and D. Wing, "Session 4646 Description Protocol (SDP) Security Descriptions for Media 4647 Streams", RFC 4568, DOI 10.17487/RFC4568, July 2006, 4648 . 4650 [RFC4588] Rey, J., Leon, D., Miyazaki, A., Varsa, V., and R. 4651 Hakenberg, "RTP Retransmission Payload Format", RFC 4588, 4652 DOI 10.17487/RFC4588, July 2006, . 4655 [RFC4733] Schulzrinne, H. and T. Taylor, "RTP Payload for DTMF 4656 Digits, Telephony Tones, and Telephony Signals", RFC 4733, 4657 DOI 10.17487/RFC4733, December 2006, . 4660 [RFC5506] Johansson, I. and M. Westerlund, "Support for Reduced-Size 4661 Real-Time Transport Control Protocol (RTCP): Opportunities 4662 and Consequences", RFC 5506, DOI 10.17487/RFC5506, April 4663 2009, . 4665 [RFC5576] Lennox, J., Ott, J., and T. Schierl, "Source-Specific 4666 Media Attributes in the Session Description Protocol 4667 (SDP)", RFC 5576, DOI 10.17487/RFC5576, June 2009, 4668 . 4670 [RFC5763] Fischl, J., Tschofenig, H., and E. Rescorla, "Framework 4671 for Establishing a Secure Real-time Transport Protocol 4672 (SRTP) Security Context Using Datagram Transport Layer 4673 Security (DTLS)", RFC 5763, DOI 10.17487/RFC5763, May 4674 2010, . 4676 [RFC5764] McGrew, D. and E. Rescorla, "Datagram Transport Layer 4677 Security (DTLS) Extension to Establish Keys for the Secure 4678 Real-time Transport Protocol (SRTP)", RFC 5764, 4679 DOI 10.17487/RFC5764, May 2010, . 4682 [RFC6464] Lennox, J., Ed., Ivov, E., and E. Marocco, "A Real-time 4683 Transport Protocol (RTP) Header Extension for Client-to- 4684 Mixer Audio Level Indication", RFC 6464, 4685 DOI 10.17487/RFC6464, December 2011, . 4688 [RFC6544] Rosenberg, J., Keranen, A., Lowekamp, B., and A. Roach, 4689 "TCP Candidates with Interactive Connectivity 4690 Establishment (ICE)", RFC 6544, DOI 10.17487/RFC6544, 4691 March 2012, . 4693 [TS26.114] 4694 3GPP TS 26.114 V12.8.0, "3rd Generation Partnership 4695 Project; Technical Specification Group Services and System 4696 Aspects; IP Multimedia Subsystem (IMS); Multimedia 4697 Telephony; Media handling and interaction (Release 12)", 4698 December 2014, . 4700 [W3C.webrtc] 4701 Bergkvist, A., Burnett, D., Jennings, C., Narayanan, A., 4702 Aboba, B., and T. Brandstetter, "WebRTC 1.0: Real-time 4703 Communication Between Browsers", World Wide Web Consortium 4704 WD WD-webrtc-20170515, May 2017, 4705 . 4707 Appendix A. Appendix A 4709 For the syntax validation performed in Section 5.7, the following 4710 list of ABNF definitions is used: 4712 +------------------------+------------------------------------------+ 4713 | Attribute | Reference | 4714 +------------------------+------------------------------------------+ 4715 | ptime | [RFC4566] Section 9 | 4716 | maxptime | [RFC4566] Section 9 | 4717 | rtpmap | [RFC4566] Section 9 | 4718 | recvonly | [RFC4566] Section 9 | 4719 | sendrecv | [RFC4566] Section 9 | 4720 | sendonly | [RFC4566] Section 9 | 4721 | inactive | [RFC4566] Section 9 | 4722 | framerate | [RFC4566] Section 9 | 4723 | fmtp | [RFC4566] Section 9 | 4724 | quality | [RFC4566] Section 9 | 4725 | rtcp | [RFC3605] Section 2.1 | 4726 | setup | [RFC4145] Sections 3, 4, and 5 | 4727 | connection | [RFC4145] Sections 3, 4, and 5 | 4728 | fingerprint | [RFC8122] Section 5 | 4729 | rtcp-fb | [RFC4585] Section 4.2 | 4730 | candidate | [RFC5245] Section 15.1 | 4731 | remote-candidates | [RFC5245] Section 15.2 | 4732 | ice-lite | [RFC5245] Section 15.3 | 4733 | ice-ufrag | [RFC5245] Section 15.4 | 4734 | ice-pwd | [RFC5245] Section 15.4 | 4735 | ice-options | [RFC5245] Section 15.5 | 4736 | extmap | [RFC5285] Section 7 | 4737 | mid | [RFC5888] Sections 4 and 5 | 4738 | group | [RFC5888] Sections 4 and 5 | 4739 | imageattr | [RFC6236] Section 3.1 | 4740 | extmap (encrypt | [RFC6904] Section 4 | 4741 | option) | | 4742 | msid | [I-D.ietf-mmusic-msid] Section 2 | 4743 | rid | [I-D.ietf-mmusic-rid] Section 10 | 4744 | simulcast | [I-D.ietf-mmusic-sdp-simulcast] Section | 4745 | | 6.1 | 4746 | tls-id | [I-D.ietf-mmusic-dtls-sdp] Section 4 | 4747 +------------------------+------------------------------------------+ 4749 Table 1: SDP ABNF References 4751 Appendix B. Change log 4753 Note to RFC Editor: Please remove this section before publication. 4755 Changes in draft-22: 4757 o Clarify currentDirection versus direction. 4759 o Correct session-id text so that it aligns with RFC 3264. 4761 o Clarify that generated ICE candidate objects must have all four 4762 fields. 4764 o Make rollback work from any state besides stable and regardless of 4765 whether setLocalDescription or setRemoteDescription is used. 4767 o Allow modifying SDP before sending or after receiving either 4768 offers or answers (previously this was forbidden for answers). 4770 o Provide rationale for several design choices. 4772 Changes in draft-21: 4774 o Change dtls-id to tls-id to match MMUSIC draft. 4776 o Replace regular expression for proto field with a list and clarify 4777 that the answer must exactly match the offer. 4779 o Remove text about how to error check on setLocal because local 4780 descriptions cannot be changed. 4782 o Rework silence suppression support to always require that both 4783 sides agree to silence suppression or none is used. 4785 o Remove instructions to parse "a=ssrc-group". 4787 o Allow the addition of new codecs in answers and in subsequent 4788 offers. 4790 o Clarify imageattr processing. Replace use of [x=0,y=0] with 4791 direction indicators. 4793 o Document when early media can occur. 4795 o Fix ICE default port handling when bundle-only is used. 4797 o Forbid duplicating IDENTICAL/TRANSPORT attributes when you are 4798 bundling. 4800 o Clarify the number of components to gather when bundle is 4801 involved. 4803 o Explicitly state that PTs and SSRCs are to be used for demuxing. 4805 o Update guidance on "a=setup" line. This should now match the 4806 MMUSIC draft. 4808 o Update guidance on certificate/digest matching to conform to 4809 RFC8122. 4811 o Update examples. 4813 Changes in draft-20: 4815 o Remove Appendix-B. 4817 Changes in draft-19: 4819 o Examples are now machine-generated for correctness, and use IETF- 4820 approved example IP addresses. 4822 o Add early transport warmup example, and add missing attributes to 4823 existing examples. 4825 o Only send "a=rtcp-mux-only" and "a=bundle-only" on new m= 4826 sections. 4828 o Update references. 4830 o Add coverage of a=identity. 4832 o Explain the lipsync group algorithm more thoroughly. 4834 o Remove unnecessary list of MTI specs. 4836 o Allow codecs which weren't offered to appear in answers and which 4837 weren't selected to appear in subsequent offers. 4839 o Codec preferences now are applied on both initial and subsequent 4840 offers and answers. 4842 o Clarify a=msid handling for recvonly m= sections. 4844 o Clarify behavior of attributes for bundle-only data channels. 4846 o Allow media attributes to appear in data m= sections when all the 4847 media m= sections are bundle-only. 4849 o Use consistent terminology for JSEP implementations. 4851 o Describe how to handle failed API calls. 4853 o Some cleanup on routing rules. 4855 Changes in draft-18: 4857 o Update demux algorithm and move it to an appendix in preparation 4858 for merging it into BUNDLE. 4860 o Clarify why we can't handle an incoming offer to send simulcast. 4862 o Expand IceCandidate object text. 4864 o Further document use of ICE candidate pool. 4866 o Document removeTrack. 4868 o Update requirements to only accept the last generated offer/answer 4869 as an argument to setLocalDescription. 4871 o Allow round pixels. 4873 o Fix code around default timing when AVPF is not specified. 4875 o Clean up terminology around m= line and m=section. 4877 o Provide a more realistic example for minimum decoder capabilities. 4879 o Document behavior when rtcp-mux policy is require but rtcp-mux 4880 attribute not provided. 4882 o Expanded discussion of RtpSender and RtpReceiver. 4884 o Add RtpTransceiver.currentDirection and document setDirection. 4886 o Require imageattr x=0, y=0 to indicate that there are no valid 4887 resolutions. 4889 o Require a privacy-preserving MID/RID construction. 4891 o Require support for RFC 3556 bandwidth modifiers. 4893 o Update maxptime description. 4895 o Note that endpoints may encounter extra codecs in answers and 4896 subsequent offers from non-JSEP peers. 4898 o Update references. 4900 Changes in draft-17: 4902 o Split createOffer and createAnswer sections to clearly indicate 4903 attributes which always appear and which only appear when not 4904 bundled into another m= section. 4906 o Add descriptions of RtpTransceiver methods. 4908 o Describe how to process RTCP feedback attributes. 4910 o Clarify transceiver directions and their interaction with 3264. 4912 o Describe setCodecPreferences. 4914 o Update RTP demux algorithm. Include RTCP. 4916 o Update requirements for when a=rtcp is included, limiting to cases 4917 where it is needed for backward compatibility. 4919 o Clarify SAR handling. 4921 o Updated addTrack matching algorithm. 4923 o Remove a=ssrc requirements. 4925 o Handle a=setup in reoffers. 4927 o Discuss how RTX/FEC should be handled. 4929 o Discuss how telephone-event should be handled. 4931 o Discuss how CN/DTX should be handled. 4933 o Add missing references to ABNF table. 4935 Changes in draft-16: 4937 o Update addIceCandidate to indicate ICE generation and allow per-m= 4938 section end-of-candidates. 4940 o Update fingerprint handling to use draft-ietf-mmusic-4572-update. 4942 o Update text around SDP processing of RTP header extensions and 4943 payload formats. 4945 o Add sections on simulcast, addTransceiver, and createDataChannel. 4947 o Clarify text to ensure that the session ID is a positive 63 bit 4948 integer. 4950 o Clarify SDP processing for direction indication. 4952 o Describe SDP processing for rtcp-mux-only. 4954 o Specify how SDP session version in o= line. 4956 o Require that when doing an re-offer, the capabilities of the new 4957 session are mostly required to be a subset of the previously 4958 negotiated session. 4960 o Clarified ICE restart interaction with bundle-only. 4962 o Remove support for changing SDP before calling 4963 setLocalDescription. 4965 o Specify algorithm for demuxing RTP based on MID, PT, and SSRC. 4967 o Clarify rules for rejecting m= lines when bundle policy is 4968 balanced or max-bundle. 4970 Changes in draft-15: 4972 o Clarify text around codecs offered in subsequent transactions to 4973 refer to what's been negotiated. 4975 o Rewrite LS handling text to indicate edge cases and that we're 4976 living with them. 4978 o Require that answerer reject m= lines when there are no codecs in 4979 common. 4981 o Enforce max-bundle on offer processing. 4983 o Fix TIAS formula to handle bits vs. kilobits. 4985 o Describe addTrack algorithm. 4987 o Clean up references. 4989 Changes in draft-14: 4991 o Added discussion of RtpTransceivers + RtpSenders + RtpReceivers, 4992 and how they interact with createOffer/createAnswer. 4994 o Removed obsolete OfferToReceiveX options. 4996 o Explained how addIceCandidate can be used for end-of-candidates. 4998 Changes in draft-13: 5000 o Clarified which SDP lines can be ignored. 5002 o Clarified how to handle various received attributes. 5004 o Revised how attributes should be generated for bundled m= lines. 5006 o Remove unused references. 5008 o Remove text advocating use of unilateral PTs. 5010 o Trigger an ICE restart even if the ICE candidate policy is being 5011 made more strict. 5013 o Remove the 'public' ICE candidate policy. 5015 o Move open issues into GitHub issues. 5017 o Split local/remote description accessors into current/pending. 5019 o Clarify a=imageattr handling. 5021 o Add more detail on VoiceActivityDetection handling. 5023 o Reference draft-shieh-rtcweb-ip-handling. 5025 o Make it clear when an ICE restart should occur. 5027 o Resolve changes needed in references. 5029 o Remove MSID semantics. 5031 o ice-options are now at session level. 5033 o Default RTCP mux policy is now 'require'. 5035 Changes in draft-12: 5037 o Filled in sections on applying local and remote descriptions. 5039 o Discussed downscaling and upscaling to fulfill imageattr 5040 requirements. 5042 o Updated what SDP can be modified by the application. 5044 o Updated to latest datachannel SDP. 5046 o Allowed multiple fingerprint lines. 5048 o Switched back to IPv4 for dummy candidates. 5050 o Added additional clarity on ICE default candidates. 5052 Changes in draft-11: 5054 o Clarified handling of RTP CNAMEs. 5056 o Updated what SDP lines should be processed or ignored. 5058 o Specified how a=imageattr should be used. 5060 Changes in draft-10: 5062 o Described video size negotiation with imageattr. 5064 o Clarified rejection of sections that do not have mux-only. 5066 o Add handling of LS groups 5068 Changes in draft-09: 5070 o Don't return null for {local,remote}Description after close(). 5072 o Changed TCP/TLS to UDP/DTLS in RTP profile names. 5074 o Separate out bundle and mux policy. 5076 o Added specific references to FEC mechanisms. 5078 o Added canTrickle mechanism. 5080 o Added section on subsequent answers and, answer options. 5082 o Added text defining set{Local,Remote}Description behavior. 5084 Changes in draft-08: 5086 o Added new example section and removed old examples in appendix. 5088 o Fixed field handling. 5090 o Added text describing a=rtcp attribute. 5092 o Reworked handling of OfferToReceiveAudio and OfferToReceiveVideo 5093 per discussion at IETF 90. 5095 o Reworked trickle ICE handling and its impact on m= and c= lines 5096 per discussion at interim. 5098 o Added max-bundle-and-rtcp-mux policy. 5100 o Added description of maxptime handling. 5102 o Updated ICE candidate pool default to 0. 5104 o Resolved open issues around AppID/receiver-ID. 5106 o Reworked and expanded how changes to the ICE configuration are 5107 handled. 5109 o Some reference updates. 5111 o Editorial clarification. 5113 Changes in draft-07: 5115 o Expanded discussion of VAD and Opus DTX. 5117 o Added a security considerations section. 5119 o Rewrote the section on modifying SDP to require implementations to 5120 clearly indicate whether any given modification is allowed. 5122 o Clarified impact of IceRestart on CreateOffer in local-offer 5123 state. 5125 o Guidance on whether attributes should be defined at the media 5126 level or the session level. 5128 o Renamed "default" bundle policy to "balanced". 5130 o Removed default ICE candidate pool size and clarify how it works. 5132 o Defined a canonical order for assignment of MSTs to m= lines. 5134 o Removed discussion of rehydration. 5136 o Added Eric Rescorla as a draft editor. 5138 o Cleaned up references. 5140 o Editorial cleanup 5142 Changes in draft-06: 5144 o Reworked handling of m= line recycling. 5146 o Added handling of BUNDLE and bundle-only. 5148 o Clarified handling of rollback. 5150 o Added text describing the ICE Candidate Pool and its behavior. 5152 o Allowed OfferToReceiveX to create multiple recvonly m= sections. 5154 Changes in draft-05: 5156 o Fixed several issues identified in the createOffer/Answer sections 5157 during document review. 5159 o Updated references. 5161 Changes in draft-04: 5163 o Filled in sections on createOffer and createAnswer. 5165 o Added SDP examples. 5167 o Fixed references. 5169 Changes in draft-03: 5171 o Added text describing relationship to W3C specification 5173 Changes in draft-02: 5175 o Converted from nroff 5177 o Removed comparisons to old approaches abandoned by the working 5178 group 5180 o Removed stuff that has moved to W3C specification 5182 o Align SDP handling with W3C draft 5184 o Clarified section on forking. 5186 Changes in draft-01: 5188 o Added diagrams for architecture and state machine. 5190 o Added sections on forking and rehydration. 5192 o Clarified meaning of "pranswer" and "answer". 5194 o Reworked how ICE restarts and media directions are controlled. 5196 o Added list of parameters that can be changed in a description. 5198 o Updated suggested API and examples to match latest thinking. 5200 o Suggested API and examples have been moved to an appendix. 5202 Changes in draft -00: 5204 o Migrated from draft-uberti-rtcweb-jsep-02. 5206 Authors' Addresses 5208 Justin Uberti 5209 Google 5210 747 6th St S 5211 Kirkland, WA 98033 5212 USA 5214 Email: justin@uberti.name 5216 Cullen Jennings 5217 Cisco 5218 400 3rd Avenue SW 5219 Calgary, AB T2P 4H2 5220 Canada 5222 Email: fluffy@iii.ca 5224 Eric Rescorla (editor) 5225 Mozilla 5226 331 Evelyn Ave 5227 Mountain View, CA 94041 5228 USA 5230 Email: ekr@rtfm.com