idnits 2.17.1 draft-ietf-rtcweb-jsep-18.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 : ---------------------------------------------------------------------------- == There are 25 instances of lines with non-RFC6890-compliant IPv4 addresses in the document. If these are example addresses, they should be changed. == There are 10 instances of lines with private range IPv4 addresses in the document. If these are generic example addresses, they should be changed to use any of the ranges defined in RFC 6890 (or successor): 192.0.2.x, 198.51.100.x or 203.0.113.x. -- 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 -- The document date (January 16, 2017) is 2656 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) -- Looks like a reference, but probably isn't: '0' on line 796 == Unused Reference: 'I-D.ietf-rtcweb-audio' is defined on line 3880, but no explicit reference was found in the text == Unused Reference: 'I-D.ietf-rtcweb-video' is defined on line 3904, but no explicit reference was found in the text == Outdated reference: A later version (-09) exists of draft-ietf-avtext-rid-00 == Outdated reference: A later version (-13) exists of draft-ietf-mmusic-4572-update-05 == Outdated reference: A later version (-32) exists of draft-ietf-mmusic-dtls-sdp-14 == Outdated reference: A later version (-17) exists of draft-ietf-mmusic-msid-01 == Outdated reference: A later version (-12) exists of draft-ietf-mmusic-mux-exclusive-08 == Outdated reference: A later version (-15) exists of draft-ietf-mmusic-rid-04 == Outdated reference: A later version (-26) exists of draft-ietf-mmusic-sctp-sdp-04 == Outdated reference: A later version (-54) exists of draft-ietf-mmusic-sdp-bundle-negotiation-04 == Outdated reference: A later version (-19) exists of draft-ietf-mmusic-sdp-mux-attributes-01 == Outdated reference: A later version (-14) exists of draft-ietf-mmusic-sdp-simulcast-04 == Outdated reference: A later version (-11) exists of draft-ietf-rtcweb-audio-02 == Outdated reference: A later version (-10) exists of draft-ietf-rtcweb-fec-00 == Outdated reference: A later version (-26) exists of draft-ietf-rtcweb-rtp-usage-09 == Outdated reference: A later version (-12) exists of draft-ietf-rtcweb-security-06 == Outdated reference: A later version (-20) exists of draft-ietf-rtcweb-security-arch-09 == Outdated reference: A later version (-06) exists of draft-ietf-rtcweb-video-00 ** Obsolete normative reference: RFC 4566 (Obsoleted by RFC 8866) ** Obsolete normative reference: RFC 4572 (Obsoleted by RFC 8122) ** 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 (-12) exists of draft-ietf-rtcweb-ip-handling-01 == Outdated reference: A later version (-08) exists of draft-nandakumar-rtcweb-sdp-02 Summary: 5 errors (**), 0 flaws (~~), 23 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group J. Uberti 3 Internet-Draft Google 4 Intended status: Standards Track C. Jennings 5 Expires: July 20, 2017 Cisco 6 E. Rescorla, Ed. 7 Mozilla 8 January 16, 2017 10 Javascript Session Establishment Protocol 11 draft-ietf-rtcweb-jsep-18 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 July 20, 2017. 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 . . . . . . . . . . . . . . . 5 57 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 6 58 3. Semantics and Syntax . . . . . . . . . . . . . . . . . . . . 6 59 3.1. Signaling Model . . . . . . . . . . . . . . . . . . . . . 6 60 3.2. Session Descriptions and State Machine . . . . . . . . . 7 61 3.3. Session Description Format . . . . . . . . . . . . . . . 10 62 3.4. Session Description Control . . . . . . . . . . . . . . . 10 63 3.4.1. RtpTransceivers . . . . . . . . . . . . . . . . . . . 10 64 3.4.2. RtpSenders . . . . . . . . . . . . . . . . . . . . . 11 65 3.4.3. RtpReceivers . . . . . . . . . . . . . . . . . . . . 11 66 3.5. ICE . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 67 3.5.1. ICE Gathering Overview . . . . . . . . . . . . . . . 11 68 3.5.2. ICE Candidate Trickling . . . . . . . . . . . . . . . 12 69 3.5.2.1. ICE Candidate Format . . . . . . . . . . . . . . 12 70 3.5.3. ICE Candidate Policy . . . . . . . . . . . . . . . . 13 71 3.5.4. ICE Candidate Pool . . . . . . . . . . . . . . . . . 14 72 3.6. Video Size Negotiation . . . . . . . . . . . . . . . . . 15 73 3.6.1. Creating an imageattr Attribute . . . . . . . . . . . 15 74 3.6.2. Interpreting an imageattr Attribute . . . . . . . . . 16 75 3.7. Simulcast . . . . . . . . . . . . . . . . . . . . . . . . 17 76 3.8. Interactions With Forking . . . . . . . . . . . . . . . . 18 77 3.8.1. Sequential Forking . . . . . . . . . . . . . . . . . 19 78 3.8.2. Parallel Forking . . . . . . . . . . . . . . . . . . 19 79 4. Interface . . . . . . . . . . . . . . . . . . . . . . . . . . 20 80 4.1. PeerConnection . . . . . . . . . . . . . . . . . . . . . 20 81 4.1.1. Constructor . . . . . . . . . . . . . . . . . . . . . 20 82 4.1.2. addTrack . . . . . . . . . . . . . . . . . . . . . . 22 83 4.1.3. removeTrack . . . . . . . . . . . . . . . . . . . . . 23 84 4.1.4. addTransceiver . . . . . . . . . . . . . . . . . . . 23 85 4.1.5. createDataChannel . . . . . . . . . . . . . . . . . . 23 86 4.1.6. createOffer . . . . . . . . . . . . . . . . . . . . . 24 87 4.1.7. createAnswer . . . . . . . . . . . . . . . . . . . . 25 88 4.1.8. SessionDescriptionType . . . . . . . . . . . . . . . 25 89 4.1.8.1. Use of Provisional Answers . . . . . . . . . . . 26 90 4.1.8.2. Rollback . . . . . . . . . . . . . . . . . . . . 27 91 4.1.9. setLocalDescription . . . . . . . . . . . . . . . . . 28 92 4.1.10. setRemoteDescription . . . . . . . . . . . . . . . . 28 93 4.1.11. currentLocalDescription . . . . . . . . . . . . . . . 29 94 4.1.12. pendingLocalDescription . . . . . . . . . . . . . . . 29 95 4.1.13. currentRemoteDescription . . . . . . . . . . . . . . 29 96 4.1.14. pendingRemoteDescription . . . . . . . . . . . . . . 29 97 4.1.15. canTrickleIceCandidates . . . . . . . . . . . . . . . 30 98 4.1.16. setConfiguration . . . . . . . . . . . . . . . . . . 30 99 4.1.17. addIceCandidate . . . . . . . . . . . . . . . . . . . 31 100 4.2. RtpTransceiver . . . . . . . . . . . . . . . . . . . . . 32 101 4.2.1. stop . . . . . . . . . . . . . . . . . . . . . . . . 32 102 4.2.2. stopped . . . . . . . . . . . . . . . . . . . . . . . 32 103 4.2.3. setDirection . . . . . . . . . . . . . . . . . . . . 32 104 4.2.4. direction . . . . . . . . . . . . . . . . . . . . . . 32 105 4.2.5. currentDirection . . . . . . . . . . . . . . . . . . 33 106 4.2.6. setCodecPreferences . . . . . . . . . . . . . . . . . 33 107 5. SDP Interaction Procedures . . . . . . . . . . . . . . . . . 33 108 5.1. Requirements Overview . . . . . . . . . . . . . . . . . . 34 109 5.1.1. Implementation Requirements . . . . . . . . . . . . . 34 110 5.1.2. Usage Requirements . . . . . . . . . . . . . . . . . 35 111 5.1.3. Profile Names and Interoperability . . . . . . . . . 36 112 5.2. Constructing an Offer . . . . . . . . . . . . . . . . . . 37 113 5.2.1. Initial Offers . . . . . . . . . . . . . . . . . . . 37 114 5.2.2. Subsequent Offers . . . . . . . . . . . . . . . . . . 42 115 5.2.3. Options Handling . . . . . . . . . . . . . . . . . . 46 116 5.2.3.1. IceRestart . . . . . . . . . . . . . . . . . . . 46 117 5.2.3.2. VoiceActivityDetection . . . . . . . . . . . . . 46 118 5.3. Generating an Answer . . . . . . . . . . . . . . . . . . 47 119 5.3.1. Initial Answers . . . . . . . . . . . . . . . . . . . 47 120 5.3.2. Subsequent Answers . . . . . . . . . . . . . . . . . 51 121 5.3.3. Options Handling . . . . . . . . . . . . . . . . . . 53 122 5.3.3.1. VoiceActivityDetection . . . . . . . . . . . . . 53 123 5.4. Modifying an Offer or Answer . . . . . . . . . . . . . . 53 124 5.5. Processing a Local Description . . . . . . . . . . . . . 54 125 5.6. Processing a Remote Description . . . . . . . . . . . . . 54 126 5.7. Parsing a Session Description . . . . . . . . . . . . . . 55 127 5.7.1. Session-Level Parsing . . . . . . . . . . . . . . . . 55 128 5.7.2. Media Section Parsing . . . . . . . . . . . . . . . . 57 129 5.7.3. Semantics Verification . . . . . . . . . . . . . . . 59 130 5.8. Applying a Local Description . . . . . . . . . . . . . . 60 131 5.9. Applying a Remote Description . . . . . . . . . . . . . . 62 132 5.10. Applying an Answer . . . . . . . . . . . . . . . . . . . 65 133 6. Processing RTP/RTCP . . . . . . . . . . . . . . . . . . . . . 68 134 7. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 68 135 7.1. Simple Example . . . . . . . . . . . . . . . . . . . . . 68 136 7.2. Normal Examples . . . . . . . . . . . . . . . . . . . . . 72 137 8. Security Considerations . . . . . . . . . . . . . . . . . . . 81 138 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 81 139 10. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 81 140 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 82 141 11.1. Normative References . . . . . . . . . . . . . . . . . . 82 142 11.2. Informative References . . . . . . . . . . . . . . . . . 85 143 Appendix A. Appendix A . . . . . . . . . . . . . . . . . . . . . 87 144 Appendix B. Appendix B . . . . . . . . . . . . . . . . . . . . . 88 145 Appendix C. Change log . . . . . . . . . . . . . . . . . . . . . 91 146 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 99 148 1. Introduction 150 This document describes how the W3C WEBRTC RTCPeerConnection 151 interface [W3C.WD-webrtc-20140617] is used to control the setup, 152 management and teardown of a multimedia session. 154 1.1. General Design of JSEP 156 The thinking behind WebRTC call setup has been to fully specify and 157 control the media plane, but to leave the signaling plane up to the 158 application as much as possible. The rationale is that different 159 applications may prefer to use different protocols, such as the 160 existing SIP or Jingle call signaling protocols, or something custom 161 to the particular application, perhaps for a novel use case. In this 162 approach, the key information that needs to be exchanged is the 163 multimedia session description, which specifies the necessary 164 transport and media configuration information necessary to establish 165 the media plane. 167 With these considerations in mind, this document describes the 168 Javascript Session Establishment Protocol (JSEP) that allows for full 169 control of the signaling state machine from Javascript. JSEP removes 170 the browser almost entirely from the core signaling flow, which is 171 instead handled by the Javascript making use of two interfaces: (1) 172 passing in local and remote session descriptions and (2) interacting 173 with the ICE state machine. 175 In this document, the use of JSEP is described as if it always occurs 176 between two browsers. Note though in many cases it will actually be 177 between a browser and some kind of server, such as a gateway or MCU. 178 This distinction is invisible to the browser; it just follows the 179 instructions it is given via the API. 181 JSEP's handling of session descriptions is simple and 182 straightforward. Whenever an offer/answer exchange is needed, the 183 initiating side creates an offer by calling a createOffer() API. The 184 application then uses that offer to set up its local config via the 185 setLocalDescription() API. The offer is finally sent off to the 186 remote side over its preferred signaling mechanism (e.g., 187 WebSockets); upon receipt of that offer, the remote party installs it 188 using the setRemoteDescription() API. 190 To complete the offer/answer exchange, the remote party uses the 191 createAnswer() API to generate an appropriate answer, applies it 192 using the setLocalDescription() API, and sends the answer back to the 193 initiator over the signaling channel. When the initiator gets that 194 answer, it installs it using the setRemoteDescription() API, and 195 initial setup is complete. This process can be repeated for 196 additional offer/answer exchanges. 198 Regarding ICE [RFC5245], JSEP decouples the ICE state machine from 199 the overall signaling state machine, as the ICE state machine must 200 remain in the browser, because only the browser has the necessary 201 knowledge of candidates and other transport info. Performing this 202 separation also provides additional flexibility; in protocols that 203 decouple session descriptions from transport, such as Jingle, the 204 session description can be sent immediately and the transport 205 information can be sent when available. In protocols that don't, 206 such as SIP, the information can be used in the aggregated form. 207 Sending transport information separately can allow for faster ICE and 208 DTLS startup, since ICE checks can start as soon as any transport 209 information is available rather than waiting for all of it. 211 Through its abstraction of signaling, the JSEP approach does require 212 the application to be aware of the signaling process. While the 213 application does not need to understand the contents of session 214 descriptions to set up a call, the application must call the right 215 APIs at the right times, convert the session descriptions and ICE 216 information into the defined messages of its chosen signaling 217 protocol, and perform the reverse conversion on the messages it 218 receives from the other side. 220 One way to mitigate this is to provide a Javascript library that 221 hides this complexity from the developer; said library would 222 implement a given signaling protocol along with its state machine and 223 serialization code, presenting a higher level call-oriented interface 224 to the application developer. For example, libraries exist to adapt 225 the JSEP API into an API suitable for a SIP or XMPP. Thus, JSEP 226 provides greater control for the experienced developer without 227 forcing any additional complexity on the novice developer. 229 1.2. Other Approaches Considered 231 One approach that was considered instead of JSEP was to include a 232 lightweight signaling protocol. Instead of providing session 233 descriptions to the API, the API would produce and consume messages 234 from this protocol. While providing a more high-level API, this put 235 more control of signaling within the browser, forcing the browser to 236 have to understand and handle concepts like signaling glare. In 237 addition, it prevented the application from driving the state machine 238 to a desired state, as is needed in the page reload case. 240 A second approach that was considered but not chosen was to decouple 241 the management of the media control objects from session 242 descriptions, instead offering APIs that would control each component 243 directly. This was rejected based on a feeling that requiring 244 exposure of this level of complexity to the application programmer 245 would not be beneficial; it would result in an API where even a 246 simple example would require a significant amount of code to 247 orchestrate all the needed interactions, as well as creating a large 248 API surface that needed to be agreed upon and documented. In 249 addition, these API points could be called in any order, resulting in 250 a more complex set of interactions with the media subsystem than the 251 JSEP approach, which specifies how session descriptions are to be 252 evaluated and applied. 254 One variation on JSEP that was considered was to keep the basic 255 session description-oriented API, but to move the mechanism for 256 generating offers and answers out of the browser. Instead of 257 providing createOffer/createAnswer methods within the browser, this 258 approach would instead expose a getCapabilities API which would 259 provide the application with the information it needed in order to 260 generate its own session descriptions. This increases the amount of 261 work that the application needs to do; it needs to know how to 262 generate session descriptions from capabilities, and especially how 263 to generate the correct answer from an arbitrary offer and the 264 supported capabilities. While this could certainly be addressed by 265 using a library like the one mentioned above, it basically forces the 266 use of said library even for a simple example. Providing 267 createOffer/createAnswer avoids this problem, but still allows 268 applications to generate their own offers/answers (to a large extent) 269 if they choose, using the description generated by createOffer as an 270 indication of the browser's capabilities. 272 2. Terminology 274 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 275 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 276 document are to be interpreted as described in [RFC2119]. 278 3. Semantics and Syntax 280 3.1. Signaling Model 282 JSEP does not specify a particular signaling model or state machine, 283 other than the generic need to exchange session descriptions in the 284 fashion described by [RFC3264](offer/answer) in order for both sides 285 of the session to know how to conduct the session. JSEP provides 286 mechanisms to create offers and answers, as well as to apply them to 287 a session. However, the browser is totally decoupled from the actual 288 mechanism by which these offers and answers are communicated to the 289 remote side, including addressing, retransmission, forking, and glare 290 handling. These issues are left entirely up to the application; the 291 application has complete control over which offers and answers get 292 handed to the browser, and when. 294 +-----------+ +-----------+ 295 | Web App |<--- App-Specific Signaling -->| Web App | 296 +-----------+ +-----------+ 297 ^ ^ 298 | SDP | SDP 299 V V 300 +-----------+ +-----------+ 301 | Browser |<----------- Media ------------>| Browser | 302 +-----------+ +-----------+ 304 Figure 1: JSEP Signaling Model 306 3.2. Session Descriptions and State Machine 308 In order to establish the media plane, the user agent needs specific 309 parameters to indicate what to transmit to the remote side, as well 310 as how to handle the media that is received. These parameters are 311 determined by the exchange of session descriptions in offers and 312 answers, and there are certain details to this process that must be 313 handled in the JSEP APIs. 315 Whether a session description applies to the local side or the remote 316 side affects the meaning of that description. For example, the list 317 of codecs sent to a remote party indicates what the local side is 318 willing to receive, which, when intersected with the set of codecs 319 the remote side supports, specifies what the remote side should send. 320 However, not all parameters follow this rule; for example, the DTLS- 321 SRTP parameters [RFC5763] sent to a remote party indicate what 322 certificate the local side will use in DTLS setup, and thereby what 323 the remote party should expect to receive; the remote party will have 324 to accept these parameters, with no option to choose different 325 values. 327 In addition, various RFCs put different conditions on the format of 328 offers versus answers. For example, an offer may propose an 329 arbitrary number of media streams (i.e. m= sections), but an answer 330 must contain the exact same number as the offer. 332 Lastly, while the exact media parameters are only known only after an 333 offer and an answer have been exchanged, it is possible for the 334 offerer to receive media after they have sent an offer and before 335 they have received an answer. To properly process incoming media in 336 this case, the offerer's media handler must be aware of the details 337 of the offer before the answer arrives. 339 Therefore, in order to handle session descriptions properly, the user 340 agent needs: 342 1. To know if a session description pertains to the local or remote 343 side. 345 2. To know if a session description is an offer or an answer. 347 3. To allow the offer to be specified independently of the answer. 349 JSEP addresses this by adding both setLocalDescription and 350 setRemoteDescription methods and having session description objects 351 contain a type field indicating the type of session description being 352 supplied. This satisfies the requirements listed above for both the 353 offerer, who first calls setLocalDescription(sdp [offer]) and then 354 later setRemoteDescription(sdp [answer]), as well as for the 355 answerer, who first calls setRemoteDescription(sdp [offer]) and then 356 later setLocalDescription(sdp [answer]). 358 JSEP also allows for an answer to be treated as provisional by the 359 application. Provisional answers provide a way for an answerer to 360 communicate initial session parameters back to the offerer, in order 361 to allow the session to begin, while allowing a final answer to be 362 specified later. This concept of a final answer is important to the 363 offer/answer model; when such an answer is received, any extra 364 resources allocated by the caller can be released, now that the exact 365 session configuration is known. These "resources" can include things 366 like extra ICE components, TURN candidates, or video decoders. 367 Provisional answers, on the other hand, do no such deallocation; as a 368 result, multiple dissimilar provisional answers, with their own codec 369 choices, transport parameters, etc., can be received and applied 370 during call setup. Note that the final answer itself may be 371 different than any received provisional answers. 373 In [RFC3264], the constraint at the signaling level is that only one 374 offer can be outstanding for a given session, but at the media stack 375 level, a new offer can be generated at any point. For example, when 376 using SIP for signaling, if one offer is sent, then cancelled using a 377 SIP CANCEL, another offer can be generated even though no answer was 378 received for the first offer. To support this, the JSEP media layer 379 can provide an offer via the createOffer() method whenever the 380 Javascript application needs one for the signaling. The answerer can 381 send back zero or more provisional answers, and finally end the 382 offer-answer exchange by sending a final answer. The state machine 383 for this is as follows: 385 setRemote(OFFER) setLocal(PRANSWER) 386 /-----\ /-----\ 387 | | | | 388 v | v | 389 +---------------+ | +---------------+ | 390 | |----/ | |----/ 391 | | setLocal(PRANSWER) | | 392 | Remote-Offer |------------------- >| Local-Pranswer| 393 | | | | 394 | | | | 395 +---------------+ +---------------+ 396 ^ | | 397 | | setLocal(ANSWER) | 398 setRemote(OFFER) | | 399 | V setLocal(ANSWER) | 400 +---------------+ | 401 | | | 402 | |<---------------------------+ 403 | Stable | 404 | |<---------------------------+ 405 | | | 406 +---------------+ setRemote(ANSWER) | 407 ^ | | 408 | | setLocal(OFFER) | 409 setRemote(ANSWER) | | 410 | V | 411 +---------------+ +---------------+ 412 | | | | 413 | | setRemote(PRANSWER) | | 414 | Local-Offer |------------------- >|Remote-Pranswer| 415 | | | | 416 | |----\ | |----\ 417 +---------------+ | +---------------+ | 418 ^ | ^ | 419 | | | | 420 \-----/ \-----/ 421 setLocal(OFFER) setRemote(PRANSWER) 423 Figure 2: JSEP State Machine 425 Aside from these state transitions there is no other difference 426 between the handling of provisional ("pranswer") and final ("answer") 427 answers. 429 3.3. Session Description Format 431 JSEP's session descriptions use SDP syntax for their internal 432 representation. While this format is not optimal for manipulation 433 from Javascript, it is widely accepted, and frequently updated with 434 new features; any alternate encoding of session descriptions would 435 have to keep pace with the changes to SDP, at least until the time 436 that this new encoding eclipsed SDP in popularity. 438 However, to simplify Javascript processing, and provide for future 439 flexibility, the SDP syntax is encapsulated within a 440 SessionDescription object, which can be constructed from SDP, and be 441 serialized out to SDP. If future specifications agree on a JSON 442 format for session descriptions, we could easily enable this object 443 to generate and consume that JSON. 445 Other methods may be added to SessionDescription in the future to 446 simplify handling of SessionDescriptions from Javascript. In the 447 meantime, Javascript libraries can be used to perform these 448 manipulations. 450 Note that most applications should be able to treat the 451 SessionDescriptions produced and consumed by these various API calls 452 as opaque blobs; that is, the application will not need to read or 453 change them. 455 3.4. Session Description Control 457 In order to give the application control over various common session 458 parameters, JSEP provides control surfaces which tell the browser how 459 to generate session descriptions. This avoids the need for 460 Javascript to modify session descriptions in most cases. 462 Changes to these objects result in changes to the session 463 descriptions generated by subsequent createOffer/Answer calls. 465 3.4.1. RtpTransceivers 467 RtpTransceivers allow the application to control the RTP media 468 associated with one m= section. Each RtpTransceiver has an RtpSender 469 and an RtpReceiver, which an application can use to control the 470 sending and receiving of RTP media. The application may also modify 471 the RtpTransceiver directly, for instance, by stopping it. 473 RtpTransceivers generally have a 1:1 mapping with m= sections, 474 although there may be more RtpTransceivers than m= sections when 475 RtpTransceivers are created but not yet associated with a m= section, 476 or if RtpTransceivers have been stopped and disassociated from m= 477 sections. An RtpTransceiver is said to be associated with an m= 478 section if its mid property is non-null; otherwise it is said to be 479 disassociated. The associated m= section is determined using a 480 mapping between transceivers and m= section indices, formed when 481 creating an offer or applying a remote offer. An RtpTransceiver is 482 never associated with more than one m= section, and once a session 483 description is applied, a m= section is always associated with 484 exactly one RtpTransceiver. 486 RtpTransceivers can be created explicitly by the application or 487 implicitly by calling setRemoteDescription with an offer that adds 488 new m= sections. 490 3.4.2. RtpSenders 492 RtpSenders allow the application to control how RTP media is sent. 493 An RtpSender is conceptually responsible for the outgoing RTP 494 stream(s) described by an m= section. This includes encoding the 495 attached MediaStreamTrack, sending RTP media packets, and generating/ 496 processing RTCP for the outgoing RTP streams(s). 498 3.4.3. RtpReceivers 500 RtpReceivers allow the application to inspect how RTP media is 501 received. An RtpReceiver is conceptually responsible for the 502 incoming RTP stream(s) described by an m= section. This includes 503 processing received RTP media packets, decoding the incoming 504 stream(s) to produce a remote MediaStreamTrack, and generating/ 505 processing RTCP for the incoming RTP stream(s). 507 3.5. ICE 509 3.5.1. ICE Gathering Overview 511 JSEP gathers ICE candidates as needed by the application. Collection 512 of ICE candidates is referred to as a gathering phase, and this is 513 triggered either by the addition of a new or recycled m= section to 514 the local session description, or new ICE credentials in the 515 description, indicating an ICE restart. Use of new ICE credentials 516 can be triggered explicitly by the application, or implicitly by the 517 browser in response to changes in the ICE configuration. 519 When the ICE configuration changes in a way that requires a new 520 gathering phase, a 'needs-ice-restart' bit is set. When this bit is 521 set, calls to the createOffer API will generate new ICE credentials. 522 This bit is cleared by a call to the setLocalDescription API with new 523 ICE credentials from either an offer or an answer, i.e., from either 524 a local- or remote-initiated ICE restart. 526 When a new gathering phase starts, the ICE Agent will notify the 527 application that gathering is occurring through an event. Then, when 528 each new ICE candidate becomes available, the ICE Agent will supply 529 it to the application via an additional event; these candidates will 530 also automatically be added to the current and/or pending local 531 session description. Finally, when all candidates have been 532 gathered, an event will be dispatched to signal that the gathering 533 process is complete. 535 Note that gathering phases only gather the candidates needed by 536 new/recycled/restarting m= sections; other m= sections continue to 537 use their existing candidates. Also, when bundling is active, 538 candidates are only gathered (and exchanged) for the m= sections 539 referenced in BUNDLE-tags, as described in 540 [I-D.ietf-mmusic-sdp-bundle-negotiation]. 542 3.5.2. ICE Candidate Trickling 544 Candidate trickling is a technique through which a caller may 545 incrementally provide candidates to the callee after the initial 546 offer has been dispatched; the semantics of "Trickle ICE" are defined 547 in [I-D.ietf-ice-trickle]. This process allows the callee to begin 548 acting upon the call and setting up the ICE (and perhaps DTLS) 549 connections immediately, without having to wait for the caller to 550 gather all possible candidates. This results in faster media setup 551 in cases where gathering is not performed prior to initiating the 552 call. 554 JSEP supports optional candidate trickling by providing APIs, as 555 described above, that provide control and feedback on the ICE 556 candidate gathering process. Applications that support candidate 557 trickling can send the initial offer immediately and send individual 558 candidates when they get the notified of a new candidate; 559 applications that do not support this feature can simply wait for the 560 indication that gathering is complete, and then create and send their 561 offer, with all the candidates, at this time. 563 Upon receipt of trickled candidates, the receiving application will 564 supply them to its ICE Agent. This triggers the ICE Agent to start 565 using the new remote candidates for connectivity checks. 567 3.5.2.1. ICE Candidate Format 569 In JSEP, ICE candidates are abstracted by an IceCandidate object, and 570 as with session descriptions, SDP syntax is used for the internal 571 representation. 573 The candidate details are specified in an IceCandidate field, using 574 the same SDP syntax as the "candidate-attribute" field defined in 575 [RFC5245], Section 15.1. For example: 577 candidate:1 1 UDP 1694498815 192.0.2.33 10000 typ host 579 The IceCandidate object contains a field to indicate which ICE ufrag 580 it is associated with, as defined in [RFC5245], Section 15.4. This 581 value is used to determine which session description (and thereby 582 which gathering phase) this IceCandidate belongs to, which helps 583 resolve ambiguities during ICE restarts. If this field is absent in 584 a received IceCandidate (perhaps when communicating with a non-JSEP 585 endpoint), the most recently received session description is assumed. 587 The IceCandidate object also contains fields to indicate which m= 588 section it is associated with, which can be identified in one of two 589 ways, either by a m= section index, or a MID. The m= section index 590 is a zero-based index, with index N referring to the N+1th m= section 591 in the session description referenced by this IceCandidate. The MID 592 is a "media stream identification" value, as defined in [RFC5888], 593 Section 4, which provides a more robust way to identify the m= 594 section in the session description, using the MID of the associated 595 RtpTransceiver object (which may have been locally generated by the 596 answerer when interacting with a non-JSEP endpoint that does not 597 support the MID attribute, as discussed in Section 5.9 below). If 598 the MID field is present in a received IceCandidate, it MUST be used 599 for identification; otherwise, the m= section index is used instead. 601 When creating an IceCandidate object, JSEP implementations MUST 602 populate all of these fields. 604 3.5.3. ICE Candidate Policy 606 Typically, when gathering ICE candidates, the browser will gather all 607 possible forms of initial candidates - host, server reflexive, and 608 relay. However, in certain cases, applications may want to have more 609 specific control over the gathering process, due to privacy or 610 related concerns. For example, one may want to only use relay 611 candidates, to leak as little location information as possible 612 (keeping in mind that this choice comes with corresponding 613 operational costs). To accomplish this, JSEP allows the application 614 to restrict which ICE candidates are used in a session. Note that 615 this filtering is applied on top of any restrictions the browser 616 chooses to enforce regarding which IP addresses are permitted for the 617 application, as discussed in [I-D.ietf-rtcweb-ip-handling]. 619 There may also be cases where the application wants to change which 620 types of candidates are used while the session is active. A prime 621 example is where a callee may initially want to use only relay 622 candidates, to avoid leaking location information to an arbitrary 623 caller, but then change to use all candidates (for lower operational 624 cost) once the user has indicated they want to take the call. For 625 this scenario, the browser MUST allow the candidate policy to be 626 changed in mid-session, subject to the aforementioned interactions 627 with local policy. 629 To administer the ICE candidate policy, the browser will determine 630 the current setting at the start of each gathering phase. Then, 631 during the gathering phase, the browser MUST NOT expose candidates 632 disallowed by the current policy to the application, use them as the 633 source of connectivity checks, or indirectly expose them via other 634 fields, such as the raddr/rport attributes for other ICE candidates. 635 Later, if a different policy is specified by the application, the 636 application can apply it by kicking off a new gathering phase via an 637 ICE restart. 639 3.5.4. ICE Candidate Pool 641 JSEP applications typically inform the browser to begin ICE gathering 642 via the information supplied to setLocalDescription, as this is where 643 the app specifies the number of media streams, and thereby ICE 644 components, for which to gather candidates. However, to accelerate 645 cases where the application knows the number of ICE components to use 646 ahead of time, it may ask the browser to gather a pool of potential 647 ICE candidates to help ensure rapid media setup. 649 When setLocalDescription is eventually called, and the browser goes 650 to gather the needed ICE candidates, it SHOULD start by checking if 651 any candidates are available in the pool. If there are candidates in 652 the pool, they SHOULD be handed to the application immediately via 653 the ICE candidate event. If the pool becomes depleted, either 654 because a larger-than-expected number of ICE components is used, or 655 because the pool has not had enough time to gather candidates, the 656 remaining candidates are gathered as usual. This only occurs for the 657 first offer/answer exchange, after which the candidate pool is 658 emptied and no longer used. 660 One example of where this concept is useful is an application that 661 expects an incoming call at some point in the future, and wants to 662 minimize the time it takes to establish connectivity, to avoid 663 clipping of initial media. By pre-gathering candidates into the 664 pool, it can exchange and start sending connectivity checks from 665 these candidates almost immediately upon receipt of a call. Note 666 though that by holding on to these pre-gathered candidates, which 667 will be kept alive as long as they may be needed, the application 668 will consume resources on the STUN/TURN servers it is using. 670 3.6. Video Size Negotiation 672 Video size negotiation is the process through which a receiver can 673 use the "a=imageattr" SDP attribute [RFC6236] to indicate what video 674 frame sizes it is capable of receiving. A receiver may have hard 675 limits on what its video decoder can process, or it may wish to 676 constrain what it receives due to application preferences, e.g. a 677 specific size for the window in which the video will be displayed. 679 Note that certain codecs support transmission of samples with aspect 680 ratios other than 1.0 (i.e., non-square pixels). JSEP 681 implementations will not transmit non-square pixels, but SHOULD 682 receive and render such video with the correct aspect ratio. 683 However, sample aspect ratio has no impact on the size negotiation 684 described below; all dimensions are measured in pixels, whether 685 square or not. 687 3.6.1. Creating an imageattr Attribute 689 In order to determine the limits on what video resolution a receiver 690 wants to receive, it will intersect its decoder hard limits with any 691 mandatory constraints that have been applied to the associated 692 MediaStreamTrack. If the decoder limits are unknown, e.g. when using 693 a software decoder, the mandatory constraints are used directly. For 694 the answerer, these mandatory constraints can be applied to the 695 remote MediaStreamTracks that are created by a setRemoteDescription 696 call, and will affect the output of the ensuing createAnswer call. 697 Any constraints set after setLocalDescription is used to set the 698 answer will result in a new offer-answer exchange. For the offerer, 699 because it does not know about any remote MediaStreamTracks until it 700 receives the answer, the offer can only reflect decoder hard limits. 701 If the offerer wishes to set mandatory constraints on video 702 resolution, it must do so after receiving the answer, and the result 703 will be a new offer-answer to communicate them. 705 If there are no known decoder limits or mandatory constraints, the 706 "a=imageattr" attribute SHOULD be omitted. 708 Otherwise, an "a=imageattr" attribute is created with "recv" 709 direction, and the resulting resolution space formed by intersecting 710 the decoder limits and constraints is used to specify its minimum and 711 maximum x= and y= values. If the intersection is the null set, i.e., 712 there are no resolutions that are permitted by both the decoder and 713 the mandatory constraints, this MUST be represented by x=0 and y=0 714 values. 716 The rules here express a single set of preferences, and therefore, 717 the "a=imageattr" q= value is not important. It SHOULD be set to 718 1.0. 720 The "a=imageattr" field is payload type specific. When all video 721 codecs supported have the same capabilities, use of a single 722 attribute, with the wildcard payload type (*), is RECOMMENDED. 723 However, when the supported video codecs have differing capabilities, 724 specific "a=imageattr" attributes MUST be inserted for each payload 725 type. 727 As an example, consider a system with a multiformat video decoder, 728 which is capable of decoding any resolution from 48x48 to 720p, and 729 where the application has constrained the received track to at most 730 360p. In this case, the implementation would generate this 731 attribute: 733 a=imageattr:* recv [x=[48:640],y=[48:360],q=1.0] 735 This declaration indicates that the receiver is capable of decoding 736 any image resolution from 48x48 up to 640x360 pixels. 738 3.6.2. Interpreting an imageattr Attribute 740 [RFC6236] defines "a=imageattr" to be an advisory field. This means 741 that it does not absolutely constrain the video formats that the 742 sender can use, but gives an indication of the preferred values. 744 This specification prescribes more specific behavior. When a sender 745 of a given MediaStreamTrack, which is producing video of a certain 746 resolution, receives an "a=imageattr recv" attribute, it MUST check 747 to see if the original resolution meets the size criteria specified 748 in the attribute, and adapt the resolution accordingly by scaling (if 749 appropriate). Note that when considering a MediaStreamTrack that is 750 producing rotated video, the unrotated resolution MUST be used. This 751 is required regardless of whether the receiver supports performing 752 receive-side rotation (e.g., through CVO), as it significantly 753 simplifies the matching logic. 755 For the purposes of resolution negotiation, only size limits are 756 considered. Any other values, e.g. picture or sample aspect ratio, 757 MUST be ignored. 759 When communicating with a non-JSEP endpoint, multiple relevant 760 "a=imageattr recv" attributes may be present in a received m= 761 section. If this occurs, attributes other than the one with the 762 highest "q=" value MUST be ignored. If multiple attributes have the 763 same "q=" value, those that appear after the first such attribute in 764 the m= section MUST be ignored. 766 If an "a=imageattr recv" attribute references a different video 767 payload type than what has been selected for sending the 768 MediaStreamTrack, it MUST be ignored. 770 If the original resolution matches the size limits in the attribute, 771 the track MUST be transmitted untouched. 773 If the original resolution exceeds the size limits in the attribute, 774 the sender SHOULD apply downscaling to the output of the 775 MediaStreamTrack in order to satisfy the limits. Downscaling MUST 776 NOT change the track aspect ratio. 778 If the original resolution is less than the size limits in the 779 attribute, upscaling is needed, but this may not be appropriate in 780 all cases. To address this concern, the application can set an 781 upscaling policy for each sent track. For this case, if upscaling is 782 permitted by policy, the sender SHOULD apply upscaling in order to 783 provide the desired resolution. Otherwise, the sender MUST NOT apply 784 upscaling. The sender SHOULD NOT upscale in other cases, even if the 785 policy permits it. Upscaling MUST NOT change the track aspect ratio. 787 If there is no appropriate and permitted scaling mechanism that 788 allows the received size limits to be satisfied, the sender MUST NOT 789 transmit the track. 791 If the attribute includes a "sar=" (sample aspect ratio) value set to 792 something other than "1.0", indicating the receiver wants to receive 793 non-square pixels, this cannot be satisfied and the sender MUST NOT 794 transmit the track. 796 In the special case of receiving a maximum resolution of [0, 0], as 797 described above, the sender MUST NOT transmit the track. 799 3.7. Simulcast 801 JSEP supports simulcast transmission of a MediaStreamTrack, where 802 multiple encodings of the source media can be transmitted within the 803 context of a single m= section. The current JSEP API is designed to 804 allow applications to send simulcasted media but only to receive a 805 single encoding. This allows for multi-user scenarios where each 806 sending client sends multiple encodings to a server, which then, for 807 each receiving client, chooses the appropriate encoding to forward. 809 Applications request support for simulcast by configuring multiple 810 encodings on an RtpSender, which, upon generation of an offer or 811 answer, are indicated in SDP markings on the corresponding m= 812 section, as described below. Receivers that understand simulcast and 813 are willing to receive it will also include SDP markings to indicate 814 their support, and JSEP endpoints will use these markings to 815 determine whether simulcast is permitted for a given RtpSender. If 816 simulcast support is not negotiated, the RtpSender will only use the 817 first configured encoding. 819 Note that the exact simulcast parameters are up to the sending 820 application. While the aforementioned SDP markings are provided to 821 ensure the remote side can receive and demux multiple simulcast 822 encodings, the specific resolutions and bitrates to be used for each 823 encoding are purely a send-side decision in JSEP. 825 JSEP currently does not provide a mechanism to configure receipt of 826 simulcast. This means that if simulcast is offered by the remote 827 endpoint, the answer generated by a JSEP endpoint will not indicate 828 support for receipt of simulcast, and as such the remote endpoint 829 will only send a single encoding per m= section. 831 In addition, JSEP does not provide a mechanism to handle an incoming 832 offer requesting simulcast from the JSEP endpoint. This means that 833 established simulcast streams will continue to work through a 834 received re-offer, but setting up initial simulcast by way of a 835 received offer requires out-of-band signaling or SDP inspection. 836 Future versions of this specification may add additional APIs to 837 provide direct control. 839 When using JSEP to transmit multiple encodings from a RtpSender, the 840 techniques from [I-D.ietf-mmusic-sdp-simulcast] and 841 [I-D.ietf-mmusic-rid] are used. Specifically, when multiple 842 encodings have been configured for a RtpSender, the m= section for 843 the RtpSender will include an "a=simulcast" attribute, as defined in 844 [I-D.ietf-mmusic-sdp-simulcast], Section 6.2, with a "send" simulcast 845 stream description that lists each desired encoding, and no "recv" 846 simulcast stream description. The m= section will also include an 847 "a=rid" attribute for each encoding, as specified in 848 [I-D.ietf-mmusic-rid], Section 4; the use of RID identifiers allows 849 the individual encodings to be disambiguated even though they are all 850 part of the same m= section. 852 3.8. Interactions With Forking 854 Some call signaling systems allow various types of forking where an 855 SDP Offer may be provided to more than one device. For example, SIP 856 [RFC3261] defines both a "Parallel Search" and "Sequential Search". 857 Although these are primarily signaling level issues that are outside 858 the scope of JSEP, they do have some impact on the configuration of 859 the media plane that is relevant. When forking happens at the 860 signaling layer, the Javascript application responsible for the 861 signaling needs to make the decisions about what media should be sent 862 or received at any point of time, as well as which remote endpoint it 863 should communicate with; JSEP is used to make sure the media engine 864 can make the RTP and media perform as required by the application. 865 The basic operations that the applications can have the media engine 866 do are: 868 o Start exchanging media with a given remote peer, but keep all the 869 resources reserved in the offer. 871 o Start exchanging media with a given remote peer, and free any 872 resources in the offer that are not being used. 874 3.8.1. Sequential Forking 876 Sequential forking involves a call being dispatched to multiple 877 remote callees, where each callee can accept the call, but only one 878 active session ever exists at a time; no mixing of received media is 879 performed. 881 JSEP handles sequential forking well, allowing the application to 882 easily control the policy for selecting the desired remote endpoint. 883 When an answer arrives from one of the callees, the application can 884 choose to apply it either as a provisional answer, leaving open the 885 possibility of using a different answer in the future, or apply it as 886 a final answer, ending the setup flow. 888 In a "first-one-wins" situation, the first answer will be applied as 889 a final answer, and the application will reject any subsequent 890 answers. In SIP parlance, this would be ACK + BYE. 892 In a "last-one-wins" situation, all answers would be applied as 893 provisional answers, and any previous call leg will be terminated. 894 At some point, the application will end the setup process, perhaps 895 with a timer; at this point, the application could reapply the 896 pending remote description as a final answer. 898 3.8.2. Parallel Forking 900 Parallel forking involves a call being dispatched to multiple remote 901 callees, where each callee can accept the call, and multiple 902 simultaneous active signaling sessions can be established as a 903 result. If multiple callees send media at the same time, the 904 possibilities for handling this are described in Section 3.1 of 905 [RFC3960]. Most SIP devices today only support exchanging media with 906 a single device at a time, and do not try to mix multiple early media 907 audio sources, as that could result in a confusing situation. For 908 example, consider having a European ringback tone mixed together with 909 the North American ringback tone - the resulting sound would not be 910 like either tone, and would confuse the user. If the signaling 911 application wishes to only exchange media with one of the remote 912 endpoints at a time, then from a media engine point of view, this is 913 exactly like the sequential forking case. 915 In the parallel forking case where the Javascript application wishes 916 to simultaneously exchange media with multiple peers, the flow is 917 slightly more complex, but the Javascript application can follow the 918 strategy that [RFC3960] describes using UPDATE. The UPDATE approach 919 allows the signaling to set up a separate media flow for each peer 920 that it wishes to exchange media with. In JSEP, this offer used in 921 the UPDATE would be formed by simply creating a new PeerConnection 922 and making sure that the same local media streams have been added 923 into this new PeerConnection. Then the new PeerConnection object 924 would produce a SDP offer that could be used by the signaling to 925 perform the UPDATE strategy discussed in [RFC3960]. 927 As a result of sharing the media streams, the application will end up 928 with N parallel PeerConnection sessions, each with a local and remote 929 description and their own local and remote addresses. The media flow 930 from these sessions can be managed using setDirection (see 931 Section 4.2.3), or the application can choose to play out the media 932 from all sessions mixed together. Of course, if the application 933 wants to only keep a single session, it can simply terminate the 934 sessions that it no longer needs. 936 4. Interface 938 This section details the basic operations that must be present to 939 implement JSEP functionality. The actual API exposed in the W3C API 940 may have somewhat different syntax, but should map easily to these 941 concepts. 943 4.1. PeerConnection 945 4.1.1. Constructor 947 The PeerConnection constructor allows the application to specify 948 global parameters for the media session, such as the STUN/TURN 949 servers and credentials to use when gathering candidates, as well as 950 the initial ICE candidate policy and pool size, and also the bundle 951 policy to use. 953 If an ICE candidate policy is specified, it functions as described in 954 Section 3.5.3, causing the browser to only surface the permitted 955 candidates (including any internal browser filtering) to the 956 application, and only use those candidates for connectivity checks. 957 The set of available policies is as follows: 959 all: All candidates permitted by browser policy will be gathered and 960 used. 962 relay: All candidates except relay candidates will be filtered out. 963 This obfuscates the location information that might be ascertained 964 by the remote peer from the received candidates. Depending on how 965 the application deploys and chooses relay servers, this could 966 obfuscate location to a metro or possibly even global level. 968 The default ICE candidate policy MUST be set to "all" as this is 969 generally the desired policy, and also typically reduces use of 970 application TURN server resources significantly. 972 If a size is specified for the ICE candidate pool, this indicates the 973 number of ICE components to pre-gather candidates for. Because pre- 974 gathering results in utilizing STUN/TURN server resources for 975 potentially long periods of time, this must only occur upon 976 application request, and therefore the default candidate pool size 977 MUST be zero. 979 The application can specify its preferred policy regarding use of 980 bundle, the multiplexing mechanism defined in 981 [I-D.ietf-mmusic-sdp-bundle-negotiation]. Regardless of policy, the 982 application will always try to negotiate bundle onto a single 983 transport, and will offer a single bundle group across all media 984 section; use of this single transport is contingent upon the answerer 985 accepting bundle. However, by specifying a policy from the list 986 below, the application can control exactly how aggressively it will 987 try to bundle media streams together, which affects how it will 988 interoperate with a non-bundle-aware endpoint. When negotiating with 989 a non-bundle-aware endpoint, only the streams not marked as bundle- 990 only streams will be established. 992 The set of available policies is as follows: 994 balanced: The first media section of each type (audio, video, or 995 application) will contain transport parameters, which will allow 996 an answerer to unbundle that section. The second and any 997 subsequent media section of each type will be marked bundle-only. 998 The result is that if there are N distinct media types, then 999 candidates will be gathered for for N media streams. This policy 1000 balances desire to multiplex with the need to ensure basic audio 1001 and video can still be negotiated in legacy cases. When acting as 1002 answerer, if there is no bundle group in the offer, the 1003 implementation will reject all but the first m= section of each 1004 type. 1006 max-compat: All media sections will contain transport parameters; 1007 none will be marked as bundle-only. This policy will allow all 1008 streams to be received by non-bundle-aware endpoints, but require 1009 separate candidates to be gathered for each media stream. 1011 max-bundle: Only the first media section will contain transport 1012 parameters; all streams other than the first will be marked as 1013 bundle-only. This policy aims to minimize candidate gathering and 1014 maximize multiplexing, at the cost of less compatibility with 1015 legacy endpoints. When acting as answerer, the implementation 1016 will reject any m= sections other than the first m= section, 1017 unless they are in the same bundle group as that m= section. 1019 As it provides the best tradeoff between performance and 1020 compatibility with legacy endpoints, the default bundle policy MUST 1021 be set to "balanced". 1023 The application can specify its preferred policy regarding use of 1024 RTP/RTCP multiplexing [RFC5761] using one of the following policies: 1026 negotiate: The browser will gather both RTP and RTCP candidates but 1027 also will offer "a=rtcp-mux", thus allowing for compatibility with 1028 either multiplexing or non-multiplexing endpoints. 1030 require: The browser will only gather RTP candidates. This halves 1031 the number of candidates that the offerer needs to gather. 1032 Applying a description with an m= section that does not contain an 1033 "a=rtcp-mux" attribute will cause an error to be returned. 1035 The default multiplexing policy MUST be set to "require". 1036 Implementations MAY choose to reject attempts by the application to 1037 set the multiplexing policy to "negotiate". 1039 4.1.2. addTrack 1041 The addTrack method adds a MediaStreamTrack to the PeerConnection, 1042 using the MediaStream argument to associate the track with other 1043 tracks in the same MediaStream, so that they can be added to the same 1044 "LS" group when creating an offer or answer. addTrack attempts to 1045 minimize the number of transceivers as follows: If the PeerConnection 1046 is in the "have-remote-offer" state, the track will be attached to 1047 the first compatible transceiver that was created by the most recent 1048 call to setRemoteDescription() and does not have a local track. 1049 Otherwise, a new transceiver will be created, as described in 1050 Section 4.1.4. 1052 4.1.3. removeTrack 1054 The removeTrack method removes a MediaStreamTrack from the 1055 PeerConnection, using the RtpSender argument to indicate which sender 1056 should have its track removed. The sender's track is cleared, and 1057 the sender stops sending. Future calls to createOffer will mark the 1058 media description associated with the sender as recvonly (if 1059 transceiver.currentDirection is sendrecv) or as inactive (if 1060 transceiver.currentDirection is sendonly). 1062 4.1.4. addTransceiver 1064 The addTransceiver method adds a new RtpTransceiver to the 1065 PeerConnection. If a MediaStreamTrack argument is provided, then the 1066 transceiver will be configured with that media type and the track 1067 will be attached to the transceiver. Otherwise, the application MUST 1068 explicitly specify the type; this mode is useful for creating 1069 recvonly transceivers as well as for creating transceivers to which a 1070 track can be attached at some later point. 1072 At the time of creation, the application can also specify a 1073 transceiver direction attribute, a set of MediaStreams which the 1074 transceiver is associated with (allowing LS group assignments), and a 1075 set of encodings for the media (used for simulcast as described in 1076 Section 3.7). 1078 4.1.5. createDataChannel 1080 The createDataChannel method creates a new data channel and attaches 1081 it to the PeerConnection. If no data channel currently exists for 1082 this PeerConnection, then a new offer/answer exchange is required. 1083 All data channels on a given PeerConnection share the same SCTP/DTLS 1084 association and therefore the same m= section, so subsequent creation 1085 of data channels does not have any impact on the JSEP state. 1087 The createDataChannel method also includes a number of arguments 1088 which are used by the PeerConnection (e.g., maxPacketLifetime) but 1089 are not reflected in the SDP and do not affect the JSEP state. 1091 4.1.6. createOffer 1093 The createOffer method generates a blob of SDP that contains a 1094 [RFC3264] offer with the supported configurations for the session, 1095 including descriptions of the media added to this PeerConnection, the 1096 codec/RTP/RTCP options supported by this implementation, and any 1097 candidates that have been gathered by the ICE Agent. An options 1098 parameter may be supplied to provide additional control over the 1099 generated offer. This options parameter allows an application to 1100 trigger an ICE restart, for the purpose of reestablishing 1101 connectivity. 1103 In the initial offer, the generated SDP will contain all desired 1104 functionality for the session (functionality that is supported but 1105 not desired by default may be omitted); for each SDP line, the 1106 generation of the SDP will follow the process defined for generating 1107 an initial offer from the document that specifies the given SDP line. 1108 The exact handling of initial offer generation is detailed in 1109 Section 5.2.1 below. 1111 In the event createOffer is called after the session is established, 1112 createOffer will generate an offer to modify the current session 1113 based on any changes that have been made to the session, e.g., adding 1114 or stopping RtpTransceivers, or requesting an ICE restart. For each 1115 existing stream, the generation of each SDP line must follow the 1116 process defined for generating an updated offer from the RFC that 1117 specifies the given SDP line. For each new stream, the generation of 1118 the SDP must follow the process of generating an initial offer, as 1119 mentioned above. If no changes have been made, or for SDP lines that 1120 are unaffected by the requested changes, the offer will only contain 1121 the parameters negotiated by the last offer-answer exchange. The 1122 exact handling of subsequent offer generation is detailed in 1123 Section 5.2.2. below. 1125 Session descriptions generated by createOffer must be immediately 1126 usable by setLocalDescription; if a system has limited resources 1127 (e.g. a finite number of decoders), createOffer should return an 1128 offer that reflects the current state of the system, so that 1129 setLocalDescription will succeed when it attempts to acquire those 1130 resources. 1132 Calling this method may do things such as generate new ICE 1133 credentials, but does not result in candidate gathering, or cause 1134 media to start or stop flowing. 1136 4.1.7. createAnswer 1138 The createAnswer method generates a blob of SDP that contains a 1139 [RFC3264] SDP answer with the supported configuration for the session 1140 that is compatible with the parameters supplied in the most recent 1141 call to setRemoteDescription, which MUST have been called prior to 1142 calling createAnswer. Like createOffer, the returned blob contains 1143 descriptions of the media added to this PeerConnection, the 1144 codec/RTP/RTCP options negotiated for this session, and any 1145 candidates that have been gathered by the ICE Agent. An options 1146 parameter may be supplied to provide additional control over the 1147 generated answer. 1149 As an answer, the generated SDP will contain a specific configuration 1150 that specifies how the media plane should be established; for each 1151 SDP line, the generation of the SDP must follow the process defined 1152 for generating an answer from the document that specifies the given 1153 SDP line. The exact handling of answer generation is detailed in 1154 Section 5.3. below. 1156 Session descriptions generated by createAnswer must be immediately 1157 usable by setLocalDescription; like createOffer, the returned 1158 description should reflect the current state of the system. 1160 Calling this method may do things such as generate new ICE 1161 credentials, but does not trigger candidate gathering or change media 1162 state. 1164 4.1.8. SessionDescriptionType 1166 Session description objects (RTCSessionDescription) may be of type 1167 "offer", "pranswer", "answer" or "rollback". These types provide 1168 information as to how the description parameter should be parsed, and 1169 how the media state should be changed. 1171 "offer" indicates that a description should be parsed as an offer; 1172 said description may include many possible media configurations. A 1173 description used as an "offer" may be applied anytime the 1174 PeerConnection is in a stable state, or as an update to a previously 1175 supplied but unanswered "offer". 1177 "pranswer" indicates that a description should be parsed as an 1178 answer, but not a final answer, and so should not result in the 1179 freeing of allocated resources. It may result in the start of media 1180 transmission, if the answer does not specify an inactive media 1181 direction. A description used as a "pranswer" may be applied as a 1182 response to an "offer", or an update to a previously sent "pranswer". 1184 "answer" indicates that a description should be parsed as an answer, 1185 the offer-answer exchange should be considered complete, and any 1186 resources (decoders, candidates) that are no longer needed can be 1187 released. A description used as an "answer" may be applied as a 1188 response to an "offer", or an update to a previously sent "pranswer". 1190 The only difference between a provisional and final answer is that 1191 the final answer results in the freeing of any unused resources that 1192 were allocated as a result of the offer. As such, the application 1193 can use some discretion on whether an answer should be applied as 1194 provisional or final, and can change the type of the session 1195 description as needed. For example, in a serial forking scenario, an 1196 application may receive multiple "final" answers, one from each 1197 remote endpoint. The application could choose to accept the initial 1198 answers as provisional answers, and only apply an answer as final 1199 when it receives one that meets its criteria (e.g. a live user 1200 instead of voicemail). 1202 "rollback" is a special session description type implying that the 1203 state machine should be rolled back to the previous stable state, as 1204 described in Section 4.1.8.2. The contents MUST be empty. 1206 4.1.8.1. Use of Provisional Answers 1208 Most web applications will not need to create answers using the 1209 "pranswer" type. While it is good practice to send an immediate 1210 response to an "offer", in order to warm up the session transport and 1211 prevent media clipping, the preferred handling for a web application 1212 would be to create and send an "inactive" final answer immediately 1213 after receiving the offer. Later, when the called user actually 1214 accepts the call, the application can create a new "sendrecv" offer 1215 to update the previous offer/answer pair and start the media flow. 1216 While this could also be done with an inactive "pranswer", followed 1217 by a sendrecv "answer", the initial "pranswer" leaves the offer- 1218 answer exchange open, which means that neither side can send an 1219 updated offer during this time. 1221 As an example, consider a typical web application that will set up a 1222 data channel, an audio channel, and a video channel. When an 1223 endpoint receives an offer with these channels, it could send an 1224 answer accepting the data channel for two-way data, and accepting the 1225 audio and video tracks as inactive or receive-only. It could then 1226 ask the user to accept the call, acquire the local media streams, and 1227 send a new offer to the remote side moving the audio and video to be 1228 two-way media. By the time the human has accepted the call and 1229 triggered the new offer, it is likely that the ICE and DTLS 1230 handshaking for all the channels will already have finished. 1232 Of course, some applications may not be able to perform this double 1233 offer-answer exchange, particularly ones that are attempting to 1234 gateway to legacy signaling protocols. In these cases, "pranswer" 1235 can still provide the application with a mechanism to warm up the 1236 transport. 1238 4.1.8.2. Rollback 1240 In certain situations it may be desirable to "undo" a change made to 1241 setLocalDescription or setRemoteDescription. Consider a case where a 1242 call is ongoing, and one side wants to change some of the session 1243 parameters; that side generates an updated offer and then calls 1244 setLocalDescription. However, the remote side, either before or 1245 after setRemoteDescription, decides it does not want to accept the 1246 new parameters, and sends a reject message back to the offerer. Now, 1247 the offerer, and possibly the answerer as well, need to return to a 1248 stable state and the previous local/remote description. To support 1249 this, we introduce the concept of "rollback". 1251 A rollback discards any proposed changes to the session, returning 1252 the state machine to the stable state, and setting the pending local 1253 and/or remote description (see Section 4.1.12 and Section 4.1.14) to 1254 null. Any resources or candidates that were allocated by the 1255 abandoned local description are discarded; any media that is received 1256 will be processed according to the previous local and remote 1257 descriptions. Rollback can only be used to cancel proposed changes; 1258 there is no support for rolling back from a stable state to a 1259 previous stable state. Note that this implies that once the answerer 1260 has performed setLocalDescription with his answer, this cannot be 1261 rolled back. 1263 A rollback will disassociate any RtpTransceivers that were associated 1264 with m= sections by the application of the rolled-back session 1265 description (see Section 5.9 and Section 5.8). This means that some 1266 RtpTransceivers that were previously associated will no longer be 1267 associated with any m= section; in such cases, the value of the 1268 RtpTransceiver's mid property MUST be set to null, and the mapping 1269 between the transceiver and its m= section index MUST be discarded. 1270 RtpTransceivers that were created by applying a remote offer that was 1271 subsequently rolled back MUST be stopped and removed from the 1272 PeerConnection. However, a RtpTransceiver MUST NOT be removed if a 1273 track was attached to the RtpTransceiver via the addTrack method. 1274 This is so that an application may call addTrack, then call 1275 setRemoteDescription with an offer, then roll back that offer, then 1276 call createOffer and have a m= section for the added track appear in 1277 the generated offer. 1279 A rollback is performed by supplying a session description of type 1280 "rollback" with empty contents to either setLocalDescription or 1281 setRemoteDescription, depending on which was most recently used (i.e. 1282 if the new offer was supplied to setLocalDescription, the rollback 1283 should be done using setLocalDescription as well). 1285 4.1.9. setLocalDescription 1287 The setLocalDescription method instructs the PeerConnection to apply 1288 the supplied session description as its local configuration. The 1289 type field indicates whether the description should be processed as 1290 an offer, provisional answer, or final answer; offers and answers are 1291 checked differently, using the various rules that exist for each SDP 1292 line. 1294 This API changes the local media state; among other things, it sets 1295 up local resources for receiving and decoding media. In order to 1296 successfully handle scenarios where the application wants to offer to 1297 change from one media format to a different, incompatible format, the 1298 PeerConnection must be able to simultaneously support use of both the 1299 current and pending local descriptions (e.g., support the codecs that 1300 exist in either description). This dual processing begins when the 1301 PeerConnection enters the have-local-offer state, and continues until 1302 setRemoteDescription is called with either a final answer, at which 1303 point the PeerConnection can fully adopt the pending local 1304 description, or a rollback, which results in a revert to the current 1305 local description. 1307 This API indirectly controls the candidate gathering process. When a 1308 local description is supplied, and the number of transports currently 1309 in use does not match the number of transports needed by the local 1310 description, the PeerConnection will create transports as needed and 1311 begin gathering candidates for each transport, using ones from the 1312 candidate pool if available. 1314 If setRemoteDescription was previously called with an offer, and 1315 setLocalDescription is called with an answer (provisional or final), 1316 and the media directions are compatible, and media is available to 1317 send, this will result in the starting of media transmission. 1319 4.1.10. setRemoteDescription 1321 The setRemoteDescription method instructs the PeerConnection to apply 1322 the supplied session description as the desired remote configuration. 1323 As in setLocalDescription, the type field of the description 1324 indicates how it should be processed. 1326 This API changes the local media state; among other things, it sets 1327 up local resources for sending and encoding media. 1329 If setLocalDescription was previously called with an offer, and 1330 setRemoteDescription is called with an answer (provisional or final), 1331 and the media directions are compatible, and media is available to 1332 send, this will result in the starting of media transmission. 1334 4.1.11. currentLocalDescription 1336 The currentLocalDescription method returns the current negotiated 1337 local description - i.e., the local description from the last 1338 successful offer/answer exchange - in addition to any local 1339 candidates that have been generated by the ICE Agent since the local 1340 description was set. 1342 A null object will be returned if an offer/answer exchange has not 1343 yet been completed. 1345 4.1.12. pendingLocalDescription 1347 The pendingLocalDescription method returns a copy of the local 1348 description currently in negotiation - i.e., a local offer set 1349 without any corresponding remote answer - in addition to any local 1350 candidates that have been generated by the ICE Agent since the local 1351 description was set. 1353 A null object will be returned if the state of the PeerConnection is 1354 "stable" or "have-remote-offer". 1356 4.1.13. currentRemoteDescription 1358 The currentRemoteDescription method returns a copy of the current 1359 negotiated remote description - i.e., the remote description from the 1360 last successful offer/answer exchange - in addition to any remote 1361 candidates that have been supplied via processIceMessage since the 1362 remote description was set. 1364 A null object will be returned if an offer/answer exchange has not 1365 yet been completed. 1367 4.1.14. pendingRemoteDescription 1369 The pendingRemoteDescription method returns a copy of the remote 1370 description currently in negotiation - i.e., a remote offer set 1371 without any corresponding local answer - in addition to any remote 1372 candidates that have been supplied via processIceMessage since the 1373 remote description was set. 1375 A null object will be returned if the state of the PeerConnection is 1376 "stable" or "have-local-offer". 1378 4.1.15. canTrickleIceCandidates 1380 The canTrickleIceCandidates property indicates whether the remote 1381 side supports receiving trickled candidates. There are three 1382 potential values: 1384 null: No SDP has been received from the other side, so it is not 1385 known if it can handle trickle. This is the initial value before 1386 setRemoteDescription() is called. 1388 true: SDP has been received from the other side indicating that it 1389 can support trickle. 1391 false: SDP has been received from the other side indicating that it 1392 cannot support trickle. 1394 As described in Section 3.5.2, JSEP implementations always provide 1395 candidates to the application individually, consistent with what is 1396 needed for Trickle ICE. However, applications can use the 1397 canTrickleIceCandidates property to determine whether their peer can 1398 actually do Trickle ICE, i.e., whether it is safe to send an initial 1399 offer or answer followed later by candidates as they are gathered. 1400 As "true" is the only value that definitively indicates remote 1401 Trickle ICE support, an application which compares 1402 canTrickleIceCandidates against "true" will by default attempt Half 1403 Trickle on initial offers and Full Trickle on subsequent interactions 1404 with a Trickle ICE-compatible agent. 1406 4.1.16. setConfiguration 1408 The setConfiguration method allows the global configuration of the 1409 PeerConnection, which was initially set by constructor parameters, to 1410 be changed during the session. The effects of this method call 1411 depend on when it is invoked, and differ depending on which specific 1412 parameters are changed: 1414 o Any changes to the STUN/TURN servers to use affect the next 1415 gathering phase. If an ICE gathering phase has already started or 1416 completed, the 'needs-ice-restart' bit mentioned in Section 3.5.1 1417 will be set. This will cause the next call to createOffer to 1418 generate new ICE credentials, for the purpose of forcing an ICE 1419 restart and kicking off a new gathering phase, in which the new 1420 servers will be used. If the ICE candidate pool has a nonzero 1421 size, and a local description has not yet been applied, any 1422 existing candidates will be discarded, and new candidates will be 1423 gathered from the new servers. 1425 o Any change to the ICE candidate policy affects the next gathering 1426 phase. If an ICE gathering phase has already started or 1427 completed, the 'needs-ice-restart' bit will be set. Either way, 1428 changes to the policy have no effect on the candidate pool, 1429 because pooled candidates are not surfaced to the application 1430 until a gathering phase occurs, and so any necessary filtering can 1431 still be done on any pooled candidates. 1433 o The ICE candidate pool size MUST NOT be changed after applying a 1434 local description. If a local description has not yet been 1435 applied, any changes to the ICE candidate pool size take effect 1436 immediately; if increased, additional candidates are pre-gathered; 1437 if decreased, the now-superfluous candidates are discarded. 1439 o The bundle and RTCP-multiplexing policies MUST NOT be changed 1440 after the construction of the PeerConnection. 1442 This call may result in a change to the state of the ICE Agent. 1444 4.1.17. addIceCandidate 1446 The addIceCandidate method provides a remote candidate to the ICE 1447 Agent, which, if parsed successfully, will be added to the current 1448 and/or pending remote description according to the rules defined for 1449 Trickle ICE. The pair of MID and ufrag is used to determine the m= 1450 section and ICE candidate generation to which the candidate belongs. 1451 If the MID is not present, the m= section index is used to look up 1452 the locally generated MID (see Section 5.9), which is used in place 1453 of a supplied MID. If these values or the candidate string are 1454 invalid, an error is generated. 1456 The purpose of the ufrag is to resolve ambiguities when trickle ICE 1457 is in progress during an ICE restart. If the ufrag is absent, the 1458 candidate MUST be assumed to belong to the most recently applied 1459 remote description. Connectivity checks will be sent to the new 1460 candidate. 1462 This method can also be used to provide an end-of-candidates 1463 indication to the ICE Agent, as defined in [I-D.ietf-ice-trickle]). 1464 The MID and ufrag are used as described above to determine the m= 1465 section and ICE generation for which candidate gathering is complete. 1466 If the ufrag is not present, then the end-of-candidates indication 1467 MUST be assumed to apply to the relevant m= section in the most 1468 recently applied remote description. If neither the MID nor the m= 1469 index is present, then the indication MUST be assumed to apply to all 1470 m= sections in the most recently applied remote description. 1472 This call will result in a change to the state of the ICE Agent, and 1473 may result in a change to media state if it results in connectivity 1474 being established. 1476 4.2. RtpTransceiver 1478 4.2.1. stop 1480 The stop method stops an RtpTransceiver. This will cause future 1481 calls to createOffer to generate a zero port for the associated m= 1482 section. See below for more details. 1484 4.2.2. stopped 1486 The stopped property indicates whether the transceiver has been 1487 stopped, either by a call to stopTransceiver or by applying an answer 1488 that rejects the associated m= section. In either of these cases, it 1489 is set to "true", and otherwise will be set to "false". 1491 A stopped RtpTransceiver does not send any outgoing RTP or RTCP or 1492 process any incoming RTP or RTCP. It cannot be restarted. 1494 4.2.3. setDirection 1496 The setDirection method sets the direction of a transceiver, which 1497 affects the direction property of the associated m= section on future 1498 calls to createOffer and createAnswer. 1500 When creating offers, the transceiver direction is directly reflected 1501 in the output, even for reoffers. When creating answers, the 1502 transceiver direction is intersected with the offered direction, as 1503 explained in the Section 5.3 section below. 1505 Note that while setDirection sets the direction property of the 1506 transceiver immediately (Section 4.2.4), this property does not 1507 immediately affect whether the transceiver's RtpSender will send or 1508 its RtpReceiver will receive. The direction in effect is represented 1509 by the currentDirection property, which is only updated when an 1510 answer is applied. 1512 4.2.4. direction 1514 The direction property indicates the last value passed into 1515 setDirection. If setDirection has never been called, it is set to 1516 the direction the transceiver was initialized with. 1518 4.2.5. currentDirection 1520 The currentDirection property indicates the last negotiated direction 1521 for the transceiver's associated m= section. More specifically, it 1522 indicates the [RFC3264] directional attribute of the associated m= 1523 section in the last applied answer, with "send" and "recv" directions 1524 reversed if it was a remote answer. For example, if the directional 1525 attribute for the associated m= section in a remote answer is 1526 "recvonly", currentDirection is set to "sendonly". 1528 If an answer that references this transceiver has not yet been 1529 applied, or if the transceiver is stopped, currentDirection is set to 1530 null. 1532 4.2.6. setCodecPreferences 1534 The setCodecPreferences method sets the codec preferences of a 1535 transceiver, which in turn affect the presence and order of codecs of 1536 the associated m= section on future calls to createOffer and 1537 createAnswer. Note that setCodecPreferences does not directly affect 1538 which codec the implementation decides to send. It only affects 1539 which codecs the implementation indicates that it prefers to receive, 1540 via the offer or answer. Even when a codec is excluded by 1541 setCodecPreferences, it still may be used to send until the next 1542 offer/answer exchange discards it. 1544 The codec preferences of an RtpTransceiver can cause codecs to be 1545 excluded by subsequent calls to createOffer and createAnswer, in 1546 which case the corresponding media formats in the associated m= 1547 section will be excluded. The codec preferences cannot add media 1548 formats that would otherwise not be present. This includes codecs 1549 that were not negotiated in a previous offer/answer exchange that 1550 included the transceiver. 1552 The codec preferences of an RtpTransceiver can also determine the 1553 order of codecs in subsequent calls to createOffer and createAnswer, 1554 in which case the order of the media formats in the associated m= 1555 section will match. However, the codec preferences cannot change the 1556 order of the media formats after an answer containing the transceiver 1557 has been applied. At this point, codecs can only be removed, not 1558 reordered. 1560 5. SDP Interaction Procedures 1562 This section describes the specific procedures to be followed when 1563 creating and parsing SDP objects. 1565 5.1. Requirements Overview 1567 JSEP implementations must comply with the specifications listed below 1568 that govern the creation and processing of offers and answers. 1570 The first set of specifications is the "mandatory-to-implement" set. 1571 All implementations must support these behaviors, but may not use all 1572 of them if the remote side, which may not be a JSEP endpoint, does 1573 not support them. 1575 The second set of specifications is the "mandatory-to-use" set. The 1576 local JSEP endpoint and any remote endpoint must indicate support for 1577 these specifications in their session descriptions. 1579 5.1.1. Implementation Requirements 1581 Implementations of JSEP MUST conform to [I-D.ietf-rtcweb-rtp-usage]. 1582 This list of mandatory-to-implement specifications is derived from 1583 the requirements outlined in that document and from 1584 [I-D.ietf-rtcweb-security-arch]. 1586 R-1 [RFC4566] is the base SDP specification and MUST be 1587 implemented. 1589 R-2 [RFC5764] MUST be supported for signaling the UDP/TLS/RTP/SAVPF 1590 [RFC5764], TCP/DTLS/RTP/SAVPF [RFC7850], "UDP/DTLS/SCTP" 1591 [I-D.ietf-mmusic-sctp-sdp], and "TCP/DTLS/SCTP" 1592 [I-D.ietf-mmusic-sctp-sdp] RTP profiles. 1594 R-3 [RFC5245] MUST be implemented for signaling the ICE credentials 1595 and candidate lines corresponding to each media stream. The 1596 ICE implementation MUST be a Full implementation, not a Lite 1597 implementation. 1599 R-4 [RFC5763] MUST be implemented to signal DTLS certificate 1600 fingerprints. 1602 R-5 [RFC5888] MUST be implemented for signaling grouping 1603 information, and MUST be used to identify m= lines via the 1604 a=mid attribute. 1606 R-6 [I-D.ietf-mmusic-msid] MUST be supported, in order to signal 1607 associations between RTP objects and W3C MediaStreams and 1608 MediaStreamTracks in a standard way. 1610 R-7 The bundle mechanism in 1611 [I-D.ietf-mmusic-sdp-bundle-negotiation] MUST be supported to 1612 signal the ability to multiplex RTP streams on a single UDP 1613 port, in order to avoid excessive use of port number resources. 1615 R-8 The SDP attributes of "sendonly", "recvonly", "inactive", and 1616 "sendrecv" from [RFC4566] MUST be implemented to signal 1617 information about media direction. 1619 R-9 [RFC5576] MUST be implemented to signal RTP SSRC values and 1620 grouping semantics. 1622 R-10 [RFC4585] MUST be implemented to signal RTCP based feedback. 1624 R-11 [RFC5761] MUST be implemented to signal multiplexing of RTP and 1625 RTCP. 1627 R-12 [RFC5506] MUST be implemented to signal reduced-size RTCP 1628 messages. 1630 R-13 [RFC4588] MUST be implemented to signal RTX payload type 1631 associations. 1633 R-14 [RFC3556] MUST be supported for control of RTCP bandwidth 1634 limits. 1636 The SDES SRTP keying mechanism from [RFC4568] MUST NOT be 1637 implemented, as discussed in [I-D.ietf-rtcweb-security-arch]. 1639 As required by [RFC4566], Section 5.13, JSEP implementations MUST 1640 ignore unknown attribute (a=) lines. 1642 5.1.2. Usage Requirements 1644 All session descriptions handled by JSEP endpoints, both local and 1645 remote, MUST indicate support for the following specifications. If 1646 any of these are absent, this omission MUST be treated as an error. 1648 U-1 ICE, as specified in [RFC5245], MUST be used. Note that the 1649 remote endpoint may use a Lite implementation; implementations 1650 MUST properly handle remote endpoints which do ICE-Lite. 1652 U-2 DTLS [RFC6347] or DTLS-SRTP [RFC5763], MUST be used, as 1653 appropriate for the media type, as specified in 1654 [I-D.ietf-rtcweb-security-arch] 1656 5.1.3. Profile Names and Interoperability 1658 For media m= sections, JSEP endpoints MUST support both the "UDP/TLS/ 1659 RTP/SAVPF" and "TCP/DTLS/RTP/SAVPF" profiles and MUST indicate one of 1660 these two profiles for each media m= line they produce in an offer. 1661 For data m= sections, JSEP endpoints must support both the "UDP/DTLS/ 1662 SCTP" and "TCP/DTLS/SCTP" profiles and MUST indicate one of these two 1663 profiles for each data m= line they produce in an offer. Because ICE 1664 can select either TCP or UDP transport depending on network 1665 conditions, both advertisements are consistent with ICE eventually 1666 selecting either either UDP or TCP. 1668 Unfortunately, in an attempt at compatibility, some endpoints 1669 generate other profile strings even when they mean to support one of 1670 these profiles. For instance, an endpoint might generate "RTP/AVP" 1671 but supply "a=fingerprint" and "a=rtcp-fb" attributes, indicating its 1672 willingness to support "(UDP,TCP)/TLS/RTP/SAVPF". In order to 1673 simplify compatibility with such endpoints, JSEP endpoints MUST 1674 follow the following rules when processing the media m= sections in 1675 an offer: 1677 o The profile in any "m=" line in any answer MUST exactly match the 1678 profile provided in the offer. 1680 o Any profile matching the following patterns MUST be accepted: 1681 "RTP/[S]AVP[F]" and "(UDP/TCP)/TLS/RTP/SAVP[F]" 1683 o Because DTLS-SRTP is REQUIRED, the choice of SAVP or AVP has no 1684 effect; support for DTLS-SRTP is determined by the presence of one 1685 or more "a=fingerprint" attribute. Note that lack of an 1686 "a=fingerprint" attribute will lead to negotiation failure. 1688 o The use of AVPF or AVP simply controls the timing rules used for 1689 RTCP feedback. If AVPF is provided, or an "a=rtcp-fb" attribute 1690 is present, assume AVPF timing, i.e., a default value of "trr- 1691 int=0". Otherwise, assume that AVPF is being used in an AVP 1692 compatible mode and use a value of "trr-int=4000". 1694 o For data m= sections, JSEP endpoints MUST support receiving the 1695 "UDP/DTLS/SCTP", "TCP/DTLS/SCTP", or "DTLS/SCTP" (for backwards 1696 compatibility) profiles. 1698 Note that re-offers by JSEP endpoints MUST use the correct profile 1699 strings even if the initial offer/answer exchange used an (incorrect) 1700 older profile string. 1702 5.2. Constructing an Offer 1704 When createOffer is called, a new SDP description must be created 1705 that includes the functionality specified in 1706 [I-D.ietf-rtcweb-rtp-usage]. The exact details of this process are 1707 explained below. 1709 5.2.1. Initial Offers 1711 When createOffer is called for the first time, the result is known as 1712 the initial offer. 1714 The first step in generating an initial offer is to generate session- 1715 level attributes, as specified in [RFC4566], Section 5. 1716 Specifically: 1718 o The first SDP line MUST be "v=0", as specified in [RFC4566], 1719 Section 5.1 1721 o The second SDP line MUST be an "o=" line, as specified in 1722 [RFC4566], Section 5.2. The value of the field SHOULD 1723 be "-". [RFC3264] requires that the be representable as 1724 a 64-bit signed integer. It is RECOMMENDED that the be 1725 generated as a 64-bit quantity with the high bit being sent to 1726 zero and the remaining 63 bits being cryptographically random. 1727 The value of the tuple 1728 SHOULD be set to a non-meaningful address, such as IN IP4 0.0.0.0, 1729 to prevent leaking the local address in this field. As mentioned 1730 in [RFC4566], the entire o= line needs to be unique, but selecting 1731 a random number for is sufficient to accomplish this. 1733 o The third SDP line MUST be a "s=" line, as specified in [RFC4566], 1734 Section 5.3; to match the "o=" line, a single dash SHOULD be used 1735 as the session name, e.g. "s=-". Note that this differs from the 1736 advice in [RFC4566] which proposes a single space, but as both 1737 "o=" and "s=" are meaningless, having the same meaningless value 1738 seems clearer. 1740 o Session Information ("i="), URI ("u="), Email Address ("e="), 1741 Phone Number ("p="), Repeat Times ("r="), and Time Zones ("z=") 1742 lines are not useful in this context and SHOULD NOT be included. 1744 o Encryption Keys ("k=") lines do not provide sufficient security 1745 and MUST NOT be included. 1747 o A "t=" line MUST be added, as specified in [RFC4566], Section 5.9; 1748 both and SHOULD be set to zero, e.g. "t=0 1749 0". 1751 o An "a=ice-options" line with the "trickle" option MUST be added, 1752 as specified in [I-D.ietf-ice-trickle], Section 4. 1754 The next step is to generate m= sections, as specified in [RFC4566] 1755 Section 5.14. An m= section is generated for each RtpTransceiver 1756 that has been added to the PeerConnection, excluding any stopped 1757 RtpTransceivers. This is done in the order the RtpTransceivers were 1758 added to the PeerConnection. 1760 For each m= section generated for an RtpTransceiver, establish a 1761 mapping between the transceiver and the index of the generated m= 1762 section. 1764 Each m= section, provided it is not marked as bundle-only, MUST 1765 generate a unique set of ICE credentials and gather its own unique 1766 set of ICE candidates. Bundle-only m= sections MUST NOT contain any 1767 ICE credentials and MUST NOT gather any candidates. 1769 For DTLS, all m= sections MUST use all the certificate(s) that have 1770 been specified for the PeerConnection; as a result, they MUST all 1771 have the same [I-D.ietf-mmusic-4572-update] fingerprint value(s), or 1772 these value(s) MUST be session-level attributes. 1774 Each m= section should be generated as specified in [RFC4566], 1775 Section 5.14. For the m= line itself, the following rules MUST be 1776 followed: 1778 o The port value is set to the port of the default ICE candidate for 1779 this m= section, but given that no candidates are available yet, 1780 the "dummy" port value of 9 (Discard) MUST be used, as indicated 1781 in [I-D.ietf-ice-trickle], Section 5.1. 1783 o To properly indicate use of DTLS, the field MUST be set to 1784 "UDP/TLS/RTP/SAVPF", as specified in [RFC5764], Section 8. 1786 o If codec preferences have been set for the associated transceiver, 1787 media formats MUST be generated in the corresponding order, and 1788 MUST exclude any codecs not present in the codec preferences. 1790 o The media formats in the answer MAY include codecs present in the 1791 offer that were discarded in a previous offer/answer exchange. 1792 This is necessary for compatibility with third- party call control 1793 and SIP use cases. 1795 o Unless excluded by the above restrictions, the media formats MUST 1796 include the mandatory audio/video codecs as specified in 1797 [I-D.ietf-rtcweb-audio](see Section 3) and 1798 [I-D.ietf-rtcweb-video](see Section 5). 1800 The m= line MUST be followed immediately by a "c=" line, as specified 1801 in [RFC4566], Section 5.7. Again, as no candidates are available 1802 yet, the "c=" line must contain the "dummy" value "IN IP4 0.0.0.0", 1803 as defined in [I-D.ietf-ice-trickle], Section 5.1. 1805 [I-D.ietf-mmusic-sdp-mux-attributes] groups SDP attributes into 1806 different categories. To avoid unnecessary duplication when 1807 bundling, Section 8.1 of [I-D.ietf-mmusic-sdp-bundle-negotiation] 1808 specifies that attributes of category IDENTICAL or TRANSPORT should 1809 not be repeated in bundled m= sections. 1811 The following attributes, which are of a category other than 1812 IDENTICAL or TRANSPORT, MUST be included in each m= section: 1814 o An "a=mid" line, as specified in [RFC5888], Section 4. All MID 1815 values MUST be generated in a fashion that does not leak user 1816 information, e.g., randomly or using a per-PeerConnection counter, 1817 and SHOULD be 3 bytes or less, to allow them to efficiently fit 1818 into the RTP header extension defined in 1819 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 14. Note that 1820 this does not set the RtpTransceiver mid property, as that only 1821 occurs when the description is applied. The generated MID value 1822 can be considered a "proposed" MID at this point. 1824 o A direction attribute which is the same as that of the associated 1825 transceiver. 1827 o For each media format on the m= line, "a=rtpmap" and "a=fmtp" 1828 lines, as specified in [RFC4566], Section 6, and [RFC3264], 1829 Section 5.1. 1831 o If this m= section is for media with configurable durations of 1832 media per packet, e.g., audio, an "a=maxptime" line, indicating 1833 the maximum amount of media, specified in milliseconds, that can 1834 be encapsulated in each packet, as specified in [RFC4566], 1835 Section 6. This value is set to the smallest of the maximum 1836 duration values across all the codecs included in the m= section. 1838 o If this m= section is for video media, and there are known 1839 limitations on the size of images which can be decoded, an 1840 "a=imageattr" line, as specified in Section 3.6. 1842 o For each primary codec where RTP retransmission should be used, a 1843 corresponding "a=rtpmap" line indicating "rtx" with the clock rate 1844 of the primary codec and an "a=fmtp" line that references the 1845 payload type of the primary codec, as specified in [RFC4588], 1846 Section 8.1. 1848 o For each supported FEC mechanism, "a=rtpmap" and "a=fmtp" lines, 1849 as specified in [RFC4566], Section 6. The FEC mechanisms that 1850 MUST be supported are specified in [I-D.ietf-rtcweb-fec], 1851 Section 6, and specific usage for each media type is outlined in 1852 Sections 4 and 5. 1854 o For each supported RTP header extension, an "a=extmap" line, as 1855 specified in [RFC5285], Section 5. The list of header extensions 1856 that SHOULD/MUST be supported is specified in 1857 [I-D.ietf-rtcweb-rtp-usage], Section 5.2. Any header extensions 1858 that require encryption MUST be specified as indicated in 1859 [RFC6904], Section 4. 1861 o For each supported RTCP feedback mechanism, an "a=rtcp-fb" 1862 mechanism, as specified in [RFC4585], Section 4.2. The list of 1863 RTCP feedback mechanisms that SHOULD/MUST be supported is 1864 specified in [I-D.ietf-rtcweb-rtp-usage], Section 5.1. 1866 o If the bundle policy for this PeerConnection is set to "max- 1867 bundle", and this is not the first m= section, or the bundle 1868 policy is set to "balanced", and this is not the first m= section 1869 for this media type, an "a=bundle-only" line. 1871 o If the RtpTransceiver has a sendrecv or sendonly direction: 1873 * An "a=msid" line, as specified in [I-D.ietf-mmusic-msid], 1874 Section 2. 1876 o If the RtpTransceiver has a sendrecv or sendonly direction, and 1877 the application has specified RID values or has specified more 1878 than one encoding in the RtpSenders's parameters, an "a=rid" line 1879 for each encoding specified. The "a=rid" line is specified in 1880 [I-D.ietf-mmusic-rid], and its direction MUST be "send". If the 1881 application has chosen a RID value, it MUST be used as the rid- 1882 identifier; otherwise a RID value MUST be generated by the 1883 implementation. RID values MUST be generated in a fashion that 1884 does not leak user information, e.g., randomly or using a per- 1885 PeerConnection counter, and SHOULD be 3 bytes or less, to allow 1886 them to efficiently fit into the RTP header extension defined in 1887 [I-D.ietf-avtext-rid], Section 3. If no encodings have been 1888 specified, or only one encoding is specified but without a RID 1889 value, then no "a=rid" lines are generated. 1891 o If the RtpTransceiver has a sendrecv or sendonly direction and 1892 more than one "a=rid" line has been generated, an "a=simulcast" 1893 line, with direction "send", as defined in 1894 [I-D.ietf-mmusic-sdp-simulcast], Section 6.2. The list of RIDs 1895 MUST include all of the RID identifiers used in the "a=rid" lines 1896 for this m= section. 1898 The following attributes, which are of category IDENTICAL or 1899 TRANSPORT, MUST appear only in "m=" sections which either have a 1900 unique address or which are associated with the bundle-tag. (In 1901 initial offers, this means those "m=" sections which do not contain 1902 an "a=bundle-only" attribute. 1904 o "a=ice-ufrag" and "a=ice-pwd" lines, as specified in [RFC5245], 1905 Section 15.4. 1907 o An "a=fingerprint" line for each of the endpoint's certificates, 1908 as specified in [RFC4572], Section 5; the digest algorithm used 1909 for the fingerprint MUST match that used in the certificate 1910 signature. 1912 o An "a=setup" line, as specified in [RFC4145], Section 4, and 1913 clarified for use in DTLS-SRTP scenarios in [RFC5763], Section 5. 1914 The role value in the offer MUST be "actpass". 1916 o An "a=dtls-id" line, as specified in [I-D.ietf-mmusic-dtls-sdp] 1917 Section 5.2. 1919 o An "a=rtcp" line, as specified in [RFC3605], Section 2.1, 1920 containing the dummy value "9 IN IP4 0.0.0.0", because no 1921 candidates have yet been gathered. 1923 o An "a=rtcp-mux" line, as specified in [RFC5761], Section 5.1.3. 1925 o An "a=rtcp-rsize" line, as specified in [RFC5506], Section 5. 1927 Lastly, if a data channel has been created, a m= section MUST be 1928 generated for data. The field MUST be set to "application" 1929 and the field MUST be set to "UDP/DTLS/SCTP" 1930 [I-D.ietf-mmusic-sctp-sdp]. The "fmt" value MUST be set to "webrtc- 1931 datachannel" as specified in [I-D.ietf-mmusic-sctp-sdp], Section 4.1. 1933 Within the data m= section, the "a=mid", "a=ice-ufrag", "a=ice-pwd", 1934 "a=fingerprint", "a=dtls-id", and "a=setup" lines MUST be included as 1935 mentioned above, along with an "a=fmtp:webrtc-datachannel" line and 1936 an "a=sctp-port" line referencing the SCTP port number as defined in 1937 [I-D.ietf-mmusic-sctp-sdp], Section 4.1. 1939 Once all m= sections have been generated, a session-level "a=group" 1940 attribute MUST be added as specified in [RFC5888]. This attribute 1941 MUST have semantics "bundle", and MUST include the mid identifiers of 1942 each m= section. The effect of this is that the browser offers all 1943 m= sections as one bundle group. However, whether the m= sections 1944 are bundle-only or not depends on the bundle policy. 1946 The next step is to generate session-level lip sync groups as defined 1947 in [RFC5888], Section 7. For each MediaStream referenced by more 1948 than one RtpTransceiver (by passing those MediaStreams as arguments 1949 to the addTrack and addTransceiver methods), a group of type "LS" 1950 MUST be added that contains the mid values for each RtpTransceiver. 1952 Attributes which SDP permits to either be at the session level or the 1953 media level SHOULD generally be at the media level even if they are 1954 identical. This promotes readability, especially if one of a set of 1955 initially identical attributes is subsequently changed. 1957 Attributes other than the ones specified above MAY be included, 1958 except for the following attributes which are specifically 1959 incompatible with the requirements of [I-D.ietf-rtcweb-rtp-usage], 1960 and MUST NOT be included: 1962 o "a=crypto" 1964 o "a=key-mgmt" 1966 o "a=ice-lite" 1968 Note that when bundle is used, any additional attributes that are 1969 added MUST follow the advice in [I-D.ietf-mmusic-sdp-mux-attributes] 1970 on how those attributes interact with bundle. 1972 Note that these requirements are in some cases stricter than those of 1973 SDP. Implementations MUST be prepared to accept compliant SDP even 1974 if it would not conform to the requirements for generating SDP in 1975 this specification. 1977 5.2.2. Subsequent Offers 1979 When createOffer is called a second (or later) time, or is called 1980 after a local description has already been installed, the processing 1981 is somewhat different than for an initial offer. 1983 If the initial offer was not applied using setLocalDescription, 1984 meaning the PeerConnection is still in the "stable" state, the steps 1985 for generating an initial offer should be followed, subject to the 1986 following restriction: 1988 o The fields of the "o=" line MUST stay the same except for the 1989 field, which MUST increment by one on each call 1990 to createOffer if the offer might differ from the output of the 1991 previous call to createOffer; implementations MAY opt to increment 1992 on every call. The value of the generated 1993 is independent of the of the 1994 current local description; in particular, in the case where the 1995 current version is N, an offer is created and applied with version 1996 N+1, and then that offer is rolled back so that the current 1997 version is again N, the next generated offer will still have 1998 version N+2. 2000 Note that if the application creates an offer by reading 2001 currentLocalDescription instead of calling createOffer, the returned 2002 SDP may be different than when setLocalDescription was originally 2003 called, due to the addition of gathered ICE candidates, but the 2004 will not have changed. There are no known 2005 scenarios in which this causes problems, but if this is a concern, 2006 the solution is simply to use createOffer to ensure a unique 2007 . 2009 If the initial offer was applied using setLocalDescription, but an 2010 answer from the remote side has not yet been applied, meaning the 2011 PeerConnection is still in the "local-offer" state, an offer is 2012 generated by following the steps in the "stable" state above, along 2013 with these exceptions: 2015 o The "s=" and "t=" lines MUST stay the same. 2017 o If any RtpTransceiver has been added, and there exists an m= 2018 section with a zero port in the current local description or the 2019 current remote description, that m= section MUST be recycled by 2020 generating an m= section for the added RtpTransceiver as if the m= 2021 section were being added to the session description, placed at the 2022 same index as the m= section with a zero port. 2024 o If an RtpTransceiver is stopped and is not associated with an m= 2025 section, an m= section MUST NOT be generated for it. This 2026 prevents adding back RtpTransceivers whose m= sections were 2027 recycled and used for a new RtpTransceiver in a previous offer/ 2028 answer exchange, as described above. 2030 o If an RtpTransceiver has been stopped and is associated with an m= 2031 section, and the m= section is not being recycled as described 2032 above, an m= section MUST be generated for it with the port set to 2033 zero and the "a=msid" line removed. 2035 o For RtpTransceivers that are not stopped, the "a=msid" line MUST 2036 stay the same if they are present in the current description. 2038 o Each "m=" and c=" line MUST be filled in with the port, protocol, 2039 and address of the default candidate for the m= section, as 2040 described in [RFC5245], Section 4.3. If ICE checking has already 2041 completed for one or more candidate pairs and a candidate pair is 2042 in active use, then that pair MUST be used, even if ICE has not 2043 yet completed. Note that this differs from the guidance in 2044 [RFC5245], Section 9.1.2.2, which only refers to offers created 2045 when ICE has completed. In each case, if no RTP candidates have 2046 yet been gathered, dummy values MUST be used, as described above. 2048 o Each "a=mid" line MUST stay the same. 2050 o Each "a=ice-ufrag" and "a=ice-pwd" line MUST stay the same, unless 2051 the ICE configuration has changed (either changes to the supported 2052 STUN/TURN servers, or the ICE candidate policy), or the 2053 "IceRestart" option ( Section 5.2.3.1 was specified. If the m= 2054 section is bundled into another m= section, it still MUST NOT 2055 contain any ICE credentials. 2057 o If the m= section is not bundled into another m= section, an 2058 "a=rtcp" attribute line MUST be added with of the default RTCP 2059 candidate, as indicated in [RFC5761], Section 5.1.3. 2061 o If the m= section is not bundled into another m= section, for each 2062 candidate that has been gathered during the most recent gathering 2063 phase (see Section 3.5.1), an "a=candidate" line MUST be added, as 2064 defined in [RFC5245], Section 4.3., paragraph 3. If candidate 2065 gathering for the section has completed, an "a=end-of-candidates" 2066 attribute MUST be added, as described in [I-D.ietf-ice-trickle], 2067 Section 9.3. If the m= section is bundled into another m= 2068 section, both "a=candidate" and "a=end-of-candidates" MUST be 2069 omitted. 2071 o For RtpTransceivers that are still present, the "a=msid" line MUST 2072 stay the same. 2074 o For RtpTransceivers that are still present, the "a=rid" lines MUST 2075 stay the same. 2077 o For RtpTransceivers that are still present, any "a=simulcast" line 2078 MUST stay the same. 2080 o If any RtpTransceiver has been stopped, the port MUST be set to 2081 zero and the "a=msid" line MUST be removed. 2083 o If any RtpTransceiver has been added, and there exists a m= 2084 section with a zero port in the current local description or the 2085 current remote description, that m= section MUST be recycled by 2086 generating a m= section for the added RtpTransceiver as if the m= 2087 section were being added to session description, except that 2088 instead of adding it, the generated m= section replaces the m= 2089 section with a zero port. The new m= section MUST contain a new 2090 MID. 2092 If the initial offer was applied using setLocalDescription, and an 2093 answer from the remote side has been applied using 2094 setRemoteDescription, meaning the PeerConnection is in the "remote- 2095 pranswer" or "stable" states, an offer is generated based on the 2096 negotiated session descriptions by following the steps mentioned for 2097 the "local-offer" state above. 2099 In addition, for each non-recycled, non-rejected m= section in the 2100 new offer, the following adjustments are made based on the contents 2101 of the corresponding m= section in the current remote description, if 2102 any: 2104 o The m= line and corresponding "a=rtpmap" and "a=fmtp" lines MUST 2105 only include codecs present in the most recent answer which have 2106 not been excluded by the codec preferences of the associated 2107 transceiver. Note that non-JSEP endpoints are not subject to 2108 these restrictions, and might offer media formats that were not 2109 present in the most recent answer, as specified in [RFC3264], 2110 Section 8. Therefore, JSEP endpoints MUST be prepared to receive 2111 such offers. 2113 o The media formats on the m= line MUST be generated in the same 2114 order as in the current local description. 2116 o The RTP header extensions MUST only include those that are present 2117 in the most recent answer. 2119 o The RTCP feedback extensions MUST only include those that are 2120 present in the most recent answer. 2122 o The "a=rtcp" line MUST only be added if the most recent answer did 2123 not include an "a=rtcp-mux" line. 2125 o The "a=rtcp-mux" line MUST only be added if present in the most 2126 recent answer. 2128 o The "a=rtcp-mux-only" line MUST only be added if present in the 2129 most recent answer. 2131 o The "a=rtcp-rsize" line MUST only be added if present in the most 2132 recent answer. 2134 The "a=group:BUNDLE" attribute MUST include the mid identifiers 2135 specified in the bundle group in the most recent answer, minus any m= 2136 sections that have been marked as rejected, plus any newly added or 2137 re-enabled m= sections. In other words, the bundle attribute must 2138 contain all m= sections that were previously bundled, as long as they 2139 are still alive, as well as any new m= sections. 2141 The "LS" groups are generated in the same way as with initial offers. 2143 5.2.3. Options Handling 2145 The createOffer method takes as a parameter an RTCOfferOptions 2146 object. Special processing is performed when generating a SDP 2147 description if the following options are present. 2149 5.2.3.1. IceRestart 2151 If the "IceRestart" option is specified, with a value of "true", the 2152 offer MUST indicate an ICE restart by generating new ICE ufrag and 2153 pwd attributes, as specified in [RFC5245], Section 9.1.1.1. If this 2154 option is specified on an initial offer, it has no effect (since a 2155 new ICE ufrag and pwd are already generated). Similarly, if the ICE 2156 configuration has changed, this option has no effect, since new ufrag 2157 and pwd attributes will be generated automatically. This option is 2158 primarily useful for reestablishing connectivity in cases where 2159 failures are detected by the application. 2161 5.2.3.2. VoiceActivityDetection 2163 If the "VoiceActivityDetection" option is specified, with a value of 2164 "true", the offer MUST indicate support for silence suppression in 2165 the audio it receives by including comfort noise ("CN") codecs for 2166 each offered audio codec, as specified in [RFC3389], Section 5.1, 2167 except for codecs that have their own internal silence suppression 2168 support. For codecs that have their own internal silence suppression 2169 support, the appropriate fmtp parameters for that codec MUST be 2170 specified to indicate that silence suppression for received audio is 2171 desired. For example, when using the Opus codec, the "usedtx=1" 2172 parameter would be specified in the offer. This option allows the 2173 endpoint to significantly reduce the amount of audio bandwidth it 2174 receives, at the cost of some fidelity, depending on the quality of 2175 the remote VAD algorithm. 2177 If the "VoiceActivityDetection" option is specified, with a value of 2178 "false", the browser MUST NOT emit "CN" codecs. For codecs that have 2179 their own internal silence suppression support, the appropriate fmtp 2180 parameters for that codec MUST be specified to indicate that silence 2181 suppression for received audio is not desired. For example, when 2182 using the Opus codec, the "usedtx=0" parameter would be specified in 2183 the offer. 2185 Note that setting the "VoiceActivityDetection" parameter when 2186 generating an offer is a request to receive audio with silence 2187 suppression. It has no impact on whether the local endpoint does 2188 silence suppression for the audio it sends. 2190 The "VoiceActivityDetection" option does not have any impact on the 2191 setting of the "vad" value in the signaling of the client to mixer 2192 audio level header extension described in [RFC6464], Section 4. 2194 5.3. Generating an Answer 2196 When createAnswer is called, a new SDP description must be created 2197 that is compatible with the supplied remote description as well as 2198 the requirements specified in [I-D.ietf-rtcweb-rtp-usage]. The exact 2199 details of this process are explained below. 2201 5.3.1. Initial Answers 2203 When createAnswer is called for the first time after a remote 2204 description has been provided, the result is known as the initial 2205 answer. If no remote description has been installed, an answer 2206 cannot be generated, and an error MUST be returned. 2208 Note that the remote description SDP may not have been created by a 2209 JSEP endpoint and may not conform to all the requirements listed in 2210 Section 5.2. For many cases, this is not a problem. However, if any 2211 mandatory SDP attributes are missing, or functionality listed as 2212 mandatory-to-use above is not present, this MUST be treated as an 2213 error, and MUST cause the affected m= sections to be marked as 2214 rejected. 2216 The first step in generating an initial answer is to generate 2217 session-level attributes. The process here is identical to that 2218 indicated in the Initial Offers section above, except that the 2219 "a=ice-options" line, with the "trickle" option as specified in 2220 [I-D.ietf-ice-trickle], Section 4, is only included if such an option 2221 was present in the offer. 2223 The next step is to generate session-level lip sync groups as defined 2224 in [RFC5888], Section 7. For each group of type "LS" present in the 2225 offer, determine which of the local RtpTransceivers identified by 2226 that group's mid values reference a common local MediaStream (as 2227 specified in the addTrack and addTransceiver methods). If at least 2228 two such RtpTransceivers exist, a group of type "LS" with the mid 2229 values of these RtpTransceivers MUST be added. Otherwise, this 2230 indicates a difference of opinion between the offerer and answerer 2231 regarding lip sync status, and as such, the offered group MUST be 2232 ignored and no corresponding "LS" group generated. 2234 The next step is to generate m= sections for each m= section that is 2235 present in the remote offer, as specified in [RFC3264], Section 6. 2236 For the purposes of this discussion, any session-level attributes in 2237 the offer that are also valid as media-level attributes SHALL be 2238 considered to be present in each m= section. 2240 The next step is to go through each offered m= section. Each offered 2241 m= section will have an associated RtpTransceiver, as described in 2242 Section 5.9. If there are more RtpTransceivers than there are m= 2243 sections, the unmatched RtpTransceivers will need to be associated in 2244 a subsequent offer. 2246 For each offered m= section, if any of the following conditions are 2247 true, the corresponding m= section in the answer MUST be marked as 2248 rejected by setting the port in the m= line to zero, as indicated in 2249 [RFC3264], Section 6., and further processing for this m= section can 2250 be skipped: 2252 o The associated RtpTransceiver has been stopped. 2254 o No supported codec is present in the offer. 2256 o The bundle policy is "max-bundle", and this is not the first m= 2257 section or in the same bundle group as the first m= section. 2259 o The bundle policy is "balanced", and this is not the first m= 2260 section for this media type or in the same bundle group as the 2261 first m= section for this media type. 2263 Otherwise, each m= section in the answer should then be generated as 2264 specified in [RFC3264], Section 6.1. For the m= line itself, the 2265 following rules must be followed: 2267 o The port value would normally be set to the port of the default 2268 ICE candidate for this m= section, but given that no candidates 2269 are available yet, the "dummy" port value of 9 (Discard) MUST be 2270 used, as indicated in [I-D.ietf-ice-trickle], Section 5.1. 2272 o The field MUST be set to exactly match the field 2273 for the corresponding m= line in the offer. 2275 o If codec preferences have been set for the associated transceiver, 2276 media formats MUST be generated in the corresponding order, and 2277 MUST exclude any codecs not present in the codec preferences or 2278 not present in the offer. Note that non-JSEP endpoints are not 2279 subject to this restriction, and might add media formats in the 2280 answer that are not present in the offer, as specified in 2281 [RFC3264], Section 6.1. Therefore, JSEP endpoints MUST be 2282 prepared to receive such answers. 2284 o Unless excluded by the above restrictions, the media formats MUST 2285 include the mandatory audio/video codecs as specified in 2286 [I-D.ietf-rtcweb-audio](see Section 3) and 2287 [I-D.ietf-rtcweb-video](see Section 5). 2289 The m= line MUST be followed immediately by a "c=" line, as specified 2290 in [RFC4566], Section 5.7. Again, as no candidates are available 2291 yet, the "c=" line must contain the "dummy" value "IN IP4 0.0.0.0", 2292 as defined in [I-D.ietf-ice-trickle], Section 5.1. 2294 If the offer supports bundle, all m= sections to be bundled must use 2295 the same ICE credentials and candidates; all m= sections not being 2296 bundled must use unique ICE credentials and candidates. Each m= 2297 section MUST contain the following attributes (which are of attribute 2298 types other than IDENTICAL and TRANSPORT): 2300 o If and only if present in the offer, an "a=mid" line, as specified 2301 in [RFC5888], Section 9.1. The "mid" value MUST match that 2302 specified in the offer. 2304 o A direction attribute, determined by applying the rules regarding 2305 the offered direction specified in [RFC3264], Section 6.1, and 2306 then intersecting with the direction of the associated 2307 RtpTransceiver. For example, in the case where an m= section is 2308 offered as "sendonly", and the local transceiver is set to 2309 "sendrecv", the result in the answer is a "recvonly" direction. 2311 o For each media format on the m= line, "a=rtpmap" and "a=fmtp" 2312 lines, as specified in [RFC4566], Section 6, and [RFC3264], 2313 Section 6.1. 2315 o If this m= section is for media with configurable durations of 2316 media per packet, e.g., audio, an "a=maxptime" line, as described 2317 in Section 5.2. 2319 o If this m= section is for video media, and there are known 2320 limitations on the size of images which can be decoded, an 2321 "a=imageattr" line, as specified in Section 3.6. 2323 o If "rtx" is present in the offer, for each primary codec where RTP 2324 retransmission should be used, a corresponding "a=rtpmap" line 2325 indicating "rtx" with the clock rate of the primary codec and an 2326 "a=fmtp" line that references the payload type of the primary 2327 codec, as specified in [RFC4588], Section 8.1. 2329 o For each supported FEC mechanism, "a=rtpmap" and "a=fmtp" lines, 2330 as specified in [RFC4566], Section 6. The FEC mechanisms that 2331 MUST be supported are specified in [I-D.ietf-rtcweb-fec], 2332 Section 6, and specific usage for each media type is outlined in 2333 Sections 4 and 5. 2335 o For each supported RTP header extension that is present in the 2336 offer, an "a=extmap" line, as specified in [RFC5285], Section 5. 2337 The list of header extensions that SHOULD/MUST be supported is 2338 specified in [I-D.ietf-rtcweb-rtp-usage], Section 5.2. Any header 2339 extensions that require encryption MUST be specified as indicated 2340 in [RFC6904], Section 4. 2342 o For each supported RTCP feedback mechanism that is present in the 2343 offer, an "a=rtcp-fb" mechanism, as specified in [RFC4585], 2344 Section 4.2. The list of RTCP feedback mechanisms that SHOULD/ 2345 MUST be supported is specified in [I-D.ietf-rtcweb-rtp-usage], 2346 Section 5.1. 2348 o If the RtpTransceiver has a sendrecv or sendonly direction: 2350 * An "a=msid" line, as specified in [I-D.ietf-mmusic-msid], 2351 Section 2. 2353 Each m= section which is not bundled into another m= section, MUST 2354 contain the following attributes (which are of category IDENTICAL or 2355 TRANSPORT): 2357 o "a=ice-ufrag" and "a=ice-pwd" lines, as specified in [RFC5245], 2358 Section 15.4. 2360 o An "a=fingerprint" line for each of the endpoint's certificates, 2361 as specified in [RFC4572], Section 5; the digest algorithm used 2362 for the fingerprint MUST match that used in the certificate 2363 signature. 2365 o An "a=setup" line, as specified in [RFC4145], Section 4, and 2366 clarified for use in DTLS-SRTP scenarios in [RFC5763], Section 5. 2367 The role value in the answer MUST be "active" or "passive"; the 2368 "active" role is RECOMMENDED. 2370 o An "a=dtls-id" line, as specified in [I-D.ietf-mmusic-dtls-sdp] 2371 Section 5.3. 2373 o If present in the offer, an "a=rtcp-mux" line, as specified in 2374 [RFC5761], Section 5.1.3. Otherwise, an "a=rtcp" line, as 2375 specified in [RFC3605], Section 2.1, containing the dummy value "9 2376 IN IP4 0.0.0.0" (because no candidates have yet been gathered). 2378 o If present in the offer, an "a=rtcp-rsize" line, as specified in 2379 [RFC5506], Section 5. 2381 If a data channel m= section has been offered, a m= section MUST also 2382 be generated for data. The field MUST be set to 2383 "application" and the and "fmt" fields MUST be set to exactly 2384 match the fields in the offer. 2386 Within the data m= section, the "a=mid", "a=ice-ufrag", "a=ice-pwd", 2387 "a=candidate", "a=fingerprint", "a=dtls-id", and "a=setup" lines MUST 2388 be included under the conditions described above, along with an 2389 "a=fmtp:webrtc-datachannel" line and an "a=sctp-port" line 2390 referencing the SCTP port number as defined in 2391 [I-D.ietf-mmusic-sctp-sdp], Section 4.1. 2393 If "a=group" attributes with semantics of "BUNDLE" are offered, 2394 corresponding session-level "a=group" attributes MUST be added as 2395 specified in [RFC5888]. These attributes MUST have semantics 2396 "BUNDLE", and MUST include the all mid identifiers from the offered 2397 bundle groups that have not been rejected. Note that regardless of 2398 the presence of "a=bundle-only" in the offer, no m= sections in the 2399 answer should have an "a=bundle-only" line. 2401 Attributes that are common between all m= sections MAY be moved to 2402 session-level, if explicitly defined to be valid at session-level. 2404 The attributes prohibited in the creation of offers are also 2405 prohibited in the creation of answers. 2407 5.3.2. Subsequent Answers 2409 When createAnswer is called a second (or later) time, or is called 2410 after a local description has already been installed, the processing 2411 is somewhat different than for an initial answer. 2413 If the initial answer was not applied using setLocalDescription, 2414 meaning the PeerConnection is still in the "have-remote-offer" state, 2415 the steps for generating an initial answer should be followed, 2416 subject to the following restriction: 2418 o The fields of the "o=" line MUST stay the same except for the 2419 field, which MUST increment if the session 2420 description changes in any way from the previously generated 2421 answer. 2423 If any session description was previously supplied to 2424 setLocalDescription, an answer is generated by following the steps in 2425 the "have-remote-offer" state above, along with these exceptions: 2427 o The "s=" and "t=" lines MUST stay the same. 2429 o Each "m=" and c=" line MUST be filled in with the port and address 2430 of the default candidate for the m= section, as described in 2431 [RFC5245], Section 4.3. Note, however, that the m= line protocol 2432 need not match the default candidate, because this protocol value 2433 must instead match what was supplied in the offer, as described 2434 above. 2436 o The media formats on the m= line MUST be generated in the same 2437 order as in the current local description. 2439 o Each "a=ice-ufrag" and "a=ice-pwd" line MUST stay the same, unless 2440 the m= section is restarting, in which case new ICE credentials 2441 must be created as specified in [RFC5245], Section 9.2.1.1. If 2442 the m= section is bundled into another m= section, it still MUST 2443 NOT contain any ICE credentials. 2445 o Each "a=setup" line MUST use an "active" or "passive" role value 2446 consistent with the existing DTLS association, if the association 2447 is being continued by the offerer. 2449 o If the m= section is not bundled into another m= section and RTCP 2450 multiplexing is not active, an "a=rtcp" attribute line MUST be 2451 filled in with the port and address of the default RTCP candidate. 2452 If no RTCP candidates have yet been gathered, dummy values MUST be 2453 used, as described in the initial answer section above. 2455 o If the m= section is not bundled into another m= section, for each 2456 candidate that has been gathered during the most recent gathering 2457 phase (see Section 3.5.1), an "a=candidate" line MUST be added, as 2458 defined in [RFC5245], Section 4.3., paragraph 3. If candidate 2459 gathering for the section has completed, an "a=end-of-candidates" 2460 attribute MUST be added, as described in [I-D.ietf-ice-trickle], 2461 Section 9.3. If the m= section is bundled into another m= 2462 section, both "a=candidate" and "a=end-of-candidates" MUST be 2463 omitted. 2465 o For RtpTransceivers that are not stopped, the "a=msid" line MUST 2466 stay the same. 2468 5.3.3. Options Handling 2470 The createAnswer method takes as a parameter an RTCAnswerOptions 2471 object. The set of parameters for RTCAnswerOptions is different than 2472 those supported in RTCOfferOptions; the IceRestart option is 2473 unnecessary, as ICE credentials will automatically be changed for all 2474 m= sections where the offerer chose to perform ICE restart. 2476 The following options are supported in RTCAnswerOptions. 2478 5.3.3.1. VoiceActivityDetection 2480 Silence suppression in the answer is handled as described in 2481 Section 5.2.3.2, with one exception: if support for silence 2482 suppression was not indicated in the offer, the 2483 VoiceActivityDetection parameter has no effect, and the answer should 2484 be generated as if VoiceActivityDetection was set to false. This is 2485 done on a per-codec basis (e.g., if the offerer somehow offered 2486 support for CN but set "usedtx=0" for Opus, setting 2487 VoiceActivityDetection to true would result in an answer with CN 2488 codecs and "usedtx=0"). 2490 5.4. Modifying an Offer or Answer 2492 The SDP returned from createOffer or createAnswer MUST NOT be changed 2493 before passing it to setLocalDescription. If precise control over 2494 the SDP is needed, the aforementioned createOffer/createAnswer 2495 options or RtpTransceiver APIs MUST be used. 2497 Note that the application MAY modify the SDP to reduce the 2498 capabilities in the offer it sends to the far side (post- 2499 setLocalDescription) or the offer that it installs from the far side 2500 (pre-setRemoteDescription), as long as it remains a valid SDP offer 2501 and specifies a subset of what was in the original offer. This is 2502 safe because the answer is not permitted to expand capabilities, and 2503 therefore will just respond to what is present in the offer. 2505 The application SHOULD NOT modify the SDP in the answer it transmits, 2506 as the answer contains the negotiated capabilities, and this can 2507 cause the two sides to have different ideas about what exactly was 2508 negotiated. 2510 As always, the application is solely responsible for what it sends to 2511 the other party, and all incoming SDP will be processed by the 2512 browser to the extent of its capabilities. It is an error to assume 2513 that all SDP is well-formed; however, one should be able to assume 2514 that any implementation of this specification will be able to 2515 process, as a remote offer or answer, unmodified SDP coming from any 2516 other implementation of this specification. 2518 5.5. Processing a Local Description 2520 When a SessionDescription is supplied to setLocalDescription, the 2521 following steps MUST be performed: 2523 o First, the type of the SessionDescription is checked against the 2524 current state of the PeerConnection: 2526 * If the type is "offer", the PeerConnection state MUST be either 2527 "stable" or "have-local-offer". 2529 * If the type is "pranswer" or "answer", the PeerConnection state 2530 MUST be either "have-remote-offer" or "have-local-pranswer". 2532 o If the type is not correct for the current state, processing MUST 2533 stop and an error MUST be returned. 2535 o Next, the SessionDescription is parsed into a data structure, as 2536 described in the Section 5.7 section below. If parsing fails for 2537 any reason, processing MUST stop and an error MUST be returned. 2539 o Finally, the parsed SessionDescription is applied as described in 2540 the Section 5.8 section below. 2542 5.6. Processing a Remote Description 2544 When a SessionDescription is supplied to setRemoteDescription, the 2545 following steps MUST be performed: 2547 o First, the type of the SessionDescription is checked against the 2548 current state of the PeerConnection: 2550 * If the type is "offer", the PeerConnection state MUST be either 2551 "stable" or "have-remote-offer". 2553 * If the type is "pranswer" or "answer", the PeerConnection state 2554 MUST be either "have-local-offer" or "have-remote-pranswer". 2556 o If the type is not correct for the current state, processing MUST 2557 stop and an error MUST be returned. 2559 o Next, the SessionDescription is parsed into a data structure, as 2560 described in the Section 5.7 section below. If parsing fails for 2561 any reason, processing MUST stop and an error MUST be returned. 2563 o Finally, the parsed SessionDescription is applied as described in 2564 the Section 5.9 section below. 2566 5.7. Parsing a Session Description 2568 When a SessionDescription of any type is supplied to setLocal/ 2569 RemoteDescription, the implementation must parse it and reject it if 2570 it is invalid. The exact details of this process are explained 2571 below. 2573 The SDP contained in the session description object consists of a 2574 sequence of text lines, each containing a key-value expression, as 2575 described in [RFC4566], Section 5. The SDP is read, line-by-line, 2576 and converted to a data structure that contains the deserialized 2577 information. However, SDP allows many types of lines, not all of 2578 which are relevant to JSEP applications. For each line, the 2579 implementation will first ensure it is syntactically correct 2580 according to its defining ABNF, check that it conforms to [RFC4566] 2581 and [RFC3264] semantics, and then either parse and store or discard 2582 the provided value, as described below. 2584 If any line is not well-formed, or cannot be parsed as described, the 2585 parser MUST stop with an error and reject the session description, 2586 even if the value is to be discarded. This ensures that 2587 implementations do not accidentally misinterpret ambiguous SDP. 2589 5.7.1. Session-Level Parsing 2591 First, the session-level lines are checked and parsed. These lines 2592 MUST occur in a specific order, and with a specific syntax, as 2593 defined in [RFC4566], Section 5. Note that while the specific line 2594 types (e.g. "v=", "c=") MUST occur in the defined order, lines of the 2595 same type (typically "a=") can occur in any order, and their ordering 2596 is not meaningful. 2598 The following non-attribute lines are not meaningful in the JSEP 2599 context and MAY be discarded once they have been checked. 2601 The "c=" line MUST be checked for syntax but its value is not 2602 used. This supersedes the guidance in [RFC5245], Section 6.1, to 2603 use "ice-mismatch" to indicate mismatches between "c=" and the 2604 candidate lines; because JSEP always uses ICE, "ice-mismatch" is 2605 not useful in this context. 2607 The "i=", "u=", "e=", "p=", "t=", "r=", "z=", and "k=" lines are 2608 not used by this specification; they MUST be checked for syntax 2609 but their values are not used. 2611 The remaining non-attribute lines are processed as follows: 2613 The "v=" line MUST have a version of 0, as specified in [RFC4566], 2614 Section 5.1. 2616 The "o=" line MUST be parsed as specified in [RFC4566], 2617 Section 5.2. 2619 The "b=" line, if present, MUST be parsed as specified in 2620 [RFC4566], Section 5.8, and the bwtype and bandwidth values 2621 stored. 2623 Finally, the attribute lines are processed. Specific processing MUST 2624 be applied for the following session-level attribute ("a=") lines: 2626 o Any "a=group" lines are parsed as specified in [RFC5888], 2627 Section 5, and the group's semantics and mids are stored. 2629 o If present, a single "a=ice-lite" line is parsed as specified in 2630 [RFC5245], Section 15.3, and a value indicating the presence of 2631 ice-lite is stored. 2633 o If present, a single "a=ice-ufrag" line is parsed as specified in 2634 [RFC5245], Section 15.4, and the ufrag value is stored. 2636 o If present, a single "a=ice-pwd" line is parsed as specified in 2637 [RFC5245], Section 15.4, and the password value is stored. 2639 o If present, a single "a=ice-options" line is parsed as specified 2640 in [RFC5245], Section 15.5, and the set of specified options is 2641 stored. 2643 o Any "a=fingerprint" lines are parsed as specified in [RFC4572], 2644 Section 5, and the set of fingerprint and algorithm values is 2645 stored. 2647 o If present, a single "a=setup" line is parsed as specified in 2648 [RFC4145], Section 4, and the setup value is stored. 2650 o If present, a single "a=dtls-id" line is parsed as specified in 2651 [I-D.ietf-mmusic-dtls-sdp] Section 5, and the dtls-id value is 2652 stored. 2654 o Any "a=extmap" lines are parsed as specified in [RFC5285], 2655 Section 5, and their values are stored. 2657 Once all the session-level lines have been parsed, processing 2658 continues with the lines in media sections. 2660 5.7.2. Media Section Parsing 2662 Like the session-level lines, the media session lines MUST occur in 2663 the specific order and with the specific syntax defined in [RFC4566], 2664 Section 5. 2666 The "m=" line itself MUST be parsed as described in [RFC4566], 2667 Section 5.14, and the media, port, proto, and fmt values stored. 2669 Following the "m=" line, specific processing MUST be applied for the 2670 following non-attribute lines: 2672 o As with the "c=" line at the session level, the "c=" line MUST be 2673 parsed according to [RFC4566], Section 5.7, but its value is not 2674 used. 2676 o The "b=" line, if present, MUST be parsed as specified in 2677 [RFC4566], Section 5.8, and the bwtype and bandwidth values 2678 stored. 2680 Specific processing MUST also be applied for the following attribute 2681 lines: 2683 o If present, a single "a=ice-ufrag" line is parsed as specified in 2684 [RFC5245], Section 15.4, and the ufrag value is stored. 2686 o If present, a single "a=ice-pwd" line is parsed as specified in 2687 [RFC5245], Section 15.4, and the password value is stored. 2689 o If present, a single "a=ice-options" line is parsed as specified 2690 in [RFC5245], Section 15.5, and the set of specified options is 2691 stored. 2693 o Any "a=candidate" attributes MUST be parsed as specified in 2694 [RFC5245], Section 15.1, and their values stored. 2696 o Any "a=remote-candidates" attributes MUST be parsed as specified 2697 in [RFC5245], Section 15.2, but their values are ignored. 2699 o If present, a single "a=end-of-candidates" attribute MUST be 2700 parsed as specified in [I-D.ietf-ice-trickle], Section 8.2, and 2701 its presence or absence flagged and stored. 2703 o Any "a=fingerprint" lines are parsed as specified in [RFC4572], 2704 Section 5, and the set of fingerprint and algorithm values is 2705 stored. 2707 If the "m=" proto value indicates use of RTP, as described in the 2708 Section 5.1.3 section above, the following attribute lines MUST be 2709 processed: 2711 o The "m=" fmt value MUST be parsed as specified in [RFC4566], 2712 Section 5.14, and the individual values stored. 2714 o Any "a=rtpmap" or "a=fmtp" lines MUST be parsed as specified in 2715 [RFC4566], Section 6, and their values stored. 2717 o If present, a single "a=ptime" line MUST be parsed as described in 2718 [RFC4566], Section 6, and its value stored. 2720 o If present, a single "a=maxptime" line MUST be parsed as described 2721 in [RFC4566], Section 6, and its value stored. 2723 o If present, a single direction attribute line (e.g. "a=sendrecv") 2724 MUST be parsed as described in [RFC4566], Section 6, and its value 2725 stored. 2727 o Any "a=ssrc" or "a=ssrc-group" attributes MUST be parsed as 2728 specified in [RFC5576], Sections 4.1-4.2, and their values stored. 2730 o Any "a=extmap" attributes MUST be parsed as specified in 2731 [RFC5285], Section 5, and their values stored. 2733 o Any "a=rtcp-fb" attributes MUST be parsed as specified in 2734 [RFC4585], Section 4.2., and their values stored. 2736 o If present, a single "a=rtcp-mux" attribute MUST be parsed as 2737 specified in [RFC5761], Section 5.1.3, and its presence or absence 2738 flagged and stored. 2740 o If present, a single "a=rtcp-mux-only" attribute MUST be parsed as 2741 specified in [I-D.ietf-mmusic-mux-exclusive], Section 3, and its 2742 presence or absence flagged and stored. 2744 o If present, a single "a=rtcp-rsize" attribute MUST be parsed as 2745 specified in [RFC5506], Section 5, and its presence or absence 2746 flagged and stored. 2748 o If present, a single "a=rtcp" attribute MUST be parsed as 2749 specified in [RFC3605], Section 2.1, but its value is ignored, as 2750 this information is superfluous when using ICE. 2752 o If present, a single "a=msid" attribute MUST be parsed as 2753 specified in [I-D.ietf-mmusic-msid], Section 3.2, and its value 2754 stored. 2756 o Any "a=imageattr" attributes MUST be parsed as specified in 2757 [RFC6236], Section 3, and their values stored. 2759 o Any "a=rid" lines MUST be parsed as specified in 2760 [I-D.ietf-mmusic-rid], Section 10, and their values stored. 2762 o If present, a single "a=simulcast" line MUST be parsed as 2763 specified in [I-D.ietf-mmusic-sdp-simulcast], and its values 2764 stored. 2766 Otherwise, if the "m=" proto value indicates use of SCTP, the 2767 following attribute lines MUST be processed: 2769 o The "m=" fmt value MUST be parsed as specified in 2770 [I-D.ietf-mmusic-sctp-sdp], Section 4.3, and the application 2771 protocol value stored. 2773 o An "a=sctp-port" attribute MUST be present, and it MUST be parsed 2774 as specified in [I-D.ietf-mmusic-sctp-sdp], Section 5.2, and the 2775 value stored. 2777 o If present, a single "a=max-message-size" attribute MUST be parsed 2778 as specified in [I-D.ietf-mmusic-sctp-sdp], Section 6, and the 2779 value stored. Otherwise, use the specified default. 2781 5.7.3. Semantics Verification 2783 Assuming parsing completes successfully, the parsed description is 2784 then evaluated to ensure internal consistency as well as proper 2785 support for mandatory features. Specifically, the following checks 2786 are performed: 2788 o For each m= section, valid values for each of the mandatory-to-use 2789 features enumerated in Section 5.1.2 MUST be present. These 2790 values MAY either be present at the media level, or inherited from 2791 the session level. 2793 * ICE ufrag and password values, which MUST comply with the size 2794 limits specified in [RFC5245], Section 15.4. 2796 * dtls-id value, which MUST be set according to 2797 [I-D.ietf-mmusic-dtls-sdp] Section 5. If this is a re-offer 2798 and the dtls-id value is different from that presently in use, 2799 the DTLS connection is not being continued and the remote 2800 description MUST be part of an ICE restart, together with new 2801 ufrag and password values. If this is an answer, the dtls-id 2802 value, if present, MUST be the same as in the offer. 2804 * DTLS setup value, which MUST be set according to the rules 2805 specified in [RFC5763], Section 5 and MUST be consistent with 2806 the selected role of the current DTLS connection, if one exists 2807 and is being continued. 2809 * DTLS fingerprint values, where at least one fingerprint MUST be 2810 present. 2812 o All RID values referenced in an "a=simulcast" line MUST exist as 2813 "a=rid" lines. 2815 o Each m= section is also checked to ensure prohibited features are 2816 not used. If this is a local description, the "ice-lite" 2817 attribute MUST NOT be specified. 2819 o If the RTP/RTCP multiplexing policy is "require", each m= section 2820 MUST contain an "a=rtcp-mux" attribute. 2822 If this session description is of type "pranswer" or "answer", the 2823 following additional checks are applied: 2825 o The session description must follow the rules defined in 2826 [RFC3264], Section 6, including the requirement that the number of 2827 m= sections MUST exactly match the number of m= sections in the 2828 associated offer. 2830 o For each m= section, the media type and protocol values MUST 2831 exactly match the media type and protocol values in the 2832 corresponding m= section in the associated offer. 2834 If any of the preceding checks failed, processing MUST stop and an 2835 error MUST be returned. 2837 5.8. Applying a Local Description 2839 The following steps are performed at the media engine level to apply 2840 a local description. 2842 First, the parsed parameters are checked to ensure that they are 2843 identical to those generated in the last call to createOffer/ 2844 createAnswer, and thus have not been altered, as discussed in 2845 Section 5.4; otherwise, processing MUST stop and an error MUST be 2846 returned. 2848 Next, media sections are processed. For each media section, the 2849 following steps MUST be performed; if any parameters are out of 2850 bounds, or cannot be applied, processing MUST stop and an error MUST 2851 be returned. 2853 o If this media section is new, begin gathering candidates for it, 2854 as defined in [RFC5245], Section 4.1.1, unless it has been marked 2855 as bundle-only. 2857 o Or, if the ICE ufrag and password values have changed, and it has 2858 not been marked as bundle-only, trigger the ICE Agent to start an 2859 ICE restart, and begin gathering new candidates for the media 2860 section as described in [RFC5245], Section 9.1.1.1. If this 2861 description is an answer, also start checks on that media section 2862 as defined in [RFC5245], Section 9.3.1.1. 2864 o If the media section proto value indicates use of RTP: 2866 * If there is no RtpTransceiver associated with this m= section 2867 (which will only happen when applying an offer), find one and 2868 associate it with this m= section according to the following 2869 steps: 2871 + Find the RtpTransceiver that corresponds to this m= section, 2872 using the mapping between transceivers and m= section 2873 indices established when creating the offer. 2875 + Set the value of this RtpTransceiver's mid property to the 2876 MID of the m= section. 2878 * If RTCP mux is indicated, prepare to demux RTP and RTCP from 2879 the RTP ICE component, as specified in [RFC5761], 2880 Section 5.1.3. If RTCP mux is not indicated, but was 2881 previously negotiated, i.e., the RTCP ICE component no longer 2882 exists, this MUST result in an error. 2884 * For each specified RTP header extension, establish a mapping 2885 between the extension ID and URI, as described in section 6 of 2886 [RFC5285]. If any indicated RTP header extension is not 2887 supported, this MUST result in an error. 2889 * If the MID header extension is supported, prepare to demux RTP 2890 streams intended for this media section based on the MID header 2891 extension, as described in 2892 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 14. 2894 * For each specified media format, establish a mapping between 2895 the payload type and the actual media format, as described in 2896 [RFC3264], Section 6.1. If any indicated media format is not 2897 supported, this MUST result in an error. 2899 * For each specified "rtx" media format, establish a mapping 2900 between the RTX payload type and its associated primary payload 2901 type, as described in [RFC4588], Sections 8.6 and 8.7. If any 2902 referenced primary payload types are not present, this MUST 2903 result in an error. 2905 * If the directional attribute is of type "sendrecv" or 2906 "recvonly", enable receipt and decoding of media. 2908 Finally, if this description is of type "pranswer" or "answer", 2909 follow the processing defined in the Section 5.10 section below. 2911 5.9. Applying a Remote Description 2913 If the answer contains any "a=ice-options" attributes where "trickle" 2914 is listed as an attribute, update the PeerConnection canTrickle 2915 property to be true. Otherwise, set this property to false. 2917 The following steps are performed at the media engine level to apply 2918 a remote description. 2920 The following steps MUST be performed for attributes at the session 2921 level; if any parameters are out of bounds, or cannot be applied, 2922 processing MUST stop and an error MUST be returned. 2924 o For any specified "CT" bandwidth value, set this as the limit for 2925 the maximum total bitrate for all m= sections, as specified in 2926 Section 5.8 of [RFC4566]. Within this overall limit, the 2927 implementation can dynamically decide how to best allocate the 2928 available bandwidth between m= sections, respecting any specific 2929 limits that have been specified for individual m= sections. 2931 o For any specified "RR" or "RS" bandwidth values, handle as 2932 specified in [RFC3556], Section 2. 2934 o Any "AS" bandwidth value MUST be ignored, as the meaning of this 2935 construct at the session level is not well defined. 2937 For each media section, the following steps MUST be performed; if any 2938 parameters are out of bounds, or cannot be applied, processing MUST 2939 stop and an error MUST be returned. 2941 o If the ICE ufrag or password changed from the previous remote 2942 description, then an ICE restart is needed, as described in 2943 Section 9.1.1.1 of [RFC5245] If the description is of type 2944 "offer", mark that an ICE restart is needed. If the description 2945 is of type "answer" and the current local description is also an 2946 ICE restart, then signal the ICE agent to begin checks as 2947 described in Section 9.3.1.1 of [RFC5245]. An answer MUST change 2948 the ufrag and password in an answer if and only if ICE is 2949 restarting, as described in Section 9.2.1.1 of [RFC5245]. 2951 o Configure the ICE components associated with this media section to 2952 use the supplied ICE remote ufrag and password for their 2953 connectivity checks. 2955 o Pair any supplied ICE candidates with any gathered local 2956 candidates, as described in Section 5.7 of [RFC5245] and start 2957 connectivity checks with the appropriate credentials. 2959 o If an "a=end-of-candidates" attribute is present, process the end- 2960 of-candidates indication as described in [I-D.ietf-ice-trickle] 2961 Section 11. 2963 o If the media section proto value indicates use of RTP: 2965 * If the m= section is being recycled (see Section 5.2.2), 2966 dissociate the currently associated RtpTransceiver by setting 2967 its mid property to null, and discard the mapping between the 2968 transceiver and its m= section index. 2970 * If the m= section is not associated with any RtpTransceiver 2971 (possibly because it was dissociated in the previous step), 2972 either find an RtpTransceiver or create one according to the 2973 following steps: 2975 + If the m= section is sendrecv or recvonly, and there are 2976 RtpTransceivers of the same type that were added to the 2977 PeerConnection by addTrack and are not associated with any 2978 m= section and are not stopped, find the first (according to 2979 the canonical order described in Section 5.2.1) such 2980 RtpTransceiver. 2982 + If no RtpTransceiver was found in the previous step, create 2983 one with a recvonly direction. 2985 + Associate the found or created RtpTransceiver with the m= 2986 section by setting the value of the RtpTransceiver's mid 2987 property to the MID of the m= section, and establish a 2988 mapping between the transceiver and the index of the m= 2989 section. If the m= section does not include a MID (i.e., 2990 the remote endpoint does not support the MID extension), 2991 generate a value for the RtpTransceiver mid property, 2992 following the guidance for "a=mid" mentioned in 2993 Section 5.2.1. 2995 * For each specified media format that is also supported by the 2996 local implementation, establish a mapping between the specified 2997 payload type and the media format, as described in [RFC3264], 2998 Section 6.1. Specifically, this means that the implementation 2999 records the payload type to be used in outgoing RTP packets 3000 when sending each specified media format, as well as the 3001 relative preference for each format that is indicated in their 3002 ordering. If any indicated media format is not supported by 3003 the local implementation, it MUST be ignored. 3005 * For each specified "rtx" media format, establish a mapping 3006 between the RTX payload type and its associated primary payload 3007 type, as described in [RFC4588], Section 4. If any referenced 3008 primary payload types are not present, this MUST result in an 3009 error. 3011 * For each specified fmtp parameter that is supported by the 3012 local implementation, enable them on the associated media 3013 formats. 3015 * For each specified RTP header extension that is also supported 3016 by the local implementation, establish a mapping between the 3017 extension ID and URI, as described in [RFC5285], Section 5. 3018 Specifically, this means that the implementation records the 3019 extension ID to be used in outgoing RTP packets when sending 3020 each specified header extension. If any indicated RTP header 3021 extension is not supported by the local implementation, it MUST 3022 be ignored. 3024 * For each specified RTCP feedback mechanism that is supported by 3025 the local implementation, enable them on the associated media 3026 formats. 3028 * For any specified "TIAS" bandwidth value, set this value as a 3029 constraint on the maximum RTP bitrate to be used when sending 3030 media, as specified in [RFC3890]. If a "TIAS" value is not 3031 present, but an "AS" value is specified, generate a "TIAS" 3032 value using this formula: 3034 TIAS = AS * 1000 * 0.95 - 50 * 40 * 8 3036 The 50 is based on 50 packets per second, the 40 is based on an 3037 estimate of total header size, the 1000 changes the unit from 3038 kbps to bps (as required by TIAS), and the 0.95 is to allocate 3039 5% to RTCP. "TIAS" is used in preference to "AS" because it 3040 provides more accurate control of bandwidth. 3042 * For any "RR" or "RS" bandwidth values, handle as specified in 3043 [RFC3556], Section 2. 3045 * Any specified "CT" bandwidth value MUST be ignored, as the 3046 meaning of this construct at the media level is not well 3047 defined. 3049 * If the media section is of type audio: 3051 + For each specified "CN" media format, enable DTX for all 3052 supported media formats with the same clockrate, as 3053 described in [RFC3389], Section 5, except for formats that 3054 have their own internal DTX mechanisms. DTX for such 3055 formats (e.g., Opus) is controlled via fmtp parameters, as 3056 discussed in Section 5.2.3.2. 3058 + For each specified "telephone-event" media format, enable 3059 DTMF transmission for all supported media formats with the 3060 same clockrate, as described in [RFC4733], Section 2.5.1.2. 3061 If the application attempts to transmit DTMF when using a 3062 media format that does not have a corresponding telephone- 3063 event format, this MUST result in an error. 3065 + For any specified "ptime" value, configure the available 3066 media formats to use the specified packet size. If the 3067 specified size is not supported for a media format, use the 3068 next closest value instead. 3070 Finally, if this description is of type "pranswer" or "answer", 3071 follow the processing defined in the Section 5.10 section below. 3073 5.10. Applying an Answer 3075 In addition to the steps mentioned above for processing a local or 3076 remote description, the following steps are performed when processing 3077 a description of type "pranswer" or "answer". 3079 For each media section, the following steps MUST be performed: 3081 o If the media section has been rejected (i.e. port is set to zero 3082 in the answer), stop any reception or transmission of media for 3083 this section, and, unless a non-rejected media section is bundled 3084 with this media section, discard any associated ICE components, as 3085 described in Section 9.2.1.3 of [RFC5245]. 3087 o If the remote DTLS fingerprint has been changed or the dtls-id has 3088 changed, tear down the DTLS connection. If a DTLS connection 3089 needs to be torn down but the answer does not indicate an ICE 3090 restart, an error MUST be generated. If an ICE restart is 3091 performed without a change in dtls-id or fingerprint, then the 3092 same DTLS connection is continued over the new ICE channel. 3094 o If no valid DTLS connection exists, prepare to start a DTLS 3095 connection, using the specified roles and fingerprints, on any 3096 underlying ICE components, once they are active. 3098 o If the media section proto value indicates use of RTP: 3100 * If the media section references any media formats, RTP header 3101 extensions, or RTCP feedback mechanisms that were not present 3102 in the corresponding media section in the offer, this indicates 3103 a negotiation problem and MUST result in an error. 3105 * If the media section has RTCP mux enabled, discard the RTCP ICE 3106 component, if one exists, and begin or continue muxing RTCP 3107 over the RTP ICE component, as specified in [RFC5761], 3108 Section 5.1.3. Otherwise, prepare to transmit RTCP over the 3109 RTCP ICE component; if no RTCP ICE component exists, because 3110 RTCP mux was previously enabled, this MUST result in an error. 3112 * If the media section has reduced-size RTCP enabled, configure 3113 the RTCP transmission for this media section to use reduced- 3114 size RTCP, as specified in [RFC5506]. 3116 * If the directional attribute in the answer is of type 3117 "sendrecv" or "sendonly", choose the media format to send as 3118 the most preferred media format from the remote description 3119 that is also present in the answer, as described in [RFC3264], 3120 Sections 6.1 and 7, and start transmitting RTP media once the 3121 underlying transport layers have been established. If a SSRC 3122 has not already been chosen for this outgoing RTP stream, 3123 choose a random one. 3125 * The payload type mapping from the remote description is used to 3126 determine payload types for the outgoing RTP streams, including 3127 the payload type for the send media format chosen above. Any 3128 RTP header extensions that were negotiated should be included 3129 in the outgoing RTP streams, using the extension mapping from 3130 the remote description; if the RID header extension has been 3131 negotiated, and RID values are specified, include the RID 3132 header extension in the outgoing RTP streams, as indicated in 3133 [I-D.ietf-mmusic-rid], Section 4. 3135 * If simulcast has been negotiated, send the number of Source RTP 3136 Streams as specified in [I-D.ietf-mmusic-sdp-simulcast], 3137 Section 6.2.2. 3139 * If the send media format chosen above has a corresponding "rtx" 3140 media format, or a FEC mechanism has been negotiated, establish 3141 a Redundancy RTP Stream with a random SSRC for each Source RTP 3142 Stream, and start or continue transmitting RTX/FEC packets as 3143 needed. 3145 * If the send media format chosen above has a corresponding "red" 3146 media format of the same clockrate, allow redundant encoding 3147 using the specified format for resiliency purposes, as 3148 discussed in [I-D.ietf-rtcweb-fec], Section 3.2. Note that 3149 unlike RTX or FEC media formats, the "red" format is 3150 transmitted on the Source RTP Stream, not the Redundancy RTP 3151 Stream. 3153 * Enable the RTCP feedback mechanisms referenced in the media 3154 section for all Source RTP Streams using the specified media 3155 formats. Specifically, begin or continue sending the requested 3156 feedback types and reacting to received feedback, as specified 3157 in [RFC4585], Section 4.2. When sending RTCP feedback, follow 3158 the rules and recommendations from 3159 [I-D.ietf-avtcore-rtp-multi-stream], Section 5.4.1 to select 3160 which SSRC to use. 3162 * If the directional attribute is of type "recvonly" or 3163 "inactive", stop transmitting all RTP media, but continue 3164 sending RTCP, as described in [RFC3264], Section 5.1. 3166 o If the media section proto value indicates use of SCTP: 3168 * If no SCTP association yet exists, prepare to initiate a SCTP 3169 association over the associated ICE component and DTLS 3170 connection, using the local SCTP port value from the local 3171 description, and the remote SCTP port value from the remote 3172 description, as described in [I-D.ietf-mmusic-sctp-sdp], 3173 Section 10.2. 3175 If the answer contains valid bundle groups, discard any ICE 3176 components for the m= sections that will be bundled onto the primary 3177 ICE components in each bundle, and begin muxing these m= sections 3178 accordingly, as described in 3179 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 8.2. 3181 If the description is of type "answer", and there are still remaining 3182 candidates in the ICE candidate pool, discard them. 3184 6. Processing RTP/RTCP 3186 When bundling, associating incoming RTP/RTCP with the proper m= 3187 section is defined in [I-D.ietf-mmusic-sdp-bundle-negotiation]. [The 3188 BUNDLE draft does not currently contain the necessary text to 3189 describe this demux, but when it does it will contain text like that 3190 contained in Appendix B.] When not bundling, the proper m= section 3191 is clear from the ICE component over which the RTP/RTCP is received. 3193 Once the proper m= section(s) are known, RTP/RTCP is delivered to the 3194 RtpTransceiver(s) associated with the m= section(s) and further 3195 processing of the RTP/RTCP is done at the RtpTransceiver level. This 3196 includes using RID [I-D.ietf-mmusic-rid] to distinguish between 3197 multiple Encoded Streams, as well as determine which Source RTP 3198 stream should be repaired by a given Redundancy RTP stream. 3200 7. Examples 3202 Note that this example section shows several SDP fragments. To 3203 format in 72 columns, some of the lines in SDP have been split into 3204 multiple lines, where leading whitespace indicates that a line is a 3205 continuation of the previous line. In addition, some blank lines 3206 have been added to improve readability but are not valid in SDP. 3208 More examples of SDP for WebRTC call flows can be found in 3209 [I-D.nandakumar-rtcweb-sdp]. 3211 7.1. Simple Example 3213 This section shows a very simple example that sets up a minimal audio 3214 / video call between two browsers and does not use trickle ICE. The 3215 example in the following section provides a more realistic example of 3216 what would happen in a normal browser to browser connection. 3218 The flow shows Alice's browser initiating the session to Bob's 3219 browser. The messages from Alice's JS to Bob's JS are assumed to 3220 flow over some signaling protocol via a web server. The JS on both 3221 Alice's side and Bob's side waits for all candidates before sending 3222 the offer or answer, so the offers and answers are complete. Trickle 3223 ICE is not used. Both Alice and Bob are using the default policy of 3224 balanced. 3226 // set up local media state 3227 AliceJS->AliceUA: create new PeerConnection 3228 AliceJS->AliceUA: addTrack with two tracks: audio and video 3229 AliceJS->AliceUA: createOffer to get offer 3230 AliceJS->AliceUA: setLocalDescription with offer 3231 AliceUA->AliceJS: multiple onicecandidate events with candidates 3233 // wait for ICE gathering to complete 3234 AliceUA->AliceJS: onicecandidate event with null candidate 3235 AliceJS->AliceUA: get |offer-A1| from pendingLocalDescription 3237 // |offer-A1| is sent over signaling protocol to Bob 3238 AliceJS->WebServer: signaling with |offer-A1| 3239 WebServer->BobJS: signaling with |offer-A1| 3241 // |offer-A1| arrives at Bob 3242 BobJS->BobUA: create a PeerConnection 3243 BobJS->BobUA: setRemoteDescription with |offer-A1| 3244 BobUA->BobJS: onaddstream event with remoteStream 3246 // Bob accepts call 3247 BobJS->BobUA: addTrack with local tracks 3248 BobJS->BobUA: createAnswer 3249 BobJS->BobUA: setLocalDescription with answer 3250 BobUA->BobJS: multiple onicecandidate events with candidates 3252 // wait for ICE gathering to complete 3253 BobUA->BobJS: onicecandidate event with null candidate 3254 BobJS->BobUA: get |answer-A1| from currentLocalDescription 3256 // |answer-A1| is sent over signaling protocol to Alice 3257 BobJS->WebServer: signaling with |answer-A1| 3258 WebServer->AliceJS: signaling with |answer-A1| 3260 // |answer-A1| arrives at Alice 3261 AliceJS->AliceUA: setRemoteDescription with |answer-A1| 3262 AliceUA->AliceJS: onaddstream event with remoteStream 3264 // media flows 3265 BobUA->AliceUA: media sent from Bob to Alice 3266 AliceUA->BobUA: media sent from Alice to Bob 3268 The SDP for |offer-A1| looks like: 3270 v=0 3271 o=- 4962303333179871722 1 IN IP4 0.0.0.0 3272 s=- 3273 t=0 0 3274 a=group:BUNDLE a1 v1 3275 a=ice-options:trickle 3276 m=audio 56500 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3277 c=IN IP4 192.0.2.1 3278 a=mid:a1 3279 a=rtcp:56501 IN IP4 192.0.2.1 3280 a=msid:47017fee-b6c1-4162-929c-a25110252400 3281 f83006c5-a0ff-4e0a-9ed9-d3e6747be7d9 3282 a=sendrecv 3283 a=rtpmap:96 opus/48000/2 3284 a=rtpmap:0 PCMU/8000 3285 a=rtpmap:8 PCMA/8000 3286 a=rtpmap:97 telephone-event/8000 3287 a=rtpmap:98 telephone-event/48000 3288 a=maxptime:120 3289 a=ice-ufrag:ETEn1v9DoTMB9J4r 3290 a=ice-pwd:OtSK0WpNtpUjkY4+86js7ZQl 3291 a=fingerprint:sha-256 3292 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3293 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3294 a=setup:actpass 3295 a=rtcp-mux 3296 a=rtcp-rsize 3297 a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3298 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3299 a=candidate:3348148302 1 udp 2113937151 192.0.2.1 56500 3300 typ host 3301 a=candidate:3348148302 2 udp 2113937151 192.0.2.1 56501 3302 typ host 3303 a=end-of-candidates 3305 m=video 56502 UDP/TLS/RTP/SAVPF 100 101 3306 c=IN IP4 192.0.2.1 3307 a=rtcp:56503 IN IP4 192.0.2.1 3308 a=mid:v1 3309 a=msid:61317484-2ed4-49d7-9eb7-1414322a7aae 3310 f30bdb4a-5db8-49b5-bcdc-e0c9a23172e0 3311 a=sendrecv 3312 a=rtpmap:100 VP8/90000 3313 a=rtpmap:101 rtx/90000 3314 a=fmtp:101 apt=100 3315 a=ice-ufrag:BGKkWnG5GmiUpdIV 3316 a=ice-pwd:mqyWsAjvtKwTGnvhPztQ9mIf 3317 a=fingerprint:sha-256 3318 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3319 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3321 a=setup:actpass 3322 a=rtcp-mux 3323 a=rtcp-rsize 3324 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid 3325 a=rtcp-fb:100 ccm fir 3326 a=rtcp-fb:100 nack 3327 a=rtcp-fb:100 nack pli 3328 a=candidate:3348148302 1 udp 2113937151 192.0.2.1 56502 3329 typ host 3330 a=candidate:3348148302 2 udp 2113937151 192.0.2.1 56503 3331 typ host 3332 a=end-of-candidates 3334 The SDP for |answer-A1| looks like: 3336 v=0 3337 o=- 6729291447651054566 1 IN IP4 0.0.0.0 3338 s=- 3339 t=0 0 3340 a=group:BUNDLE a1 v1 3341 m=audio 20000 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3342 c=IN IP4 192.0.2.2 3343 a=mid:a1 3344 a=rtcp:20000 IN IP4 192.0.2.2 3345 a=msid:PI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1 3346 PI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1a0 3347 a=sendrecv 3348 a=rtpmap:96 opus/48000/2 3349 a=rtpmap:0 PCMU/8000 3350 a=rtpmap:8 PCMA/8000 3351 a=rtpmap:97 telephone-event/8000 3352 a=rtpmap:98 telephone-event/48000 3353 a=maxptime:120 3354 a=ice-ufrag:6sFvz2gdLkEwjZEr 3355 a=ice-pwd:cOTZKZNVlO9RSGsEGM63JXT2 3356 a=fingerprint:sha-256 6B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35 3357 :DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3358 a=setup:active 3359 a=rtcp-mux 3360 a=rtcp-rsize 3361 a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3362 a=candidate:2299743422 1 udp 2113937151 192.0.2.2 20000 3363 typ host 3364 a=end-of-candidates 3366 m=video 20000 UDP/TLS/RTP/SAVPF 100 101 3367 c=IN IP4 192.0.2.2 3368 a=rtcp 20001 IN IP4 192.0.2.2 3369 a=mid:v1 3370 a=msid:PI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1 3371 PI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1v0 3372 a=sendrecv 3373 a=rtpmap:100 VP8/90000 3374 a=rtpmap:101 rtx/90000 3375 a=fmtp:101 apt=100 3376 a=fingerprint:sha-256 6B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35 3377 :DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3378 a=setup:active 3379 a=rtcp-mux 3380 a=rtcp-rsize 3381 a=rtcp-fb:100 ccm fir 3382 a=rtcp-fb:100 nack 3383 a=rtcp-fb:100 nack pli 3385 7.2. Normal Examples 3387 This section shows a typical example of a session between two 3388 browsers setting up an audio channel and a data channel. Trickle ICE 3389 is used in full trickle mode with a bundle policy of max-bundle, an 3390 RTCP mux policy of require, and a single TURN server. Later, two 3391 video flows, one for the presenter and one for screen sharing, are 3392 added to the session. This example shows Alice's browser initiating 3393 the session to Bob's browser. The messages from Alice's JS to Bob's 3394 JS are assumed to flow over some signaling protocol via a web server. 3396 // set up local media state 3397 AliceJS->AliceUA: create new PeerConnection 3398 AliceJS->AliceUA: addTrack with an audio track 3399 AliceJS->AliceUA: createDataChannel to get data channel 3400 AliceJS->AliceUA: createOffer to get |offer-B1| 3401 AliceJS->AliceUA: setLocalDescription with |offer-B1| 3403 // |offer-B1| is sent over signaling protocol to Bob 3404 AliceJS->WebServer: signaling with |offer-B1| 3405 WebServer->BobJS: signaling with |offer-B1| 3407 // |offer-B1| arrives at Bob 3408 BobJS->BobUA: create a PeerConnection 3409 BobJS->BobUA: setRemoteDescription with |offer-B1| 3410 BobUA->BobJS: onaddstream with audio track from Alice 3412 // candidates are sent to Bob 3413 AliceUA->AliceJS: onicecandidate event with |candidate-B1| (host) 3414 AliceJS->WebServer: signaling with |candidate-B1| 3415 AliceUA->AliceJS: onicecandidate event with |candidate-B2| (srflx) 3416 AliceJS->WebServer: signaling with |candidate-B2| 3418 WebServer->BobJS: signaling with |candidate-B1| 3419 BobJS->BobUA: addIceCandidate with |candidate-B1| 3420 WebServer->BobJS: signaling with |candidate-B2| 3421 BobJS->BobUA: addIceCandidate with |candidate-B2| 3423 // Bob accepts call 3424 BobJS->BobUA: addTrack with local audio 3425 BobJS->BobUA: createDataChannel to get data channel 3426 BobJS->BobUA: createAnswer to get |answer-B1| 3427 BobJS->BobUA: setLocalDescription with |answer-B1| 3429 // |answer-B1| is sent to Alice 3430 BobJS->WebServer: signaling with |answer-B1| 3431 WebServer->AliceJS: signaling with |answer-B1| 3432 AliceJS->AliceUA: setRemoteDescription with |answer-B1| 3433 AliceUA->AliceJS: onaddstream event with audio track from Bob 3435 // candidates are sent to Alice 3436 BobUA->BobJS: onicecandidate event with |candidate-B3| (host) 3437 BobJS->WebServer: signaling with |candidate-B3| 3438 BobUA->BobJS: onicecandidate event with |candidate-B4| (srflx) 3439 BobJS->WebServer: signaling with |candidate-B4| 3441 WebServer->AliceJS: signaling with |candidate-B3| 3442 AliceJS->AliceUA: addIceCandidate with |candidate-B3| 3443 WebServer->AliceJS: signaling with |candidate-B4| 3444 AliceJS->AliceUA: addIceCandidate with |candidate-B4| 3446 // data channel opens 3447 BobUA->BobJS: ondatachannel event 3448 AliceUA->AliceJS: ondatachannel event 3449 BobUA->BobJS: onopen 3450 AliceUA->AliceJS: onopen 3452 // media is flowing between browsers 3453 BobUA->AliceUA: audio+data sent from Bob to Alice 3454 AliceUA->BobUA: audio+data sent from Alice to Bob 3456 // some time later Bob adds two video streams 3457 // note, no candidates exchanged, because of bundle 3458 BobJS->BobUA: addTrack with first video stream 3459 BobJS->BobUA: addTrack with second video stream 3460 BobJS->BobUA: createOffer to get |offer-B2| 3461 BobJS->BobUA: setLocalDescription with |offer-B2| 3463 // |offer-B2| is sent to Alice 3464 BobJS->WebServer: signaling with |offer-B2| 3465 WebServer->AliceJS: signaling with |offer-B2| 3466 AliceJS->AliceUA: setRemoteDescription with |offer-B2| 3467 AliceUA->AliceJS: onaddstream event with first video stream 3468 AliceUA->AliceJS: onaddstream event with second video stream 3469 AliceJS->AliceUA: createAnswer to get |answer-B2| 3470 AliceJS->AliceUA: setLocalDescription with |answer-B2| 3472 // |answer-B2| is sent over signaling protocol to Bob 3473 AliceJS->WebServer: signaling with |answer-B2| 3474 WebServer->BobJS: signaling with |answer-B2| 3475 BobJS->BobUA: setRemoteDescription with |answer-B2| 3477 // media is flowing between browsers 3478 BobUA->AliceUA: audio+video+data sent from Bob to Alice 3479 AliceUA->BobUA: audio+video+data sent from Alice to Bob 3481 The SDP for |offer-B1| looks like: 3483 v=0 3484 o=- 4962303333179871723 1 IN IP4 0.0.0.0 3485 s=- 3486 t=0 0 3487 a=group:BUNDLE a1 d1 3488 a=ice-options:trickle 3489 m=audio 9 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3490 c=IN IP4 0.0.0.0 3491 a=rtcp:9 IN IP4 0.0.0.0 3492 a=mid:a1 3493 a=msid:57017fee-b6c1-4162-929c-a25110252400 3494 e83006c5-a0ff-4e0a-9ed9-d3e6747be7d9 3495 a=sendrecv 3496 a=rtpmap:96 opus/48000/2 3497 a=rtpmap:0 PCMU/8000 3498 a=rtpmap:8 PCMA/8000 3499 a=rtpmap:97 telephone-event/8000 3500 a=rtpmap:98 telephone-event/48000 3501 a=maxptime:120 3502 a=ice-ufrag:ATEn1v9DoTMB9J4r 3503 a=ice-pwd:AtSK0WpNtpUjkY4+86js7ZQl 3504 a=fingerprint:sha-256 3505 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3506 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3507 a=setup:actpass 3508 a=rtcp-mux 3509 a=rtcp-rsize 3510 a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3511 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3513 m=application 0 UDP/DTLS/SCTP webrtc-datachannel 3514 c=IN IP4 0.0.0.0 3515 a=bundle-only 3516 a=mid:d1 3517 a=fmtp:webrtc-datachannel max-message-size=65536 3518 a=sctp-port 5000 3519 a=fingerprint:sha-256 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3520 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3521 a=setup:actpass 3523 The SDP for |candidate-B1| looks like: 3525 candidate:109270923 1 udp 2122194687 192.168.1.2 51556 typ host 3527 The SDP for |candidate-B2| looks like: 3529 candidate:4036177503 1 udp 1685987071 11.22.33.44 52546 typ srflx 3530 raddr 192.168.1.2 rport 51556 3532 The SDP for |answer-B1| looks like: 3534 v=0 3535 o=- 7729291447651054566 1 IN IP4 0.0.0.0 3536 s=- 3537 t=0 0 3538 a=group:BUNDLE a1 d1 3539 a=ice-options:trickle 3540 m=audio 9 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3541 c=IN IP4 0.0.0.0 3542 a=rtcp:9 IN IP4 0.0.0.0 3543 a=mid:a1 3544 a=msid:QI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1 3545 QI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1a0 3546 a=sendrecv 3547 a=rtpmap:96 opus/48000/2 3548 a=rtpmap:0 PCMU/8000 3549 a=rtpmap:8 PCMA/8000 3550 a=rtpmap:97 telephone-event/8000 3551 a=rtpmap:98 telephone-event/48000 3552 a=maxptime:120 3553 a=ice-ufrag:7sFvz2gdLkEwjZEr 3554 a=ice-pwd:dOTZKZNVlO9RSGsEGM63JXT2 3555 a=fingerprint:sha-256 6B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35 3556 :DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3557 a=setup:active 3558 a=rtcp-mux 3559 a=rtcp-rsize 3560 a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3561 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3563 m=application 9 UDP/DTLS/SCTP webrtc-datachannel 3564 c=IN IP4 0.0.0.0 3565 a=mid:d1 3566 a=fmtp:webrtc-datachannel max-message-size=65536 3567 a=sctp-port 5000 3568 a=fingerprint:sha-256 6B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35 3569 :DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3570 a=setup:active 3572 The SDP for |candidate-B3| looks like: 3574 candidate:109270924 1 udp 2122194687 192.168.2.3 61665 typ host 3576 The SDP for |candidate-B4| looks like: 3578 candidate:4036177504 1 udp 1685987071 55.66.77.88 64532 typ srflx 3579 raddr 192.168.2.3 rport 61665 3581 The SDP for |offer-B2| looks like: (note the increment of the version 3582 number in the o= line, and the c= and a=rtcp lines, which indicate 3583 the local candidate that was selected) 3585 v=0 3586 o=- 7729291447651054566 2 IN IP4 0.0.0.0 3587 s=- 3588 t=0 0 3589 a=group:BUNDLE a1 d1 v1 v2 3590 a=ice-options:trickle 3591 m=audio 64532 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3592 c=IN IP4 55.66.77.88 3593 a=rtcp:64532 IN IP4 55.66.77.88 3594 a=mid:a1 3595 a=msid:QI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1 3596 QI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1a0 3597 a=sendrecv 3598 a=rtpmap:96 opus/48000/2 3599 a=rtpmap:0 PCMU/8000 3600 a=rtpmap:8 PCMA/8000 3601 a=rtpmap:97 telephone-event/8000 3602 a=rtpmap:98 telephone-event/48000 3603 a=maxptime:120 3604 a=ice-ufrag:7sFvz2gdLkEwjZEr 3605 a=ice-pwd:dOTZKZNVlO9RSGsEGM63JXT2 3606 a=fingerprint:sha-256 6B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35 3607 :DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3608 a=setup:actpass 3609 a=rtcp-mux 3610 a=rtcp-rsize 3611 a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3612 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3613 a=candidate:109270924 1 udp 2122194687 192.168.2.3 61665 typ host 3614 a=candidate:4036177504 1 udp 1685987071 55.66.77.88 64532 typ srflx 3615 raddr 192.168.2.3 rport 61665 3616 a=candidate:3671762467 1 udp 41819903 66.77.88.99 50416 typ relay 3617 raddr 55.66.77.88 rport 64532 3619 a=end-of-candidates 3621 m=application 64532 UDP/DTLS/SCTP webrtc-datachannel 3622 c=IN IP4 55.66.77.88 3623 a=mid:d1 3624 a=fmtp:webrtc-datachannel max-message-size=65536 3625 a=sctp-port 5000 3626 a=ice-ufrag:7sFvz2gdLkEwjZEr 3627 a=ice-pwd:dOTZKZNVlO9RSGsEGM63JXT2 3628 a=fingerprint:sha-256 6B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35 3629 :DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3630 a=setup:actpass 3631 a=candidate:109270924 1 udp 2122194687 192.168.2.3 61665 typ host 3632 a=candidate:4036177504 1 udp 1685987071 55.66.77.88 64532 typ srflx 3633 raddr 192.168.2.3 rport 61665 3634 a=candidate:3671762467 1 udp 41819903 66.77.88.99 50416 typ relay 3635 raddr 55.66.77.88 rport 64532 3636 a=end-of-candidates 3638 m=video 0 UDP/TLS/RTP/SAVPF 100 101 3639 c=IN IP4 55.66.77.88 3640 a=bundle-only 3641 a=rtcp:64532 IN IP4 55.66.77.88 3642 a=mid:v1 3643 a=msid:61317484-2ed4-49d7-9eb7-1414322a7aae 3644 f30bdb4a-5db8-49b5-bcdc-e0c9a23172e0 3645 a=sendrecv 3646 a=rtpmap:100 VP8/90000 3647 a=rtpmap:101 rtx/90000 3648 a=fmtp:101 apt=100 3649 a=fingerprint:sha-256 3650 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3651 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3652 a=setup:actpass 3653 a=rtcp-mux 3654 a=rtcp-rsize 3655 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3656 a=rtcp-fb:100 ccm fir 3657 a=rtcp-fb:100 nack 3658 a=rtcp-fb:100 nack pli 3660 m=video 0 UDP/TLS/RTP/SAVPF 100 101 3661 c=IN IP4 55.66.77.88 3662 a=bundle-only 3663 a=rtcp:64532 IN IP4 55.66.77.88 3664 a=mid:v1 3665 a=msid:71317484-2ed4-49d7-9eb7-1414322a7aae 3666 f30bdb4a-5db8-49b5-bcdc-e0c9a23172e0 3668 a=sendrecv 3669 a=rtpmap:100 VP8/90000 3670 a=rtpmap:101 rtx/90000 3671 a=fmtp:101 apt=100 3672 a=fingerprint:sha-256 3673 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3674 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3675 a=setup:actpass 3676 a=rtcp-mux 3677 a=rtcp-rsize 3678 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3679 a=rtcp-fb:100 ccm fir 3680 a=rtcp-fb:100 nack 3681 a=rtcp-fb:100 nack pli 3683 The SDP for |answer-B2| looks like: (note the use of setup:passive to 3684 maintain the existing DTLS roles, and the use of a=recvonly to 3685 indicate that the video streams are one-way) 3687 v=0 3688 o=- 4962303333179871723 2 IN IP4 0.0.0.0 3689 s=- 3690 t=0 0 3691 a=group:BUNDLE a1 d1 v1 v2 3692 a=ice-options:trickle 3693 m=audio 52546 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3694 c=IN IP4 11.22.33.44 3695 a=rtcp:52546 IN IP4 11.22.33.44 3696 a=mid:a1 3697 a=msid:57017fee-b6c1-4162-929c-a25110252400 3698 e83006c5-a0ff-4e0a-9ed9-d3e6747be7d9 3699 a=sendrecv 3700 a=rtpmap:96 opus/48000/2 3701 a=rtpmap:0 PCMU/8000 3702 a=rtpmap:8 PCMA/8000 3703 a=rtpmap:97 telephone-event/8000 3704 a=rtpmap:98 telephone-event/48000 3705 a=maxptime:120 3706 a=ice-ufrag:ATEn1v9DoTMB9J4r 3707 a=ice-pwd:AtSK0WpNtpUjkY4+86js7ZQl 3708 a=fingerprint:sha-256 3709 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3710 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3711 a=setup:passive 3712 a=rtcp-mux 3713 a=rtcp-rsize 3714 a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3715 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3716 a=candidate:109270923 1 udp 2122194687 192.168.1.2 51556 typ host 3717 a=candidate:4036177503 1 udp 1685987071 11.22.33.44 52546 typ srflx 3718 raddr 192.168.1.2 rport 51556 3719 a=candidate:3671762466 1 udp 41819903 22.33.44.55 61405 typ relay 3720 raddr 11.22.33.44 rport 52546 3721 a=end-of-candidates 3723 m=application 52546 UDP/DTLS/SCTP webrtc-datachannel 3724 c=IN IP4 11.22.33.44 3725 a=mid:d1 3726 a=fmtp:webrtc-datachannel max-message-size=65536 3727 a=sctp-port 5000 3728 a=fingerprint:sha-256 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3729 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3730 a=setup:passive 3732 m=video 52546 UDP/TLS/RTP/SAVPF 100 101 3733 c=IN IP4 11.22.33.44 3734 a=rtcp:52546 IN IP4 11.22.33.44 3735 a=mid:v1 3736 a=recvonly 3737 a=rtpmap:100 VP8/90000 3738 a=rtpmap:101 rtx/90000 3739 a=fmtp:101 apt=100 3740 a=fingerprint:sha-256 3741 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3742 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3743 a=setup:passive 3744 a=rtcp-mux 3745 a=rtcp-rsize 3746 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3747 a=rtcp-fb:100 ccm fir 3748 a=rtcp-fb:100 nack 3749 a=rtcp-fb:100 nack pli 3751 m=video 52546 UDP/TLS/RTP/SAVPF 100 101 3752 c=IN IP4 11.22.33.44 3753 a=rtcp:52546 IN IP4 11.22.33.44 3754 a=mid:v2 3755 a=recvonly 3756 a=rtpmap:100 VP8/90000 3757 a=rtpmap:101 rtx/90000 3758 a=fmtp:101 apt=100 3759 a=fingerprint:sha-256 3760 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3761 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3763 a=setup:passive 3764 a=rtcp-mux 3765 a=rtcp-rsize 3766 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3767 a=rtcp-fb:100 ccm fir 3768 a=rtcp-fb:100 nack 3769 a=rtcp-fb:100 nack pli 3771 8. Security Considerations 3773 The IETF has published separate documents 3774 [I-D.ietf-rtcweb-security-arch] [I-D.ietf-rtcweb-security] describing 3775 the security architecture for WebRTC as a whole. The remainder of 3776 this section describes security considerations for this document. 3778 While formally the JSEP interface is an API, it is better to think of 3779 it is an Internet protocol, with the JS being untrustworthy from the 3780 perspective of the browser. Thus, the threat model of [RFC3552] 3781 applies. In particular, JS can call the API in any order and with 3782 any inputs, including malicious ones. This is particularly relevant 3783 when we consider the SDP which is passed to setLocalDescription(). 3784 While correct API usage requires that the application pass in SDP 3785 which was derived from createOffer() or createAnswer(), there is no 3786 guarantee that applications do so. The browser MUST be prepared for 3787 the JS to pass in bogus data instead. 3789 Conversely, the application programmer MUST recognize that the JS 3790 does not have complete control of browser behavior. One case that 3791 bears particular mention is that editing ICE candidates out of the 3792 SDP or suppressing trickled candidates does not have the expected 3793 behavior: implementations will still perform checks from those 3794 candidates even if they are not sent to the other side. Thus, for 3795 instance, it is not possible to prevent the remote peer from learning 3796 your public IP address by removing server reflexive candidates. 3797 Applications which wish to conceal their public IP address should 3798 instead configure the ICE agent to use only relay candidates. 3800 9. IANA Considerations 3802 This document requires no actions from IANA. 3804 10. Acknowledgements 3806 Significant text incorporated in the draft as well and review was 3807 provided by Peter Thatcher, Taylor Brandstetter, Harald Alvestrand 3808 and Suhas Nandakumar. Dan Burnett, Neil Stratford, Anant Narayanan, 3809 Andrew Hutton, Richard Ejzak, Adam Bergkvist and Matthew Kaufman all 3810 provided valuable feedback on this proposal. 3812 11. References 3814 11.1. Normative References 3816 [I-D.ietf-avtcore-rtp-multi-stream] 3817 Lennox, J., Westerlund, M., Wu, Q., and C. Perkins, 3818 "Sending Multiple RTP Streams in a Single RTP Session", 3819 draft-ietf-avtcore-rtp-multi-stream-11 (work in progress), 3820 December 2015. 3822 [I-D.ietf-avtext-rid] 3823 Roach, A., Nandakumar, S., and P. Thatcher, "RTP Stream 3824 Identifier (RID) Source Description (SDES)", draft-ietf- 3825 avtext-rid-00 (work in progress), February 2016. 3827 [I-D.ietf-ice-trickle] 3828 Ivov, E., Rescorla, E., Uberti, J., and P. Saint-Andre, 3829 "Trickle ICE: Incremental Provisioning of Candidates for 3830 the Interactive Connectivity Establishment (ICE) 3831 Protocol". 3833 [I-D.ietf-mmusic-4572-update] 3834 Holmberg, C., "Updates to RFC 4572", draft-ietf-mmusic- 3835 4572-update-05 (work in progress), June 2016. 3837 [I-D.ietf-mmusic-dtls-sdp] 3838 Holmberg, C. and R. Shpount, "Using the SDP Offer/Answer 3839 Mechanism for DTLS", draft-ietf-mmusic-dtls-sdp-14 (work 3840 in progress), July 2016. 3842 [I-D.ietf-mmusic-msid] 3843 Alvestrand, H., "Cross Session Stream Identification in 3844 the Session Description Protocol", draft-ietf-mmusic- 3845 msid-01 (work in progress), August 2013. 3847 [I-D.ietf-mmusic-mux-exclusive] 3848 Holmberg, C., "Indicating Exclusive Support of RTP/RTCP 3849 Multiplexing using SDP", draft-ietf-mmusic-mux- 3850 exclusive-08 (work in progress), June 2016. 3852 [I-D.ietf-mmusic-rid] 3853 Thatcher, P., Zanaty, M., Nandakumar, S., Burman, B., 3854 Roach, A., and B. Campen, "RTP Payload Format 3855 Constraints", draft-ietf-mmusic-rid-04 (work in progress), 3856 February 2016. 3858 [I-D.ietf-mmusic-sctp-sdp] 3859 Loreto, S. and G. Camarillo, "Stream Control Transmission 3860 Protocol (SCTP)-Based Media Transport in the Session 3861 Description Protocol (SDP)", draft-ietf-mmusic-sctp-sdp-04 3862 (work in progress), June 2013. 3864 [I-D.ietf-mmusic-sdp-bundle-negotiation] 3865 Holmberg, C., Alvestrand, H., and C. Jennings, 3866 "Multiplexing Negotiation Using Session Description 3867 Protocol (SDP) Port Numbers", draft-ietf-mmusic-sdp- 3868 bundle-negotiation-04 (work in progress), June 2013. 3870 [I-D.ietf-mmusic-sdp-mux-attributes] 3871 Nandakumar, S., "A Framework for SDP Attributes when 3872 Multiplexing", draft-ietf-mmusic-sdp-mux-attributes-01 3873 (work in progress), February 2014. 3875 [I-D.ietf-mmusic-sdp-simulcast] 3876 Burman, B., Westerlund, M., Nandakumar, S., and M. Zanaty, 3877 "Using Simulcast in SDP and RTP Sessions", draft-ietf- 3878 mmusic-sdp-simulcast-04 (work in progress), February 2016. 3880 [I-D.ietf-rtcweb-audio] 3881 Valin, J. and C. Bran, "WebRTC Audio Codec and Processing 3882 Requirements", draft-ietf-rtcweb-audio-02 (work in 3883 progress), August 2013. 3885 [I-D.ietf-rtcweb-fec] 3886 Uberti, J., "WebRTC Forward Error Correction 3887 Requirements", draft-ietf-rtcweb-fec-00 (work in 3888 progress), February 2015. 3890 [I-D.ietf-rtcweb-rtp-usage] 3891 Perkins, C., Westerlund, M., and J. Ott, "Web Real-Time 3892 Communication (WebRTC): Media Transport and Use of RTP", 3893 draft-ietf-rtcweb-rtp-usage-09 (work in progress), 3894 September 2013. 3896 [I-D.ietf-rtcweb-security] 3897 Rescorla, E., "Security Considerations for WebRTC", draft- 3898 ietf-rtcweb-security-06 (work in progress), January 2014. 3900 [I-D.ietf-rtcweb-security-arch] 3901 Rescorla, E., "WebRTC Security Architecture", draft-ietf- 3902 rtcweb-security-arch-09 (work in progress), February 2014. 3904 [I-D.ietf-rtcweb-video] 3905 Roach, A., "WebRTC Video Processing and Codec 3906 Requirements", draft-ietf-rtcweb-video-00 (work in 3907 progress), July 2014. 3909 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 3910 Requirement Levels", BCP 14, RFC 2119, March 1997. 3912 [RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, 3913 A., Peterson, J., Sparks, R., Handley, M., and E. 3914 Schooler, "SIP: Session Initiation Protocol", RFC 3261, 3915 June 2002. 3917 [RFC3264] Rosenberg, J. and H. Schulzrinne, "An Offer/Answer Model 3918 with Session Description Protocol (SDP)", RFC 3264, June 3919 2002. 3921 [RFC3552] Rescorla, E. and B. Korver, "Guidelines for Writing RFC 3922 Text on Security Considerations", BCP 72, RFC 3552, July 3923 2003. 3925 [RFC3605] Huitema, C., "Real Time Control Protocol (RTCP) attribute 3926 in Session Description Protocol (SDP)", RFC 3605, October 3927 2003. 3929 [RFC3890] Westerlund, M., "A Transport Independent Bandwidth 3930 Modifier for the Session Description Protocol (SDP)", 3931 RFC 3890, DOI 10.17487/RFC3890, September 2004, 3932 . 3934 [RFC4145] Yon, D. and G. Camarillo, "TCP-Based Media Transport in 3935 the Session Description Protocol (SDP)", RFC 4145, 3936 September 2005. 3938 [RFC4566] Handley, M., Jacobson, V., and C. Perkins, "SDP: Session 3939 Description Protocol", RFC 4566, July 2006. 3941 [RFC4572] Lennox, J., "Connection-Oriented Media Transport over the 3942 Transport Layer Security (TLS) Protocol in the Session 3943 Description Protocol (SDP)", RFC 4572, July 2006. 3945 [RFC4585] Ott, J., Wenger, S., Sato, N., Burmeister, C., and J. Rey, 3946 "Extended RTP Profile for Real-time Transport Control 3947 Protocol (RTCP)-Based Feedback (RTP/AVPF)", RFC 4585, July 3948 2006. 3950 [RFC5245] Rosenberg, J., "Interactive Connectivity Establishment 3951 (ICE): A Protocol for Network Address Translator (NAT) 3952 Traversal for Offer/Answer Protocols", RFC 5245, April 3953 2010. 3955 [RFC5285] Singer, D. and H. Desineni, "A General Mechanism for RTP 3956 Header Extensions", RFC 5285, July 2008. 3958 [RFC5761] Perkins, C. and M. Westerlund, "Multiplexing RTP Data and 3959 Control Packets on a Single Port", RFC 5761, April 2010. 3961 [RFC5888] Camarillo, G. and H. Schulzrinne, "The Session Description 3962 Protocol (SDP) Grouping Framework", RFC 5888, June 2010. 3964 [RFC6236] Johansson, I. and K. Jung, "Negotiation of Generic Image 3965 Attributes in the Session Description Protocol (SDP)", 3966 RFC 6236, May 2011. 3968 [RFC6347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 3969 Security Version 1.2", RFC 6347, January 2012. 3971 [RFC6904] Lennox, J., "Encryption of Header Extensions in the Secure 3972 Real-time Transport Protocol (SRTP)", RFC 6904, April 3973 2013. 3975 [RFC7850] Nandakumar, S., "Registering Values of the SDP 'proto' 3976 Field for Transporting RTP Media over TCP under Various 3977 RTP Profiles", RFC 7850, DOI 10.17487/RFC7850, April 2016, 3978 . 3980 11.2. Informative References 3982 [I-D.ietf-rtcweb-ip-handling] 3983 Uberti, J. and G. Shieh, "WebRTC IP Address Handling 3984 Recommendations", draft-ietf-rtcweb-ip-handling-01 (work 3985 in progress), March 2016. 3987 [I-D.nandakumar-rtcweb-sdp] 3988 Nandakumar, S. and C. Jennings, "SDP for the WebRTC", 3989 draft-nandakumar-rtcweb-sdp-02 (work in progress), July 3990 2013. 3992 [RFC3389] Zopf, R., "Real-time Transport Protocol (RTP) Payload for 3993 Comfort Noise (CN)", RFC 3389, September 2002. 3995 [RFC3550] Schulzrinne, H., Casner, S., Frederick, R., and V. 3996 Jacobson, "RTP: A Transport Protocol for Real-Time 3997 Applications", STD 64, RFC 3550, DOI 10.17487/RFC3550, 3998 July 2003, . 4000 [RFC3556] Casner, S., "Session Description Protocol (SDP) Bandwidth 4001 Modifiers for RTP Control Protocol (RTCP) Bandwidth", 4002 RFC 3556, July 2003. 4004 [RFC3960] Camarillo, G. and H. Schulzrinne, "Early Media and Ringing 4005 Tone Generation in the Session Initiation Protocol (SIP)", 4006 RFC 3960, December 2004. 4008 [RFC4568] Andreasen, F., Baugher, M., and D. Wing, "Session 4009 Description Protocol (SDP) Security Descriptions for Media 4010 Streams", RFC 4568, July 2006. 4012 [RFC4588] Rey, J., Leon, D., Miyazaki, A., Varsa, V., and R. 4013 Hakenberg, "RTP Retransmission Payload Format", RFC 4588, 4014 July 2006. 4016 [RFC4733] Schulzrinne, H. and T. Taylor, "RTP Payload for DTMF 4017 Digits, Telephony Tones, and Telephony Signals", RFC 4733, 4018 DOI 10.17487/RFC4733, December 2006, 4019 . 4021 [RFC5506] Johansson, I. and M. Westerlund, "Support for Reduced-Size 4022 Real-Time Transport Control Protocol (RTCP): Opportunities 4023 and Consequences", RFC 5506, April 2009. 4025 [RFC5576] Lennox, J., Ott, J., and T. Schierl, "Source-Specific 4026 Media Attributes in the Session Description Protocol 4027 (SDP)", RFC 5576, June 2009. 4029 [RFC5763] Fischl, J., Tschofenig, H., and E. Rescorla, "Framework 4030 for Establishing a Secure Real-time Transport Protocol 4031 (SRTP) Security Context Using Datagram Transport Layer 4032 Security (DTLS)", RFC 5763, May 2010. 4034 [RFC5764] McGrew, D. and E. Rescorla, "Datagram Transport Layer 4035 Security (DTLS) Extension to Establish Keys for the Secure 4036 Real-time Transport Protocol (SRTP)", RFC 5764, May 2010. 4038 [RFC6464] Lennox, J., Ed., Ivov, E., and E. Marocco, "A Real-time 4039 Transport Protocol (RTP) Header Extension for Client-to- 4040 Mixer Audio Level Indication", RFC 6464, 4041 DOI 10.17487/RFC6464, December 2011, 4042 . 4044 [RFC7656] Lennox, J., Gross, K., Nandakumar, S., Salgueiro, G., and 4045 B. Burman, Ed., "A Taxonomy of Semantics and Mechanisms 4046 for Real-Time Transport Protocol (RTP) Sources", RFC 7656, 4047 DOI 10.17487/RFC7656, November 2015, 4048 . 4050 [W3C.WD-webrtc-20140617] 4051 Bergkvist, A., Burnett, D., Narayanan, A., and C. 4052 Jennings, "WebRTC 1.0: Real-time Communication Between 4053 Browsers", World Wide Web Consortium WD WD-webrtc- 4054 20140617, June 2014, 4055 . 4057 Appendix A. Appendix A 4059 For the syntax validation performed in Section 5.7, the following 4060 list of ABNF definitions is used: 4062 +-----------------------+-------------------------------------------+ 4063 | Attribute | Reference | 4064 +-----------------------+-------------------------------------------+ 4065 | ptime | [RFC4566] Section 9 | 4066 | maxptime | [RFC4566] Section 9 | 4067 | rtpmap | [RFC4566] Section 9 | 4068 | recvonly | [RFC4566] Section 9 | 4069 | sendrecv | [RFC4566] Section 9 | 4070 | sendonly | [RFC4566] Section 9 | 4071 | inactive | [RFC4566] Section 9 | 4072 | framerate | [RFC4566] Section 9 | 4073 | fmtp | [RFC4566] Section 9 | 4074 | quality | [RFC4566] Section 9 | 4075 | rtcp | [RFC3605] Section 2.1 | 4076 | setup | [RFC4145] Sections 3, 4, and 5 | 4077 | connection | [RFC4145] Sections 3, 4, and 5 | 4078 | fingerprint | [RFC4572] Section 5 | 4079 | rtcp-fb | [RFC4585] Section 4.2 | 4080 | candidate | [RFC5245] Section 15.1 | 4081 | remote-candidates | [RFC5245] Section 15.2 | 4082 | ice-lite | [RFC5245] Section 15.3 | 4083 | ice-ufrag | [RFC5245] Section 15.4 | 4084 | ice-pwd | [RFC5245] Section 15.4 | 4085 | ice-options | [RFC5245] Section 15.5 | 4086 | extmap | [RFC5285] Section 7 | 4087 | mid | [RFC5888] Section 4 and 5 | 4088 | group | [RFC5888] Section 4 and 5 | 4089 | imageattr | [RFC6236] Section 3.1 | 4090 | extmap (encrypt | [RFC6904] Section 4 | 4091 | option) | | 4092 | msid | [I-D.ietf-mmusic-msid] Section 2 | 4093 | rid | [I-D.ietf-mmusic-rid] Section 10 | 4094 | simulcast | [I-D.ietf-mmusic-sdp-simulcast]Section | 4095 | | 6.1 | 4096 | dtls-id | [I-D.ietf-mmusic-dtls-sdp]Section 4 | 4097 +-----------------------+-------------------------------------------+ 4099 Table 1: SDP ABNF References 4101 Appendix B. Appendix B 4103 The following text is meant to completely replace section 4104 "Associating RTP/RTCP Streams With Correct SDP Media Description" of 4105 [I-D.ietf-mmusic-sdp-bundle-negotiation]. 4107 As described in [RFC3550], RTP/RTCP packets are associated with RTP 4108 streams as defined in [RFC7656]. Each RTP stream is identified by an 4109 SSRC value, and each RTP/RTCP packet carries an SSRC value that is 4110 used to associate the packet with the correct RTP stream. An RTCP 4111 packet can carry multiple SSRC values, and might therefore be 4112 associated with multiple RTP streams. 4114 In order to be able to process received RTP/RTCP packets correctly it 4115 must be possible to associate an RTP stream with the correct "m=" 4116 line, as the "m=" line and SDP attributes associated with the "m=" 4117 line contain information needed to process the packets. 4119 As all RTP streams associated with a BUNDLE group use the same 4120 address:port combination for sending and receiving RTP/RTCP packets, 4121 the local address:port combination cannot be used to associate an RTP 4122 stream with the correct "m=" line. In addition, multiple RTP streams 4123 might be associated with the same "m=" line. 4125 An offerer and answerer can inform each other which SSRC values they 4126 will use for an RTP stream by using the SDP 'ssrc' attribute 4127 [RFC5576]. However, an offerer will not know which SSRC values the 4128 answerer will use until the offerer has received the answer providing 4129 that information. Due to this, before the offerer has received the 4130 answer, the offerer will not be able to associate an RTP stream with 4131 the correct "m=" line using the SSRC value associated with the RTP 4132 stream. In addition, the offerer and answerer may start using new 4133 SSRC values mid-session, without informing each other using the SDP 4134 'ssrc' attribute. 4136 In order for an offerer and answerer to always be able to associate 4137 an RTP stream with the correct "m=" line, the offerer and answerer 4138 using the BUNDLE extension MUST support the mechanism defined in 4139 [I-D.ietf-mmusic-sdp-bundle-negotiation] section 14. where the 4140 offerer and answerer insert the identification-tag associated with an 4141 "m=" line (provided by the remote peer) into RTP and RTCP packets 4142 associated with a BUNDLE group. 4144 The mapping from an SSRC to an identification-tag is carried in RTCP 4145 SDES packets or in RTP header extensions 4146 ([I-D.ietf-mmusic-sdp-bundle-negotiation] section 14). Since a 4147 compound RTCP packet can contain multiple RTCP SDES packets, and each 4148 RTCP SDES packet can contain multiple chunks, an RTCP packet can 4149 contain several SSRC to identification-tag mappings. The offerer and 4150 answerer maintain tables used for routing that are updated each time 4151 an RTP/RTCP packet contains new information that affects how packets 4152 should be routed. 4154 To prepare for demultiplexing RTP packets to the correct "m=" line, 4155 the following steps MUST be followed for each BUNDLE group. 4157 Construct a table mapping MID to "m=" line for each "m=" line in 4158 this BUNDLE group. Note that an "m=" line may only have one MID. 4160 Construct a table mapping incoming SSRC to "m=" line for each "m=" 4161 line in this BUNDLE group and for each SSRC configured for 4162 receiving in that "m=" line. 4164 Construct a table mapping outgoing SSRC to "m=line" for each "m=" 4165 line in this BUNDLE group and for each SSRC configured for sending 4166 in that "m=" line. 4168 Construct a table mapping payload type to "m=" line for each "m=" 4169 line in the BUNDLE group and for each payload type configured for 4170 receiving in that "m=" line. If any payload type is configured 4171 for receiving in more than one "m=" line in the BUNDLE group, do 4172 not it include it in the table. 4174 Note that for each of these tables, there can only be one mapping 4175 for any given key (MID, SSRC, or PT). In other words, the tables 4176 are not multimaps. 4178 As "m=" lines are added or removed from the BUNDLE groups, or their 4179 configurations are changed, the tables above MUST also be updated. 4181 For each RTP packet received, the following steps MUST be followed to 4182 route the packet to the correct "m=" section within a BUNDLE group. 4183 Note that the phrase 'deliver a packet to the "m=" line' means to 4184 further process the packet as would normally happen with RTP/RTCP, if 4185 it were received on a transport associated with that "m=" line 4186 outside of a BUNDLE group (i.e., if the "m=" line were not BUNDLEd), 4187 including dropping an RTP packet if the packet's PT does not match 4188 any PT in the "m=" line. 4190 If the packet has a MID and that MID is not in the table mapping 4191 MID to "m=" line, drop the packet and stop. 4193 If the packet has a MID and that MID is in the table mapping MID 4194 to "m=" line, update the incoming SSRC mapping table to include an 4195 entry that maps the packet's SSRC to the "m=" line for that MID. 4197 If the packet's SSRC is in the incoming SSRC mapping table, route 4198 the packet to the associated "m=" line and stop. 4200 If the packet's payload type is in the payload type table, update 4201 the the incoming SSRC mapping table to include an entry that maps 4202 the packet's SSRC to the "m=" line for that payload type. In 4203 addition, route the packet to the associated "m=" line and stop. 4205 Otherwise, drop the packet. 4207 For each RTCP packet received (including each RTCP packet that is 4208 part of a compound RTCP packet), the packet MUST be routed to the 4209 appropriate handler for the SSRCs it contains information about. 4210 Some examples of such handling are given below. 4212 If the packet is of type SR, and the sender SSRC for the packet is 4213 found in the incoming SSRC table, deliver a copy of the packet to 4214 the "m=" line associated with that SSRC. In addition, for each 4215 report block in the report whose SSRC is found in the outgoing 4216 SSRC table, deliver a copy of the RTCP packet to the "m=" line 4217 associated with that SSRC. 4219 If the packet is of type RR, for each report block in the packet 4220 whose SSRC is found in the outgoing SSRC table, deliver a copy of 4221 the RTCP packet to the "m=" line associated with that SSRC. 4223 If the packet is of type SDES, and the sender SSRC for the packet 4224 is found in the incoming SSRC table, deliver the packet to the 4225 "m=" line associated with that SSRC. In addition, for each chunk 4226 in the packet that contains a MID that is in the table mapping MID 4227 to "m=" line, update the incoming SSRC mapping table to include an 4228 entry that maps the SSRC for that chunk to the "m=" line 4229 associated with that MID. (This case can occur when RTCP for a 4230 source is received before any RTP packets.) 4232 If the packet is of type BYE, for each SSRC indicated in the 4233 packet that is found in the incoming SSRC table, deliver a copy of 4234 the packet to the "m=" line associated with that SSRC. 4236 If the packet is of type RTPFB or PSFB, as defined in [RFC4585], 4237 and the media source SSRC for the packet is found in the outgoing 4238 SSRC table, deliver the packet to the "m=" line associated with 4239 that SSRC. 4241 Appendix C. Change log 4243 Note: This section will be removed by RFC Editor before publication. 4245 Changes in draft-18: 4247 o Update demux algorithm and move it to an appendix in preparation 4248 for merging it into BUNDLE. 4250 o Clarify why we can't handle an incoming offer to send simulcast. 4252 o Expand IceCandidate object text. 4254 o Further document use of ICE candidate pool. 4256 o Document removeTrack. 4258 o Update requirements to only accept the last generated offer/answer 4259 as an argument to setLocalDescription. 4261 o Allow round pixels. 4263 o Fix code around default timing when AVPF is not specified. 4265 o Clean up terminology around m= line and m=section. 4267 o Provide a more realistic example for minimum decoder capabilities. 4269 o Document behavior when rtcp-mux policy is require but rtcp-mux 4270 attribute not provided. 4272 o Expanded discussion of RtpSender and RtpReceiver. 4274 o Add RtpTransceiver.currentDirection and document setDirection. 4276 o Require imageattr x=0, y=0 to indicate that there are no valid 4277 resolutions. 4279 o Require a privacy-preserving MID/RID construction. 4281 o Require support for RFC 3556 bandwidth modifiers. 4283 o Update maxptime description. 4285 o Note that endpoints may encounter extra codecs in answers and 4286 subsequent offers from non-JSEP peers. 4288 o Update references. 4290 Changes in draft-17: 4292 o Split createOffer and createAnswer sections to clearly indicate 4293 attributes which always appear and which only appear when not 4294 bundled into another m= section. 4296 o Add descriptions of RtpTransceiver methods. 4298 o Describe how to process RTCP feedback attributes. 4300 o Clarify transceiver directions and their interaction with 3264. 4302 o Describe setCodecPreferences. 4304 o Update RTP demux algorithm. Include RTCP. 4306 o Update requirements for when a=rtcp is included, limiting to cases 4307 where it is needed for backward compatibility. 4309 o Clarify SAR handling. 4311 o Updated addTrack matching algorithm. 4313 o Remove a=ssrc requirements. 4315 o Handle a=setup in reoffers. 4317 o Discuss how RTX/FEC should be handled. 4319 o Discuss how telephone-event should be handled. 4321 o Discuss how CN/DTX should be handled. 4323 o Add missing references to ABNF table. 4325 Changes in draft-16: 4327 o Update addIceCandidate to indicate ICE generation and allow per-m= 4328 section end-of-candidates. 4330 o Update fingerprint handling to use draft-ietf-mmusic-4572-update. 4332 o Update text around SDP processing of RTP header extensions and 4333 payload formats. 4335 o Add sections on simulcast, addTransceiver, and createDataChannel. 4337 o Clarify text to ensure that the session ID is a positive 63 bit 4338 integer. 4340 o Clarify SDP processing for direction indication. 4342 o Describe SDP processing for rtcp-mux-only. 4344 o Specify how SDP session version in o= line. 4346 o Require that when doing an re-offer, the capabilities of the new 4347 session are mostly required to be a subset of the previously 4348 negotiated session. 4350 o Clarified ICE restart interaction with bundle-only. 4352 o Remove support for changing SDP before calling 4353 setLocalDescription. 4355 o Specify algorithm for demuxing RTP based on MID, PT, and SSRC. 4357 o Clarify rules for rejecting m= lines when bundle policy is 4358 balanced or max-bundle. 4360 Changes in draft-15: 4362 o Clarify text around codecs offered in subsequent transactions to 4363 refer to what's been negotiated. 4365 o Rewrite LS handling text to indicate edge cases and that we're 4366 living with them. 4368 o Require that answerer reject m= lines when there are no codecs in 4369 common. 4371 o Enforce max-bundle on offer processing. 4373 o Fix TIAS formula to handle bits vs. kilobits. 4375 o Describe addTrack algorithm. 4377 o Clean up references. 4379 Changes in draft-14: 4381 o Added discussion of RtpTransceivers + RtpSenders + RtpReceivers, 4382 and how they interact with createOffer/createAnswer. 4384 o Removed obsolete OfferToReceiveX options. 4386 o Explained how addIceCandidate can be used for end-of-candidates. 4388 Changes in draft-13: 4390 o Clarified which SDP lines can be ignored. 4392 o Clarified how to handle various received attributes. 4394 o Revised how attributes should be generated for bundled m= lines. 4396 o Remove unused references. 4398 o Remove text advocating use of unilateral PTs. 4400 o Trigger an ICE restart even if the ICE candidate policy is being 4401 made more strict. 4403 o Remove the 'public' ICE candidate policy. 4405 o Move open issues into GitHub issues. 4407 o Split local/remote description accessors into current/pending. 4409 o Clarify a=imageattr handling. 4411 o Add more detail on VoiceActivityDetection handling. 4413 o Reference draft-shieh-rtcweb-ip-handling. 4415 o Make it clear when an ICE restart should occur. 4417 o Resolve changes needed in references. 4419 o Remove MSID semantics. 4421 o ice-options are now at session level. 4423 o Default RTCP mux policy is now 'require'. 4425 Changes in draft-12: 4427 o Filled in sections on applying local and remote descriptions. 4429 o Discussed downscaling and upscaling to fulfill imageattr 4430 requirements. 4432 o Updated what SDP can be modified by the application. 4434 o Updated to latest datachannel SDP. 4436 o Allowed multiple fingerprint lines. 4438 o Switched back to IPv4 for dummy candidates. 4440 o Added additional clarity on ICE default candidates. 4442 Changes in draft-11: 4444 o Clarified handling of RTP CNAMEs. 4446 o Updated what SDP lines should be processed or ignored. 4448 o Specified how a=imageattr should be used. 4450 Changes in draft-10: 4452 o Described video size negotiation with imageattr. 4454 o Clarified rejection of sections that do not have mux-only. 4456 o Add handling of LS groups 4458 Changes in draft-09: 4460 o Don't return null for {local,remote}Description after close(). 4462 o Changed TCP/TLS to UDP/DTLS in RTP profile names. 4464 o Separate out bundle and mux policy. 4466 o Added specific references to FEC mechanisms. 4468 o Added canTrickle mechanism. 4470 o Added section on subsequent answers and, answer options. 4472 o Added text defining set{Local,Remote}Description behavior. 4474 Changes in draft-08: 4476 o Added new example section and removed old examples in appendix. 4478 o Fixed field handling. 4480 o Added text describing a=rtcp attribute. 4482 o Reworked handling of OfferToReceiveAudio and OfferToReceiveVideo 4483 per discussion at IETF 90. 4485 o Reworked trickle ICE handling and its impact on m= and c= lines 4486 per discussion at interim. 4488 o Added max-bundle-and-rtcp-mux policy. 4490 o Added description of maxptime handling. 4492 o Updated ICE candidate pool default to 0. 4494 o Resolved open issues around AppID/receiver-ID. 4496 o Reworked and expanded how changes to the ICE configuration are 4497 handled. 4499 o Some reference updates. 4501 o Editorial clarification. 4503 Changes in draft-07: 4505 o Expanded discussion of VAD and Opus DTX. 4507 o Added a security considerations section. 4509 o Rewrote the section on modifying SDP to require implementations to 4510 clearly indicate whether any given modification is allowed. 4512 o Clarified impact of IceRestart on CreateOffer in local-offer 4513 state. 4515 o Guidance on whether attributes should be defined at the media 4516 level or the session level. 4518 o Renamed "default" bundle policy to "balanced". 4520 o Removed default ICE candidate pool size and clarify how it works. 4522 o Defined a canonical order for assignment of MSTs to m= lines. 4524 o Removed discussion of rehydration. 4526 o Added Eric Rescorla as a draft editor. 4528 o Cleaned up references. 4530 o Editorial cleanup 4532 Changes in draft-06: 4534 o Reworked handling of m= line recycling. 4536 o Added handling of BUNDLE and bundle-only. 4538 o Clarified handling of rollback. 4540 o Added text describing the ICE Candidate Pool and its behavior. 4542 o Allowed OfferToReceiveX to create multiple recvonly m= sections. 4544 Changes in draft-05: 4546 o Fixed several issues identified in the createOffer/Answer sections 4547 during document review. 4549 o Updated references. 4551 Changes in draft-04: 4553 o Filled in sections on createOffer and createAnswer. 4555 o Added SDP examples. 4557 o Fixed references. 4559 Changes in draft-03: 4561 o Added text describing relationship to W3C specification 4563 Changes in draft-02: 4565 o Converted from nroff 4567 o Removed comparisons to old approaches abandoned by the working 4568 group 4570 o Removed stuff that has moved to W3C specification 4572 o Align SDP handling with W3C draft 4574 o Clarified section on forking. 4576 Changes in draft-01: 4578 o Added diagrams for architecture and state machine. 4580 o Added sections on forking and rehydration. 4582 o Clarified meaning of "pranswer" and "answer". 4584 o Reworked how ICE restarts and media directions are controlled. 4586 o Added list of parameters that can be changed in a description. 4588 o Updated suggested API and examples to match latest thinking. 4590 o Suggested API and examples have been moved to an appendix. 4592 Changes in draft -00: 4594 o Migrated from draft-uberti-rtcweb-jsep-02. 4596 Authors' Addresses 4598 Justin Uberti 4599 Google 4600 747 6th St S 4601 Kirkland, WA 98033 4602 USA 4604 Email: justin@uberti.name 4606 Cullen Jennings 4607 Cisco 4608 400 3rd Avenue SW 4609 Calgary, AB T2P 4H2 4610 Canada 4612 Email: fluffy@iii.ca 4614 Eric Rescorla (editor) 4615 Mozilla 4616 331 Evelyn Ave 4617 Mountain View, CA 94041 4618 USA 4620 Email: ekr@rtfm.com