idnits 2.17.1 draft-ietf-rtcweb-jsep-14.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 is 1 instance of too long lines in the document, the longest one being 5 characters in excess of 72. == 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 (March 21, 2016) is 2957 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 747 == Outdated reference: A later version (-17) exists of draft-ietf-mmusic-msid-01 == 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 (-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 -- No information found for draft-nandakumar-mmusic-proto-iana-registration - is the name correct? -- Possible downref: Normative reference to a draft: ref. 'I-D.nandakumar-mmusic-proto-iana-registration' ** 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 (-09) exists of draft-ietf-avtext-rid-00 == Outdated reference: A later version (-15) exists of draft-ietf-mmusic-rid-04 == Outdated reference: A later version (-14) exists of draft-ietf-mmusic-sdp-simulcast-04 == Outdated reference: A later version (-08) exists of draft-nandakumar-rtcweb-sdp-02 Summary: 6 errors (**), 0 flaws (~~), 17 warnings (==), 5 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: September 22, 2016 Cisco 6 E. Rescorla, Ed. 7 Mozilla 8 March 21, 2016 10 Javascript Session Establishment Protocol 11 draft-ietf-rtcweb-jsep-14 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 September 22, 2016. 37 Copyright Notice 39 Copyright (c) 2016 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 . . . . . . . . . . . . . . . . . . . . . . . . 3 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 . . . . . . . . . . . . . . . . . 14 73 3.6.1. Creating an imageattr Attribute . . . . . . . . . . . 14 74 3.6.2. Interpreting an imageattr Attribute . . . . . . . . . 15 75 3.7. Interactions With Forking . . . . . . . . . . . . . . . . 17 76 3.7.1. Sequential Forking . . . . . . . . . . . . . . . . . 17 77 3.7.2. Parallel Forking . . . . . . . . . . . . . . . . . . 18 78 4. Interface . . . . . . . . . . . . . . . . . . . . . . . . . . 18 79 4.1. Methods . . . . . . . . . . . . . . . . . . . . . . . . . 19 80 4.1.1. Constructor . . . . . . . . . . . . . . . . . . . . . 19 81 4.1.2. createOffer . . . . . . . . . . . . . . . . . . . . . 21 82 4.1.3. createAnswer . . . . . . . . . . . . . . . . . . . . 22 83 4.1.4. SessionDescriptionType . . . . . . . . . . . . . . . 22 84 4.1.4.1. Use of Provisional Answers . . . . . . . . . . . 23 85 4.1.4.2. Rollback . . . . . . . . . . . . . . . . . . . . 24 86 4.1.5. setLocalDescription . . . . . . . . . . . . . . . . . 25 87 4.1.6. setRemoteDescription . . . . . . . . . . . . . . . . 25 88 4.1.7. currentLocalDescription . . . . . . . . . . . . . . . 26 89 4.1.8. pendingLocalDescription . . . . . . . . . . . . . . . 26 90 4.1.9. currentRemoteDescription . . . . . . . . . . . . . . 26 91 4.1.10. pendingRemoteDescription . . . . . . . . . . . . . . 26 92 4.1.11. canTrickleIceCandidates . . . . . . . . . . . . . . . 27 93 4.1.12. setConfiguration . . . . . . . . . . . . . . . . . . 27 94 4.1.13. addIceCandidate . . . . . . . . . . . . . . . . . . . 28 95 5. SDP Interaction Procedures . . . . . . . . . . . . . . . . . 28 96 5.1. Requirements Overview . . . . . . . . . . . . . . . . . . 28 97 5.1.1. Implementation Requirements . . . . . . . . . . . . . 29 98 5.1.2. Usage Requirements . . . . . . . . . . . . . . . . . 30 99 5.1.3. Profile Names and Interoperability . . . . . . . . . 30 100 5.2. Constructing an Offer . . . . . . . . . . . . . . . . . . 31 101 5.2.1. Initial Offers . . . . . . . . . . . . . . . . . . . 31 102 5.2.2. Subsequent Offers . . . . . . . . . . . . . . . . . . 37 103 5.2.3. Options Handling . . . . . . . . . . . . . . . . . . 40 104 5.2.3.1. IceRestart . . . . . . . . . . . . . . . . . . . 40 105 5.2.3.2. VoiceActivityDetection . . . . . . . . . . . . . 40 106 5.2.4. Direction Attribute in Offers . . . . . . . . . . . . 41 107 5.3. Generating an Answer . . . . . . . . . . . . . . . . . . 41 108 5.3.1. Initial Answers . . . . . . . . . . . . . . . . . . . 42 109 5.3.2. Subsequent Answers . . . . . . . . . . . . . . . . . 46 110 5.3.3. Options Handling . . . . . . . . . . . . . . . . . . 47 111 5.3.3.1. VoiceActivityDetection . . . . . . . . . . . . . 47 112 5.3.4. Direction Attribute in Answers . . . . . . . . . . . 47 113 5.4. Processing a Local Description . . . . . . . . . . . . . 48 114 5.5. Processing a Remote Description . . . . . . . . . . . . . 48 115 5.6. Parsing a Session Description . . . . . . . . . . . . . . 49 116 5.6.1. Session-Level Parsing . . . . . . . . . . . . . . . . 50 117 5.6.2. Media Section Parsing . . . . . . . . . . . . . . . . 52 118 5.6.3. Semantics Verification . . . . . . . . . . . . . . . 54 119 5.7. Applying a Local Description . . . . . . . . . . . . . . 55 120 5.8. Applying a Remote Description . . . . . . . . . . . . . . 57 121 5.9. Applying an Answer . . . . . . . . . . . . . . . . . . . 59 122 6. Configurable SDP Parameters . . . . . . . . . . . . . . . . . 60 123 7. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 62 124 7.1. Simple Example . . . . . . . . . . . . . . . . . . . . . 62 125 7.2. Normal Examples . . . . . . . . . . . . . . . . . . . . . 66 126 8. Security Considerations . . . . . . . . . . . . . . . . . . . 75 127 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 75 128 10. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 75 129 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 76 130 11.1. Normative References . . . . . . . . . . . . . . . . . . 76 131 11.2. Informative References . . . . . . . . . . . . . . . . . 78 132 Appendix A. Change log . . . . . . . . . . . . . . . . . . . . . 80 133 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 85 135 1. Introduction 137 This document describes how the W3C WEBRTC RTCPeerConnection 138 interface[W3C.WD-webrtc-20140617] is used to control the setup, 139 management and teardown of a multimedia session. 141 1.1. General Design of JSEP 143 The thinking behind WebRTC call setup has been to fully specify and 144 control the media plane, but to leave the signaling plane up to the 145 application as much as possible. The rationale is that different 146 applications may prefer to use different protocols, such as the 147 existing SIP or Jingle call signaling protocols, or something custom 148 to the particular application, perhaps for a novel use case. In this 149 approach, the key information that needs to be exchanged is the 150 multimedia session description, which specifies the necessary 151 transport and media configuration information necessary to establish 152 the media plane. 154 With these considerations in mind, this document describes the 155 Javascript Session Establishment Protocol (JSEP) that allows for full 156 control of the signaling state machine from Javascript. JSEP removes 157 the browser almost entirely from the core signaling flow, which is 158 instead handled by the Javascript making use of two interfaces: (1) 159 passing in local and remote session descriptions and (2) interacting 160 with the ICE state machine. 162 In this document, the use of JSEP is described as if it always occurs 163 between two browsers. Note though in many cases it will actually be 164 between a browser and some kind of server, such as a gateway or MCU. 165 This distinction is invisible to the browser; it just follows the 166 instructions it is given via the API. 168 JSEP's handling of session descriptions is simple and 169 straightforward. Whenever an offer/answer exchange is needed, the 170 initiating side creates an offer by calling a createOffer() API. The 171 application optionally modifies that offer, and then uses it to set 172 up its local config via the setLocalDescription() API. The offer is 173 then sent off to the remote side over its preferred signaling 174 mechanism (e.g., WebSockets); upon receipt of that offer, the remote 175 party installs it using the setRemoteDescription() API. 177 To complete the offer/answer exchange, the remote party uses the 178 createAnswer() API to generate an appropriate answer, applies it 179 using the setLocalDescription() API, and sends the answer back to the 180 initiator over the signaling channel. When the initiator gets that 181 answer, it installs it using the setRemoteDescription() API, and 182 initial setup is complete. This process can be repeated for 183 additional offer/answer exchanges. 185 Regarding ICE [RFC5245], JSEP decouples the ICE state machine from 186 the overall signaling state machine, as the ICE state machine must 187 remain in the browser, because only the browser has the necessary 188 knowledge of candidates and other transport info. Performing this 189 separation also provides additional flexibility; in protocols that 190 decouple session descriptions from transport, such as Jingle, the 191 session description can be sent immediately and the transport 192 information can be sent when available. In protocols that don't, 193 such as SIP, the information can be used in the aggregated form. 194 Sending transport information separately can allow for faster ICE and 195 DTLS startup, since ICE checks can start as soon as any transport 196 information is available rather than waiting for all of it. 198 Through its abstraction of signaling, the JSEP approach does require 199 the application to be aware of the signaling process. While the 200 application does not need to understand the contents of session 201 descriptions to set up a call, the application must call the right 202 APIs at the right times, convert the session descriptions and ICE 203 information into the defined messages of its chosen signaling 204 protocol, and perform the reverse conversion on the messages it 205 receives from the other side. 207 One way to mitigate this is to provide a Javascript library that 208 hides this complexity from the developer; said library would 209 implement a given signaling protocol along with its state machine and 210 serialization code, presenting a higher level call-oriented interface 211 to the application developer. For example, libraries exist to adapt 212 the JSEP API into an API suitable for a SIP or XMPP. Thus, JSEP 213 provides greater control for the experienced developer without 214 forcing any additional complexity on the novice developer. 216 1.2. Other Approaches Considered 218 One approach that was considered instead of JSEP was to include a 219 lightweight signaling protocol. Instead of providing session 220 descriptions to the API, the API would produce and consume messages 221 from this protocol. While providing a more high-level API, this put 222 more control of signaling within the browser, forcing the browser to 223 have to understand and handle concepts like signaling glare. In 224 addition, it prevented the application from driving the state machine 225 to a desired state, as is needed in the page reload case. 227 A second approach that was considered but not chosen was to decouple 228 the management of the media control objects from session 229 descriptions, instead offering APIs that would control each component 230 directly. This was rejected based on a feeling that requiring 231 exposure of this level of complexity to the application programmer 232 would not be beneficial; it would result in an API where even a 233 simple example would require a significant amount of code to 234 orchestrate all the needed interactions, as well as creating a large 235 API surface that needed to be agreed upon and documented. In 236 addition, these API points could be called in any order, resulting in 237 a more complex set of interactions with the media subsystem than the 238 JSEP approach, which specifies how session descriptions are to be 239 evaluated and applied. 241 One variation on JSEP that was considered was to keep the basic 242 session description-oriented API, but to move the mechanism for 243 generating offers and answers out of the browser. Instead of 244 providing createOffer/createAnswer methods within the browser, this 245 approach would instead expose a getCapabilities API which would 246 provide the application with the information it needed in order to 247 generate its own session descriptions. This increases the amount of 248 work that the application needs to do; it needs to know how to 249 generate session descriptions from capabilities, and especially how 250 to generate the correct answer from an arbitrary offer and the 251 supported capabilities. While this could certainly be addressed by 252 using a library like the one mentioned above, it basically forces the 253 use of said library even for a simple example. Providing 254 createOffer/createAnswer avoids this problem, but still allows 255 applications to generate their own offers/answers (to a large extent) 256 if they choose, using the description generated by createOffer as an 257 indication of the browser's capabilities. 259 2. Terminology 261 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 262 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 263 document are to be interpreted as described in [RFC2119]. 265 3. Semantics and Syntax 267 3.1. Signaling Model 269 JSEP does not specify a particular signaling model or state machine, 270 other than the generic need to exchange session descriptions in the 271 fashion described by [RFC3264] (offer/answer) in order for both sides 272 of the session to know how to conduct the session. JSEP provides 273 mechanisms to create offers and answers, as well as to apply them to 274 a session. However, the browser is totally decoupled from the actual 275 mechanism by which these offers and answers are communicated to the 276 remote side, including addressing, retransmission, forking, and glare 277 handling. These issues are left entirely up to the application; the 278 application has complete control over which offers and answers get 279 handed to the browser, and when. 281 +-----------+ +-----------+ 282 | Web App |<--- App-Specific Signaling -->| Web App | 283 +-----------+ +-----------+ 284 ^ ^ 285 | SDP | SDP 286 V V 287 +-----------+ +-----------+ 288 | Browser |<----------- Media ------------>| Browser | 289 +-----------+ +-----------+ 291 Figure 1: JSEP Signaling Model 293 3.2. Session Descriptions and State Machine 295 In order to establish the media plane, the user agent needs specific 296 parameters to indicate what to transmit to the remote side, as well 297 as how to handle the media that is received. These parameters are 298 determined by the exchange of session descriptions in offers and 299 answers, and there are certain details to this process that must be 300 handled in the JSEP APIs. 302 Whether a session description applies to the local side or the remote 303 side affects the meaning of that description. For example, the list 304 of codecs sent to a remote party indicates what the local side is 305 willing to receive, which, when intersected with the set of codecs 306 the remote side supports, specifies what the remote side should send. 307 However, not all parameters follow this rule; for example, the DTLS- 308 SRTP parameters [RFC5763] sent to a remote party indicate what 309 certificate the local side will use in DTLS setup, and thereby what 310 the remote party should expect to receive; the remote party will have 311 to accept these parameters, with no option to choose different 312 values. 314 In addition, various RFCs put different conditions on the format of 315 offers versus answers. For example, an offer may propose an 316 arbitrary number of media streams (i.e. m= sections), but an answer 317 must contain the exact same number as the offer. 319 Lastly, while the exact media parameters are only known only after an 320 offer and an answer have been exchanged, it is possible for the 321 offerer to receive media after they have sent an offer and before 322 they have received an answer. To properly process incoming media in 323 this case, the offerer's media handler must be aware of the details 324 of the offer before the answer arrives. 326 Therefore, in order to handle session descriptions properly, the user 327 agent needs: 329 1. To know if a session description pertains to the local or remote 330 side. 332 2. To know if a session description is an offer or an answer. 334 3. To allow the offer to be specified independently of the answer. 336 JSEP addresses this by adding both setLocalDescription and 337 setRemoteDescription methods and having session description objects 338 contain a type field indicating the type of session description being 339 supplied. This satisfies the requirements listed above for both the 340 offerer, who first calls setLocalDescription(sdp [offer]) and then 341 later setRemoteDescription(sdp [answer]), as well as for the 342 answerer, who first calls setRemoteDescription(sdp [offer]) and then 343 later setLocalDescription(sdp [answer]). 345 JSEP also allows for an answer to be treated as provisional by the 346 application. Provisional answers provide a way for an answerer to 347 communicate initial session parameters back to the offerer, in order 348 to allow the session to begin, while allowing a final answer to be 349 specified later. This concept of a final answer is important to the 350 offer/answer model; when such an answer is received, any extra 351 resources allocated by the caller can be released, now that the exact 352 session configuration is known. These "resources" can include things 353 like extra ICE components, TURN candidates, or video decoders. 354 Provisional answers, on the other hand, do no such deallocation 355 results; as a result, multiple dissimilar provisional answers can be 356 received and applied during call setup. 358 In [RFC3264], the constraint at the signaling level is that only one 359 offer can be outstanding for a given session, but at the media stack 360 level, a new offer can be generated at any point. For example, when 361 using SIP for signaling, if one offer is sent, then cancelled using a 362 SIP CANCEL, another offer can be generated even though no answer was 363 received for the first offer. To support this, the JSEP media layer 364 can provide an offer via the createOffer() method whenever the 365 Javascript application needs one for the signaling. The answerer can 366 send back zero or more provisional answers, and finally end the 367 offer-answer exchange by sending a final answer. The state machine 368 for this is as follows: 370 setRemote(OFFER) setLocal(PRANSWER) 371 /-----\ /-----\ 372 | | | | 373 v | v | 374 +---------------+ | +---------------+ | 375 | |----/ | |----/ 376 | | setLocal(PRANSWER) | | 377 | Remote-Offer |------------------- >| Local-Pranswer| 378 | | | | 379 | | | | 380 +---------------+ +---------------+ 381 ^ | | 382 | | setLocal(ANSWER) | 383 setRemote(OFFER) | | 384 | V setLocal(ANSWER) | 385 +---------------+ | 386 | | | 387 | |<---------------------------+ 388 | Stable | 389 | |<---------------------------+ 390 | | | 391 +---------------+ setRemote(ANSWER) | 392 ^ | | 393 | | setLocal(OFFER) | 394 setRemote(ANSWER) | | 395 | V | 396 +---------------+ +---------------+ 397 | | | | 398 | | setRemote(PRANSWER) | | 399 | Local-Offer |------------------- >|Remote-Pranswer| 400 | | | | 401 | |----\ | |----\ 402 +---------------+ | +---------------+ | 403 ^ | ^ | 404 | | | | 405 \-----/ \-----/ 406 setLocal(OFFER) setRemote(PRANSWER) 408 Figure 2: JSEP State Machine 410 Aside from these state transitions there is no other difference 411 between the handling of provisional ("pranswer") and final ("answer") 412 answers. 414 3.3. Session Description Format 416 In the WebRTC specification, session descriptions are formatted as 417 SDP messages. While this format is not optimal for manipulation from 418 Javascript, it is widely accepted, and frequently updated with new 419 features. Any alternate encoding of session descriptions would have 420 to keep pace with the changes to SDP, at least until the time that 421 this new encoding eclipsed SDP in popularity. As a result, JSEP 422 currently uses SDP as the internal representation for its session 423 descriptions. 425 However, to simplify Javascript processing, and provide for future 426 flexibility, the SDP syntax is encapsulated within a 427 SessionDescription object, which can be constructed from SDP, and be 428 serialized out to SDP. If future specifications agree on a JSON 429 format for session descriptions, we could easily enable this object 430 to generate and consume that JSON. 432 Other methods may be added to SessionDescription in the future to 433 simplify handling of SessionDescriptions from Javascript. In the 434 meantime, Javascript libraries can be used to perform these 435 manipulations. 437 Note that most applications should be able to treat the 438 SessionDescriptions produced and consumed by these various API calls 439 as opaque blobs; that is, the application will not need to read or 440 change them. 442 3.4. Session Description Control 444 In order to give the application control over various common session 445 parameters, JSEP provides control surfaces which tell the browser how 446 to generate session descriptions. This avoids the need for 447 Javascript to modify session descriptions in most cases. 449 Changes to these objects result in changes to the session 450 descriptions generated by subsequent createOffer/Answer calls. 452 3.4.1. RtpTransceivers 454 RtpTransceivers allow the application to control the RTP media 455 associated with one m= section. Each RtpTransceiver has an RtpSender 456 and an RtpReceiver, which an application can use to control the 457 sending and receiving of RTP media. The application may also modify 458 the RtpTransceiver directly, for instance, by stopping it. 460 RtpTransceivers generally have a 1:1 mapping with m= sections, 461 although there may be more RtpTransceivers than m= sections when 462 RtpTransceivers are created but not yet associated with a m= section, 463 or if RtpTransceivers have been stopped and disassociated from m= 464 sections. An RtpTransceiver is never associated with more than one 465 m= section, and once a session description is applied, a m= section 466 is always associated with exactly one RtpTransceiver. 468 RtpTransceivers can be created explicitly by the application or 469 implicitly by calling setRemoteDescription with an offer that adds 470 new m= sections. 472 3.4.2. RtpSenders 474 RtpSenders allow the application to control how RTP media is sent. 475 In particular, the application can control whether an RtpSender is 476 active or not, which affects the directionality attribute of the 477 associated m= section. 479 3.4.3. RtpReceivers 481 RtpReceivers allows the application to control how RTP media is 482 received. In particular, the application can control whether an 483 RtpReceiver is active or not, which affects the directionality 484 attribute of the associated m= section. 486 3.5. ICE 488 3.5.1. ICE Gathering Overview 490 JSEP gathers ICE candidates as needed by the application. Collection 491 of ICE candidates is referred to as a gathering phase, and this is 492 triggered either by the addition of a new or recycled m= line to the 493 local session description, or new ICE credentials in the description, 494 indicating an ICE restart. Use of new ICE credentials can be 495 triggered explicitly by the application, or implicitly by the browser 496 in response to changes in the ICE configuration. 498 When the ICE configuration changes in a way that requires a new 499 gathering phase, a 'needs-ice-restart' bit is set. When this bit is 500 set, calls to the createOffer API will generate new ICE credentials. 501 This bit is cleared by a call to the setLocalDescription API with new 502 ICE credentials from either an offer or an answer, i.e., from either 503 a local- or remote-initiated ICE restart. 505 When a new gathering phase starts, the ICE Agent will notify the 506 application that gathering is occurring through an event. Then, when 507 each new ICE candidate becomes available, the ICE Agent will supply 508 it to the application via an additional event; these candidates will 509 also automatically be added to the current and/or pending local 510 session description. Finally, when all candidates have been 511 gathered, an event will be dispatched to signal that the gathering 512 process is complete. 514 Note that gathering phases only gather the candidates needed by 515 new/recycled/restarting m= lines; other m= lines continue to use 516 their existing candidates. Also, when bundling is active, candidates 517 are only gathered (and exchanged) for the m= lines referenced in 518 BUNDLE-tags, as described in 519 [I-D.ietf-mmusic-sdp-bundle-negotiation]. 521 3.5.2. ICE Candidate Trickling 523 Candidate trickling is a technique through which a caller may 524 incrementally provide candidates to the callee after the initial 525 offer has been dispatched; the semantics of "Trickle ICE" are defined 526 in [I-D.ietf-ice-trickle]. This process allows the callee to begin 527 acting upon the call and setting up the ICE (and perhaps DTLS) 528 connections immediately, without having to wait for the caller to 529 gather all possible candidates. This results in faster media setup 530 in cases where gathering is not performed prior to initiating the 531 call. 533 JSEP supports optional candidate trickling by providing APIs, as 534 described above, that provide control and feedback on the ICE 535 candidate gathering process. Applications that support candidate 536 trickling can send the initial offer immediately and send individual 537 candidates when they get the notified of a new candidate; 538 applications that do not support this feature can simply wait for the 539 indication that gathering is complete, and then create and send their 540 offer, with all the candidates, at this time. 542 Upon receipt of trickled candidates, the receiving application will 543 supply them to its ICE Agent. This triggers the ICE Agent to start 544 using the new remote candidates for connectivity checks. 546 3.5.2.1. ICE Candidate Format 548 As with session descriptions, the syntax of the IceCandidate object 549 provides some abstraction, but can be easily converted to and from 550 the SDP candidate lines. 552 The candidate lines are the only SDP information that is contained 553 within IceCandidate, as they represent the only information needed 554 that is not present in the initial offer (i.e., for trickle 555 candidates). This information is carried with the same syntax as the 556 "candidate-attribute" field defined for ICE. For example: 558 candidate:1 1 UDP 1694498815 192.0.2.33 10000 typ host 560 The IceCandidate object also contains fields to indicate which m= 561 line it should be associated with. The m= line can be identified in 562 one of two ways; either by a m= line index, or a MID. The m= line 563 index is a zero-based index, with index N referring to the N+1th m= 564 line in the SDP sent by the entity which sent the IceCandidate. The 565 MID uses the "media stream identification" attribute, as defined in 566 [RFC5888], Section 4, to identify the m= line. JSEP implementations 567 creating an ICE Candidate object MUST populate both of these fields. 568 Implementations receiving an ICE Candidate object MUST use the MID if 569 present, or the m= line index, if not (as it could have come from a 570 non-JSEP endpoint). 572 3.5.3. ICE Candidate Policy 574 Typically, when gathering ICE candidates, the browser will gather all 575 possible forms of initial candidates - host, server reflexive, and 576 relay. However, in certain cases, applications may want to have more 577 specific control over the gathering process, due to privacy or 578 related concerns. For example, one may want to suppress the use of 579 host candidates, to avoid exposing information about the local 580 network, or go as far as only using relay candidates, to leak as 581 little location information as possible (note that these choices come 582 with corresponding operational costs). To accomplish this, the 583 browser MUST allow the application to restrict which ICE candidates 584 are used in a session. Note that this filtering is applied on top of 585 any restrictions the browser chooses to enforce regarding which IP 586 addresses are permitted for the application, as discussed in 587 [I-D.shieh-rtcweb-ip-handling]. 589 There may also be cases where the application wants to change which 590 types of candidates are used while the session is active. A prime 591 example is where a callee may initially want to use only relay 592 candidates, to avoid leaking location information to an arbitrary 593 caller, but then change to use all candidates (for lower operational 594 cost) once the user has indicated they want to take the call. For 595 this scenario, the browser MUST allow the candidate policy to be 596 changed in mid-session, subject to the aforementioned interactions 597 with local policy. 599 To administer the ICE candidate policy, the browser will determine 600 the current setting at the start of each gathering phase. Then, 601 during the gathering phase, the browser MUST NOT expose candidates 602 disallowed by the current policy to the application, use them as the 603 source of connectivity checks, or indirectly expose them via other 604 fields, such as the raddr/rport attributes for other ICE candidates. 605 Later, if a different policy is specified by the application, the 606 application can apply it by kicking off a new gathering phase via an 607 ICE restart. 609 3.5.4. ICE Candidate Pool 611 JSEP applications typically inform the browser to begin ICE gathering 612 via the information supplied to setLocalDescription, as this is where 613 the app specifies the number of media streams, and thereby ICE 614 components, for which to gather candidates. However, to accelerate 615 cases where the application knows the number of ICE components to use 616 ahead of time, it may ask the browser to gather a pool of potential 617 ICE candidates to help ensure rapid media setup. 619 When setLocalDescription is eventually called, and the browser goes 620 to gather the needed ICE candidates, it SHOULD start by checking if 621 any candidates are available in the pool. If there are candidates in 622 the pool, they SHOULD be handed to the application immediately via 623 the ICE candidate event. If the pool becomes depleted, either 624 because a larger-than-expected number of ICE components is used, or 625 because the pool has not had enough time to gather candidates, the 626 remaining candidates are gathered as usual. 628 One example of where this concept is useful is an application that 629 expects an incoming call at some point in the future, and wants to 630 minimize the time it takes to establish connectivity, to avoid 631 clipping of initial media. By pre-gathering candidates into the 632 pool, it can exchange and start sending connectivity checks from 633 these candidates almost immediately upon receipt of a call. Note 634 though that by holding on to these pre-gathered candidates, which 635 will be kept alive as long as they may be needed, the application 636 will consume resources on the STUN/TURN servers it is using. 638 3.6. Video Size Negotiation 640 Video size negotiation is the process through which a receiver can 641 use the "a=imageattr" SDP attribute [RFC6236] to indicate what video 642 frame sizes it is capable of receiving. A receiver may have hard 643 limits on what its video decoder can process, or it may wish to 644 constrain what it receives due to application preferences, e.g. a 645 specific size for the window in which the video will be displayed. 647 3.6.1. Creating an imageattr Attribute 649 In order to determine the limits on what video resolution a receiver 650 wants to receive, it will intersect its decoder hard limits with any 651 mandatory constraints that have been applied to the associated 652 MediaStreamTrack. If the decoder limits are unknown, e.g. when using 653 a software decoder, the mandatory constraints are used directly. For 654 the answerer, these mandatory constraints can be applied to the 655 remote MediaStreamTracks that are created by a setRemoteDescription 656 call, and will affect the output of the ensuing createAnswer call. 657 Any constraints set after setLocalDescription is used to set the 658 answer will result in a new offer-answer exchange. For the offerer, 659 because it does not know about any remote MediaStreamTracks until it 660 receives the answer, the offer can only reflect decoder hard limits. 661 If the offerer wishes to set mandatory constraints on video 662 resolution, it must do so after receiving the answer, and the result 663 will be a new offer-answer to communicate them. 665 If there are no known decoder limits or mandatory constraints, the 666 "a=imageattr" attribute SHOULD be omitted. 668 Otherwise, an "a=imageattr" attribute is created with "recv" 669 direction, and the resulting resolution space formed by intersecting 670 the decoder limits and constraints is used to specify its minimum and 671 maximum x= and y= values. If the intersection is the null set, i.e., 672 there are no resolutions that are permitted by both the decoder and 673 the mandatory constraints, this SHOULD be represented by x=0 and y=0 674 values. 676 The rules here express a single set of preferences, and therefore, 677 the "a=imageattr" q= value is not important. It SHOULD be set to 678 1.0. 680 The "a=imageattr" field is payload type specific. When all video 681 codecs supported have the same capabilities, use of a single 682 attribute, with the wildcard payload type (*), is RECOMMENDED. 683 However, when the supported video codecs have differing capabilities, 684 specific "a=imageattr" attributes MUST be inserted for each payload 685 type. 687 As an example, consider a system with a HD-capable, multiformat video 688 decoder, where the application has constrained the received track to 689 at most 360p. In this case, the implemention would generate this 690 attribute: 692 a=imageattr:* recv [x=[16:640],y=[16:360],q=1.0] 694 This declaration indicates that the receiver is capable of decoding 695 any image resolution from 16x16 up to 640x360 pixels. 697 3.6.2. Interpreting an imageattr Attribute 699 [RFC6236] defines "a=imageattr" to be an advisory field. This means 700 that it does not absolutely constrain the video formats that the 701 sender can use, but gives an indication of the preferred values. 703 This specification prescribes more specific behavior. When a sender 704 of a given MediaStreamTrack, which is producing video of a certain 705 resolution, receives an "a=imageattr recv" attribute, it MUST check 706 to see if the original resolution meets the size criteria specified 707 in the attribute, and adapt the resolution accordingly by scaling (if 708 appropriate). Note that when considering a MediaStreamTrack that is 709 producing rotated video, the unrotated resolution MUST be used. This 710 is required regardless of whether the receiver supports performing 711 receive-side rotation (e.g., through CVO), as it significantly 712 simplifies the matching logic. 714 For an "a=imageattr recv" attribute, only size limits are considered. 715 Any other values, e.g. aspect ratio, MUST be ignored. 717 When communicating with a non-JSEP endpoint, multiple relevant 718 "a=imageattr recv" attributes may be received. If this occurs, 719 attributes other than the one with the highest "q=" value MUST be 720 ignored. 722 If an "a=imageattr recv" attribute references a different video codec 723 than what has been selected for the MediaStreamTrack, it MUST be 724 ignored. 726 If the original resolution matches the size limits in the attribute, 727 the track MUST be transmitted untouched. 729 If the original resolution exceeds the size limits in the attribute, 730 the sender SHOULD apply downscaling to the output of the 731 MediaStreamTrack in order to satisfy the limits. Downscaling MUST 732 NOT change the track aspect ratio. 734 If the original resolution is less than the size limits in the 735 attribute, upscaling is needed, but this may not be appropriate in 736 all cases. To address this concern, the application can set an 737 upscaling policy for each sent track. For this case, if upscaling is 738 permitted by policy, the sender SHOULD apply upscaling in order to 739 provide the desired resolution. Otherwise, the sender MUST NOT apply 740 upscaling. The sender SHOULD NOT upscale in other cases, even if the 741 policy permits it. Upscaling MUST NOT change the track aspect ratio. 743 If there is no appropriate and permitted scaling mechanism that 744 allows the received size limits to be satisfied, the sender MUST NOT 745 transmit the track. 747 In the special case of receiving a maximum resolution of [0, 0], as 748 described above, the sender MUST NOT transmit the track. 750 3.7. Interactions With Forking 752 Some call signaling systems allow various types of forking where an 753 SDP Offer may be provided to more than one device. For example, SIP 754 [RFC3261] defines both a "Parallel Search" and "Sequential Search". 755 Although these are primarily signaling level issues that are outside 756 the scope of JSEP, they do have some impact on the configuration of 757 the media plane that is relevant. When forking happens at the 758 signaling layer, the Javascript application responsible for the 759 signaling needs to make the decisions about what media should be sent 760 or received at any point of time, as well as which remote endpoint it 761 should communicate with; JSEP is used to make sure the media engine 762 can make the RTP and media perform as required by the application. 763 The basic operations that the applications can have the media engine 764 do are: 766 o Start exchanging media with a given remote peer, but keep all the 767 resources reserved in the offer. 769 o Start exchanging media with a given remote peer, and free any 770 resources in the offer that are not being used. 772 3.7.1. Sequential Forking 774 Sequential forking involves a call being dispatched to multiple 775 remote callees, where each callee can accept the call, but only one 776 active session ever exists at a time; no mixing of received media is 777 performed. 779 JSEP handles sequential forking well, allowing the application to 780 easily control the policy for selecting the desired remote endpoint. 781 When an answer arrives from one of the callees, the application can 782 choose to apply it either as a provisional answer, leaving open the 783 possibility of using a different answer in the future, or apply it as 784 a final answer, ending the setup flow. 786 In a "first-one-wins" situation, the first answer will be applied as 787 a final answer, and the application will reject any subsequent 788 answers. In SIP parlance, this would be ACK + BYE. 790 In a "last-one-wins" situation, all answers would be applied as 791 provisional answers, and any previous call leg will be terminated. 792 At some point, the application will end the setup process, perhaps 793 with a timer; at this point, the application could reapply the 794 pending remote description as a final answer. 796 3.7.2. Parallel Forking 798 Parallel forking involves a call being dispatched to multiple remote 799 callees, where each callee can accept the call, and multiple 800 simultaneous active signaling sessions can be established as a 801 result. If multiple callees send media at the same time, the 802 possibilities for handling this are described in Section 3.1 of 803 [RFC3960]. Most SIP devices today only support exchanging media with 804 a single device at a time, and do not try to mix multiple early media 805 audio sources, as that could result in a confusing situation. For 806 example, consider having a European ringback tone mixed together with 807 the North American ringback tone - the resulting sound would not be 808 like either tone, and would confuse the user. If the signaling 809 application wishes to only exchange media with one of the remote 810 endpoints at a time, then from a media engine point of view, this is 811 exactly like the sequential forking case. 813 In the parallel forking case where the Javascript application wishes 814 to simultaneously exchange media with multiple peers, the flow is 815 slightly more complex, but the Javascript application can follow the 816 strategy that [RFC3960] describes using UPDATE. The UPDATE approach 817 allows the signaling to set up a separate media flow for each peer 818 that it wishes to exchange media with. In JSEP, this offer used in 819 the UPDATE would be formed by simply creating a new PeerConnection 820 and making sure that the same local media streams have been added 821 into this new PeerConnection. Then the new PeerConnection object 822 would produce a SDP offer that could be used by the signaling to 823 perform the UPDATE strategy discussed in [RFC3960]. 825 As a result of sharing the media streams, the application will end up 826 with N parallel PeerConnection sessions, each with a local and remote 827 description and their own local and remote addresses. The media flow 828 from these sessions can be managed by specifying SDP direction 829 attributes in the descriptions, or the application can choose to play 830 out the media from all sessions mixed together. Of course, if the 831 application wants to only keep a single session, it can simply 832 terminate the sessions that it no longer needs. 834 4. Interface 836 This section details the basic operations that must be present to 837 implement JSEP functionality. The actual API exposed in the W3C API 838 may have somewhat different syntax, but should map easily to these 839 concepts. 841 4.1. Methods 843 4.1.1. Constructor 845 The PeerConnection constructor allows the application to specify 846 global parameters for the media session, such as the STUN/TURN 847 servers and credentials to use when gathering candidates, as well as 848 the initial ICE candidate policy and pool size, and also the bundle 849 policy to use. 851 If an ICE candidate policy is specified, it functions as described in 852 Section 3.5.3, causing the browser to only surface the permitted 853 candidates (including any internal browser filtering) to the 854 application, and only use those candidates for connectivity checks. 855 The set of available policies is as follows: 857 all: All candidates permitted by browser policy will be gathered and 858 used. 860 relay: All candidates except relay candidates will be filtered out. 861 This obfuscates the location information that might be ascertained 862 by the remote peer from the received candidates. Depending on how 863 the application deploys its relay servers, this could obfuscate 864 location to a metro or possibly even global level. 866 The default ICE candidate policy MUST be set to "all" as this is 867 generally the desired policy, and also typically reduces use of 868 application TURN server resources significantly. 870 If a size is specified for the ICE candidate pool, this indicates the 871 number of ICE components to pre-gather candidates for. Because pre- 872 gathering results in utilizing STUN/TURN server resources for 873 potentially long periods of time, this must only occur upon 874 application request, and therefore the default candidate pool size 875 MUST be zero. 877 The application can specify its preferred policy regarding use of 878 bundle, the multiplexing mechanism defined in 879 [I-D.ietf-mmusic-sdp-bundle-negotiation]. Regardless of policy, the 880 application will always try to negotiate bundle onto a single 881 transport, and will offer a single bundle group across all media 882 section; use of this single transport is contingent upon the answerer 883 accepting bundle. However, by specifying a policy from the list 884 below, the application can control exactly how aggressively it will 885 try to bundle media streams together, which affects how it will 886 interoperate with a non-bundle-aware endpoint. When negotiating with 887 a non-bundle-aware endpoint, only the streams not marked as bundle- 888 only streams will be established. 890 The set of available policies is as follows: 892 balanced: The first media section of each type (audio, video, or 893 application) will contain transport parameters, which will allow 894 an answerer to unbundle that section. The second and any 895 subsequent media section of each type will be marked bundle-only. 896 The result is that if there are N distinct media types, then 897 candidates will be gathered for for N media streams. This policy 898 balances desire to multiplex with the need to ensure basic audio 899 and video can still be negotiated in legacy cases. 901 max-compat: All media sections will contain transport parameters; 902 none will be marked as bundle-only. This policy will allow all 903 streams to be received by non-bundle-aware endpoints, but require 904 separate candidates to be gathered for each media stream. 906 max-bundle: Only the first media section will contain transport 907 parameters; all streams other than the first will be marked as 908 bundle-only. This policy aims to minimize candidate gathering and 909 maximize multiplexing, at the cost of less compatibility with 910 legacy endpoints. 912 As it provides the best tradeoff between performance and 913 compatibility with legacy endpoints, the default bundle policy MUST 914 be set to "balanced". 916 The application can specify its preferred policy regarding use of 917 RTP/RTCP multiplexing [RFC5761] using one of the following policies: 919 negotiate: The browser will gather both RTP and RTCP candidates but 920 also will offer "a=rtcp-mux", thus allowing for compatibility with 921 either multiplexing or non-multiplexing endpoints. 923 require: The browser will only gather RTP candidates. This halves 924 the number of candidates that the offerer needs to gather. When 925 acting as answerer, the browser will reject any m= section that 926 does not provide an "a=rtcp-mux" attribute. 928 The default multiplexing policy MUST be set to "require". 929 Implementations MAY choose to reject attempts by the application to 930 set the multiplexing policy to "negotiate". 932 4.1.2. createOffer 934 The createOffer method generates a blob of SDP that contains a 935 [RFC3264] offer with the supported configurations for the session, 936 including descriptions of the media added to this PeerConnection, the 937 codec/RTP/RTCP options supported by this implementation, and any 938 candidates that have been gathered by the ICE Agent. An options 939 parameter may be supplied to provide additional control over the 940 generated offer. This options parameter allows an application to 941 trigger an ICE restart, for the purpose of reestablishing 942 connectivity. 944 In the initial offer, the generated SDP will contain all desired 945 functionality for the session (functionality that is supported but 946 not desired by default may be omitted); for each SDP line, the 947 generation of the SDP will follow the process defined for generating 948 an initial offer from the document that specifies the given SDP line. 949 The exact handling of initial offer generation is detailed in 950 Section 5.2.1 below. 952 In the event createOffer is called after the session is established, 953 createOffer will generate an offer to modify the current session 954 based on any changes that have been made to the session, e.g., adding 955 or stopping RtpTransceivers, or requesting an ICE restart. For each 956 existing stream, the generation of each SDP line must follow the 957 process defined for generating an updated offer from the RFC that 958 specifies the given SDP line. For each new stream, the generation of 959 the SDP must follow the process of generating an initial offer, as 960 mentioned above. If no changes have been made, or for SDP lines that 961 are unaffected by the requested changes, the offer will only contain 962 the parameters negotiated by the last offer-answer exchange. The 963 exact handling of subsequent offer generation is detailed in 964 Section 5.2.2. below. 966 Session descriptions generated by createOffer must be immediately 967 usable by setLocalDescription; if a system has limited resources 968 (e.g. a finite number of decoders), createOffer should return an 969 offer that reflects the current state of the system, so that 970 setLocalDescription will succeed when it attempts to acquire those 971 resources. Because this method may need to inspect the system state 972 to determine the currently available resources, it may be implemented 973 as an async operation. 975 Calling this method may do things such as generate new ICE 976 credentials, but does not result in candidate gathering, or cause 977 media to start or stop flowing. 979 4.1.3. createAnswer 981 The createAnswer method generates a blob of SDP that contains a 982 [RFC3264] SDP answer with the supported configuration for the session 983 that is compatible with the parameters supplied in the most recent 984 call to setRemoteDescription, which MUST have been called prior to 985 calling createAnswer. Like createOffer, the returned blob contains 986 descriptions of the media added to this PeerConnection, the 987 codec/RTP/RTCP options negotiated for this session, and any 988 candidates that have been gathered by the ICE Agent. An options 989 parameter may be supplied to provide additional control over the 990 generated answer. 992 As an answer, the generated SDP will contain a specific configuration 993 that specifies how the media plane should be established; for each 994 SDP line, the generation of the SDP must follow the process defined 995 for generating an answer from the document that specifies the given 996 SDP line. The exact handling of answer generation is detailed in 997 Section 5.3. below. 999 Session descriptions generated by createAnswer must be immediately 1000 usable by setLocalDescription; like createOffer, the returned 1001 description should reflect the current state of the system. Because 1002 this method may need to inspect the system state to determine the 1003 currently available resources, it may need to be implemented as an 1004 async operation. 1006 Calling this method may do things such as generate new ICE 1007 credentials, but does not trigger candidate gathering or change media 1008 state. 1010 4.1.4. SessionDescriptionType 1012 Session description objects (RTCSessionDescription) may be of type 1013 "offer", "pranswer", "answer" or "rollback". These types provide 1014 information as to how the description parameter should be parsed, and 1015 how the media state should be changed. 1017 "offer" indicates that a description should be parsed as an offer; 1018 said description may include many possible media configurations. A 1019 description used as an "offer" may be applied anytime the 1020 PeerConnection is in a stable state, or as an update to a previously 1021 supplied but unanswered "offer". 1023 "pranswer" indicates that a description should be parsed as an 1024 answer, but not a final answer, and so should not result in the 1025 freeing of allocated resources. It may result in the start of media 1026 transmission, if the answer does not specify an inactive media 1027 direction. A description used as a "pranswer" may be applied as a 1028 response to an "offer", or an update to a previously sent "pranswer". 1030 "answer" indicates that a description should be parsed as an answer, 1031 the offer-answer exchange should be considered complete, and any 1032 resources (decoders, candidates) that are no longer needed can be 1033 released. A description used as an "answer" may be applied as a 1034 response to an "offer", or an update to a previously sent "pranswer". 1036 The only difference between a provisional and final answer is that 1037 the final answer results in the freeing of any unused resources that 1038 were allocated as a result of the offer. As such, the application 1039 can use some discretion on whether an answer should be applied as 1040 provisional or final, and can change the type of the session 1041 description as needed. For example, in a serial forking scenario, an 1042 application may receive multiple "final" answers, one from each 1043 remote endpoint. The application could choose to accept the initial 1044 answers as provisional answers, and only apply an answer as final 1045 when it receives one that meets its criteria (e.g. a live user 1046 instead of voicemail). 1048 "rollback" is a special session description type implying that the 1049 state machine should be rolled back to the previous state, as 1050 described in Section 4.1.4.2. The contents MUST be empty. 1052 4.1.4.1. Use of Provisional Answers 1054 Most web applications will not need to create answers using the 1055 "pranswer" type. While it is good practice to send an immediate 1056 response to an "offer", in order to warm up the session transport and 1057 prevent media clipping, the preferred handling for a web application 1058 would be to create and send an "inactive" final answer immediately 1059 after receiving the offer. Later, when the called user actually 1060 accepts the call, the application can create a new "sendrecv" offer 1061 to update the previous offer/answer pair and start the media flow. 1062 While this could also be done with an inactive "pranswer", followed 1063 by a sendrecv "answer", the initial "pranswer" leaves the offer- 1064 answer exchange open, which means that neither side can send an 1065 updated offer during this time. 1067 As an example, consider a typical web application that will set up a 1068 data channel, an audio channel, and a video channel. When an 1069 endpoint receives an offer with these channels, it could send an 1070 answer accepting the data channel for two-way data, and accepting the 1071 audio and video tracks as inactive or receive-only. It could then 1072 ask the user to accept the call, acquire the local media streams, and 1073 send a new offer to the remote side moving the audio and video to be 1074 two-way media. By the time the human has accepted the call and 1075 triggered the new offer, it is likely that the ICE and DTLS 1076 handshaking for all the channels will already have finished. 1078 Of course, some applications may not be able to perform this double 1079 offer-answer exchange, particularly ones that are attempting to 1080 gateway to legacy signaling protocols. In these cases, "pranswer" 1081 can still provide the application with a mechanism to warm up the 1082 transport. 1084 4.1.4.2. Rollback 1086 In certain situations it may be desirable to "undo" a change made to 1087 setLocalDescription or setRemoteDescription. Consider a case where a 1088 call is ongoing, and one side wants to change some of the session 1089 parameters; that side generates an updated offer and then calls 1090 setLocalDescription. However, the remote side, either before or 1091 after setRemoteDescription, decides it does not want to accept the 1092 new parameters, and sends a reject message back to the offerer. Now, 1093 the offerer, and possibly the answerer as well, need to return to a 1094 stable state and the previous local/remote description. To support 1095 this, we introduce the concept of "rollback". 1097 A rollback discards any proposed changes to the session, returning 1098 the state machine to the stable state, and setting the pending local 1099 and/or remote description back to null. Any resources or candidates 1100 that were allocated by the abandoned local description are discarded; 1101 any media that is received will be processed according to the 1102 previous local and remote descriptions. Rollback can only be used to 1103 cancel proposed changes; there is no support for rolling back from a 1104 stable state to a previous stable state. Note that this implies that 1105 once the answerer has performed setLocalDescription with his answer, 1106 this cannot be rolled back. 1108 A rollback will disassociate any RtpTransceivers that were associated 1109 with m= sections by the application of the rolled-back session 1110 description (see Section 5.8 and Section 5.7). This means that some 1111 RtpTransceivers that were previously associated will no longer be 1112 associated with any m= section; in such cases, the value of the 1113 RtpTransceiver's mid attribute MUST be set to null. RtpTransceivers 1114 that were created by applying a remote offer that was subsequently 1115 rolled back MUST be removed. However, a RtpTransceiver MUST NOT be 1116 removed if the RtpTransceiver's RtpSender was activated by the 1117 addTrack method. This is so that an application may call addTrack, 1118 then call setRemoteDescription with an offer, then roll back that 1119 offer, then call createOffer and have a m= section for the added 1120 track appear in the generated offer. 1122 A rollback is performed by supplying a session description of type 1123 "rollback" with empty contents to either setLocalDescription or 1124 setRemoteDescription, depending on which was most recently used (i.e. 1125 if the new offer was supplied to setLocalDescription, the rollback 1126 should be done using setLocalDescription as well). 1128 4.1.5. setLocalDescription 1130 The setLocalDescription method instructs the PeerConnection to apply 1131 the supplied session description as its local configuration. The 1132 type field indicates whether the description should be processed as 1133 an offer, provisional answer, or final answer; offers and answers are 1134 checked differently, using the various rules that exist for each SDP 1135 line. 1137 This API changes the local media state; among other things, it sets 1138 up local resources for receiving and decoding media. In order to 1139 successfully handle scenarios where the application wants to offer to 1140 change from one media format to a different, incompatible format, the 1141 PeerConnection must be able to simultaneously support use of both the 1142 current and pending local descriptions (e.g. support codecs that 1143 exist in both descriptions) until a final answer is received, at 1144 which point the PeerConnection can fully adopt the pending local 1145 description, or roll back to the current description if the remote 1146 side denied the change. 1148 This API indirectly controls the candidate gathering process. When a 1149 local description is supplied, and the number of transports currently 1150 in use does not match the number of transports needed by the local 1151 description, the PeerConnection will create transports as needed and 1152 begin gathering candidates for them. 1154 If setRemoteDescription was previously called with an offer, and 1155 setLocalDescription is called with an answer (provisional or final), 1156 and the media directions are compatible, and media are available to 1157 send, this will result in the starting of media transmission. 1159 4.1.6. setRemoteDescription 1161 The setRemoteDescription method instructs the PeerConnection to apply 1162 the supplied session description as the desired remote configuration. 1163 As in setLocalDescription, the type field of the description 1164 indicates how it should be processed. 1166 This API changes the local media state; among other things, it sets 1167 up local resources for sending and encoding media. 1169 If setLocalDescription was previously called with an offer, and 1170 setRemoteDescription is called with an answer (provisional or final), 1171 and the media directions are compatible, and media are available to 1172 send, this will result in the starting of media transmission. 1174 4.1.7. currentLocalDescription 1176 The currentLocalDescription method returns a copy of the current 1177 negotiated local description - i.e., the local description from the 1178 last successful offer/answer exchange - in addition to any local 1179 candidates that have been generated by the ICE Agent since the local 1180 description was set. 1182 A null object will be returned if an offer/answer exchange has not 1183 yet been completed. 1185 4.1.8. pendingLocalDescription 1187 The pendingLocalDescription method returns a copy of the local 1188 description currently in negotiation - i.e., a local offer set 1189 without any corresponding remote answer - in addition to any local 1190 candidates that have been generated by the ICE Agent since the local 1191 description was set. 1193 A null object will be returned if the state of the PeerConnection is 1194 "stable" or "have-remote-offer". 1196 4.1.9. currentRemoteDescription 1198 The currentRemoteDescription method returns a copy of the current 1199 negotiated remote description - i.e., the remote description from the 1200 last successful offer/answer exchange - in addition to any remote 1201 candidates that have been supplied via processIceMessage since the 1202 remote description was set. 1204 A null object will be returned if an offer/answer exchange has not 1205 yet been completed. 1207 4.1.10. pendingRemoteDescription 1209 The pendingRemoteDescription method returns a copy of the remote 1210 description currently in negotiation - i.e., a remote offer set 1211 without any corresponding local answer - in addition to any remote 1212 candidates that have been supplied via processIceMessage since the 1213 remote description was set. 1215 A null object will be returned if the state of the PeerConnection is 1216 "stable" or "have-local-offer". 1218 4.1.11. canTrickleIceCandidates 1220 The canTrickleIceCandidates property indicates whether the remote 1221 side supports receiving trickled candidates. There are three 1222 potential values: 1224 null: No SDP has been received from the other side, so it is not 1225 known if it can handle trickle. This is the initial value before 1226 setRemoteDescription() is called. 1228 true: SDP has been received from the other side indicating that it 1229 can support trickle. 1231 false: SDP has been received from the other side indicating that it 1232 cannot support trickle. 1234 As described in Section 3.5.2, JSEP implementations always provide 1235 candidates to the application individually, consistent with what is 1236 needed for Trickle ICE. However, applications can use the 1237 canTrickleIceCandidates property to determine whether their peer can 1238 actually do Trickle ICE, i.e., whether it is safe to send an initial 1239 offer or answer followed later by candidates as they are gathered. 1240 As "true" is the only value that definitively indicates remote 1241 Trickle ICE support, an application which compares 1242 canTrickleIceCandidates against "true" will by default attempt Half 1243 Trickle on initial offers and Full Trickle on subsequent interactions 1244 with a Trickle ICE-compatible agent. 1246 4.1.12. setConfiguration 1248 The setConfiguration method allows the global configuration of the 1249 PeerConnection, which was initially set by constructor parameters, to 1250 be changed during the session. The effects of this method call 1251 depend on when it is invoked, and differ depending on which specific 1252 parameters are changed: 1254 o Any changes to the STUN/TURN servers to use affect the next 1255 gathering phase. If an ICE gathering phase has already started or 1256 completed, the 'needs-ice-restart' bit mentioned in Section 3.5.1 1257 will be set. This will cause the next call to createOffer to 1258 generate new ICE credentials, for the purpose of forcing an ICE 1259 restart and kicking off a new gathering phase, in which the new 1260 servers will be used. If the ICE candidate pool has a nonzero 1261 size, any existing candidates will be discarded, and new 1262 candidates will be gathered from the new servers. 1264 o Any change to the ICE candidate policy affects the next gathering 1265 phase. If an ICE gathering phase has already started or 1266 completed, the 'needs-ice-restart' bit will be set. Either way, 1267 changes to the policy have no effect on the candidate pool, 1268 because pooled candidates are not surfaced to the application 1269 until a gathering phase occurs, and so any necessary filtering can 1270 still be done on any pooled candidates. 1272 o Any changes to the ICE candidate pool size take effect 1273 immediately; if increased, additional candidates are pre-gathered; 1274 if decreased, the now-superfluous candidates are discarded. 1276 o The bundle and RTCP-multiplexing policies MUST NOT be changed 1277 after the construction of the PeerConnection. 1279 This call may result in a change to the state of the ICE Agent, and 1280 may result in a change to media state if it results in connectivity 1281 being established. 1283 4.1.13. addIceCandidate 1285 The addIceCandidate method provides a remote candidate to the ICE 1286 Agent, which, if parsed successfully, will be added to the current 1287 and/or pending remote description according to the rules defined for 1288 Trickle ICE. Connectivity checks will be sent to the new candidate. 1290 This method can also be used to provide an end-of-candidates 1291 indication (as defined in [I-D.ietf-ice-trickle]) to the ICE Agent 1292 for all media descriptions in the last remote description. 1294 This call will result in a change to the state of the ICE Agent, and 1295 may result in a change to media state if it results in connectivity 1296 being established. 1298 5. SDP Interaction Procedures 1300 This section describes the specific procedures to be followed when 1301 creating and parsing SDP objects. 1303 5.1. Requirements Overview 1305 JSEP implementations must comply with the specifications listed below 1306 that govern the creation and processing of offers and answers. 1308 The first set of specifications is the "mandatory-to-implement" set. 1309 All implementations must support these behaviors, but may not use all 1310 of them if the remote side, which may not be a JSEP endpoint, does 1311 not support them. 1313 The second set of specifications is the "mandatory-to-use" set. The 1314 local JSEP endpoint and any remote endpoint must indicate support for 1315 these specifications in their session descriptions. 1317 5.1.1. Implementation Requirements 1319 This list of mandatory-to-implement specifications is derived from 1320 the requirements outlined in [I-D.ietf-rtcweb-rtp-usage]. 1322 R-1 [RFC4566] is the base SDP specification and MUST be 1323 implemented. 1325 R-2 [RFC5764] MUST be supported for signaling the UDP/TLS/RTP/SAVPF 1326 [RFC5764], TCP/DTLS/RTP/SAVPF 1327 [I-D.nandakumar-mmusic-proto-iana-registration], "UDP/DTLS/ 1328 SCTP" [I-D.ietf-mmusic-sctp-sdp], and "TCP/DTLS/SCTP" 1329 [I-D.ietf-mmusic-sctp-sdp] RTP profiles. 1331 R-3 [RFC5245] MUST be implemented for signaling the ICE credentials 1332 and candidate lines corresponding to each media stream. The 1333 ICE implementation MUST be a Full implementation, not a Lite 1334 implementation. 1336 R-4 [RFC5763] MUST be implemented to signal DTLS certificate 1337 fingerprints. 1339 R-5 [RFC4568] MUST NOT be implemented to signal SDES SRTP keying 1340 information. 1342 R-6 The [RFC5888] grouping framework MUST be implemented for 1343 signaling grouping information, and MUST be used to identify m= 1344 lines via the a=mid attribute. 1346 R-7 [I-D.ietf-mmusic-msid] MUST be supported, in order to signal 1347 associations between RTP objects and W3C MediaStreams and 1348 MediaStreamTracks in a standard way. 1350 R-8 The bundle mechanism in 1351 [I-D.ietf-mmusic-sdp-bundle-negotiation] MUST be supported to 1352 signal the ability to multiplex RTP streams on a single UDP 1353 port, in order to avoid excessive use of port number resources. 1355 R-9 The SDP attributes of "sendonly", "recvonly", "inactive", and 1356 "sendrecv" from [RFC4566] MUST be implemented to signal 1357 information about media direction. 1359 R-10 [RFC5576] MUST be implemented to signal RTP SSRC values and 1360 grouping semantics. 1362 R-11 [RFC4585] MUST be implemented to signal RTCP based feedback. 1364 R-12 [RFC5761] MUST be implemented to signal multiplexing of RTP and 1365 RTCP. 1367 R-13 [RFC5506] MUST be implemented to signal reduced-size RTCP 1368 messages. 1370 R-14 [RFC4588] MUST be implemented to signal RTX payload type 1371 associations. 1373 R-15 [RFC3556] with bandwidth modifiers MAY be supported for 1374 specifying RTCP bandwidth as a fraction of the media bandwidth, 1375 RTCP fraction allocated to the senders and setting maximum 1376 media bit-rate boundaries. 1378 R-16 TODO: any others? 1380 As required by [RFC4566], Section 5.13, JSEP implementations MUST 1381 ignore unknown attribute (a=) lines. 1383 5.1.2. Usage Requirements 1385 All session descriptions handled by JSEP endpoints, both local and 1386 remote, MUST indicate support for the following specifications. If 1387 any of these are absent, this omission MUST be treated as an error. 1389 R-1 ICE, as specified in [RFC5245], MUST be used. Note that the 1390 remote endpoint may use a Lite implementation; implementations 1391 MUST properly handle remote endpoints which do ICE-Lite. 1393 R-2 DTLS [RFC6347] or DTLS-SRTP [RFC5763], MUST be used, as 1394 appropriate for the media type, as specified in 1395 [I-D.ietf-rtcweb-security-arch] 1397 5.1.3. Profile Names and Interoperability 1399 For media m= sections, JSEP endpoints MUST support both the "UDP/TLS/ 1400 RTP/SAVPF" and "TCP/DTLS/RTP/SAVPF" profiles and MUST indicate one of 1401 these two profiles for each media m= line they produce in an offer. 1402 For data m= sections, JSEP endpoints must support both the "UDP/DTLS/ 1403 SCTP" and "TCP/DTLS/SCTP" profiles and MUST indicate one of these two 1404 profiles for each data m= line they produce in an offer. Because ICE 1405 can select either TCP or UDP transport depending on network 1406 conditions, both advertisements are consistent with ICE eventually 1407 selecting either either UDP or TCP. 1409 Unfortunately, in an attempt at compatibility, some endpoints 1410 generate other profile strings even when they mean to support one of 1411 these profiles. For instance, an endpoint might generate "RTP/AVP" 1412 but supply "a=fingerprint" and "a=rtcp-fb" attributes, indicating its 1413 willingness to support "(UDP,TCP)/TLS/RTP/SAVPF". In order to 1414 simplify compatibility with such endpoints, JSEP endpoints MUST 1415 follow the following rules when processing the media m= sections in 1416 an offer: 1418 o The profile in any "m=" line in any answer MUST exactly match the 1419 profile provided in the offer. 1421 o Any profile matching the following patterns MUST be accepted: 1422 "RTP/[S]AVP[F]" and "(UDP/TCP)/TLS/RTP/SAVP[F]" 1424 o Because DTLS-SRTP is REQUIRED, the choice of SAVP or AVP has no 1425 effect; support for DTLS-SRTP is determined by the presence of one 1426 or more "a=fingerprint" attribute. Note that lack of an 1427 "a=fingerprint" attribute will lead to negotiation failure. 1429 o The use of AVPF or AVP simply controls the timing rules used for 1430 RTCP feedback. If AVPF is provided, or an "a=rtcp-fb" attribute 1431 is present, assume AVPF timing, i.e. a default value of "trr- 1432 int=0". Otherwise, assume that AVPF is being used in an AVP 1433 compatible mode and use AVP timing, i.e., "trr-int=4". 1435 o For data m= sections, JSEP endpoints MUST support receiving the 1436 "UDP/ DTLS/SCTP", "TCP/DTLS/SCTP", or "DTLS/SCTP" (for backwards 1437 compatibility) profiles. 1439 Note that re-offers by JSEP endpoints MUST use the correct profile 1440 strings even if the initial offer/answer exchange used an (incorrect) 1441 older profile string. 1443 5.2. Constructing an Offer 1445 When createOffer is called, a new SDP description must be created 1446 that includes the functionality specified in 1447 [I-D.ietf-rtcweb-rtp-usage]. The exact details of this process are 1448 explained below. 1450 5.2.1. Initial Offers 1452 When createOffer is called for the first time, the result is known as 1453 the initial offer. 1455 The first step in generating an initial offer is to generate session- 1456 level attributes, as specified in [RFC4566], Section 5. 1457 Specifically: 1459 o The first SDP line MUST be "v=0", as specified in [RFC4566], 1460 Section 5.1 1462 o The second SDP line MUST be an "o=" line, as specified in 1463 [RFC4566], Section 5.2. The value of the field SHOULD 1464 be "-". The value of the field SHOULD be a 1465 cryptographically random number. To ensure uniqueness, this 1466 number SHOULD be at least 64 bits long. The value of the field SHOULD be zero. The value of the 1468 tuple SHOULD be set to a non- 1469 meaningful address, such as IN IP4 0.0.0.0, to prevent leaking the 1470 local address in this field. As mentioned in [RFC4566], the 1471 entire o= line needs to be unique, but selecting a random number 1472 for is sufficient to accomplish this. 1474 o The third SDP line MUST be a "s=" line, as specified in [RFC4566], 1475 Section 5.3; to match the "o=" line, a single dash SHOULD be used 1476 as the session name, e.g. "s=-". Note that this differs from the 1477 advice in [RFC4566] which proposes a single space, but as both 1478 "o=" and "s=" are meaningless, having the same meaningless value 1479 seems clearer. 1481 o Session Information ("i="), URI ("u="), Email Address ("e="), 1482 Phone Number ("p="), Bandwidth ("b="), Repeat Times ("r="), and 1483 Time Zones ("z=") lines are not useful in this context and SHOULD 1484 NOT be included. 1486 o Encryption Keys ("k=") lines do not provide sufficient security 1487 and MUST NOT be included. 1489 o A "t=" line MUST be added, as specified in [RFC4566], Section 5.9; 1490 both and SHOULD be set to zero, e.g. "t=0 1491 0". 1493 o An "a=ice-options" line with the "trickle" option MUST be added, 1494 as specified in [I-D.ietf-ice-trickle], Section 4. 1496 The next step is to generate m= sections, as specified in [RFC4566] 1497 Section 5.14. An m= section is generated for each RtpTransceiver 1498 that has been added to the PeerConnection via the addTrack, 1499 addTransceiver, and setRemoteDescription methods. [[OPEN ISSUE: move 1500 discussion of setRemoteDescription to the subsequent-offer section.]] 1501 This is done in the order that their associated RtpTransceivers were 1502 added to the PeerConnection and excludes RtpTranscievers that are 1503 stopped and not associated with an m= section (either due to an m= 1504 section being recycled or an RtpTransceiver having been stopped 1505 before being associated with an m= section) . 1507 Each m= section, provided it is not marked as bundle-only, MUST 1508 generate a unique set of ICE credentials and gather its own unique 1509 set of ICE candidates. Bundle-only m= sections MUST NOT contain any 1510 ICE credentials and MUST NOT gather any candidates. 1512 For DTLS, all m= sections MUST use the certificate for the identity 1513 that has been specified for the PeerConnection; as a result, they 1514 MUST all have the same [RFC4572] fingerprint value, or this value 1515 MUST be a session-level attribute. 1517 Each m= section should be generated as specified in [RFC4566], 1518 Section 5.14. For the m= line itself, the following rules MUST be 1519 followed: 1521 o The port value is set to the port of the default ICE candidate for 1522 this m= section, but given that no candidates have yet been 1523 gathered, the "dummy" port value of 9 (Discard) MUST be used, as 1524 indicated in [I-D.ietf-ice-trickle], Section 5.1. 1526 o To properly indicate use of DTLS, the field MUST be set to 1527 "UDP/TLS/RTP/SAVPF", as specified in [RFC5764], Section 8, if the 1528 default candidate uses UDP transport, or "TCP/DTLS/RTP/SAVPF", as 1529 specified in[I-D.nandakumar-mmusic-proto-iana-registration] if the 1530 default candidate uses TCP transport. 1532 The m= line MUST be followed immediately by a "c=" line, as specified 1533 in [RFC4566], Section 5.7. Again, as no candidates have yet been 1534 gathered, the "c=" line must contain the "dummy" value "IN IP4 1535 0.0.0.0", as defined in [I-D.ietf-ice-trickle], Section 5.1. 1537 Each m= section MUST include the following attribute lines: 1539 o An "a=mid" line, as specified in [RFC5888], Section 4. When 1540 generating mid values, it is RECOMMENDED that the values be 3 1541 bytes or less, to allow them to efficiently fit into the RTP 1542 header extension defined in 1543 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 11. 1545 o An "a=rtcp" line, as specified in [RFC3605], Section 2.1, 1546 containing the dummy value "9 IN IP4 0.0.0.0", because no 1547 candidates have yet been gathered. 1549 o A direction attribute for the associated RtpTransceiver as 1550 described by Section 5.2.4. 1552 o For each supported codec, "a=rtpmap" and "a=fmtp" lines, as 1553 specified in [RFC4566], Section 6. The audio and video codecs 1554 that MUST be supported are specified in [I-D.ietf-rtcweb-audio] 1555 (see Section 3) and [I-D.ietf-rtcweb-video] (see Section 5). 1557 o If this m= section is for media with configurable frame sizes, 1558 e.g. audio, an "a=maxptime" line, indicating the smallest of the 1559 maximum supported frame sizes out of all codecs included above, as 1560 specified in [RFC4566], Section 6. 1562 o If this m= section is for video media, and there are known 1563 limitations on the size of images which can be decoded, an 1564 "a=imageattr" line, as specified in Section 3.6. 1566 o For each primary codec where RTP retransmission should be used, a 1567 corresponding "a=rtpmap" line indicating "rtx" with the clock rate 1568 of the primary codec and an "a=fmtp" line that references the 1569 payload type of the primary codec, as specified in [RFC4588], 1570 Section 8.1. 1572 o For each supported FEC mechanism, "a=rtpmap" and "a=fmtp" lines, 1573 as specified in [RFC4566], Section 6. The FEC mechanisms that 1574 MUST be supported are specified in [I-D.ietf-rtcweb-fec], 1575 Section 6, and specific usage for each media type is outlined in 1576 Sections 4 and 5. 1578 o "a=ice-ufrag" and "a=ice-pwd" lines, as specified in [RFC5245], 1579 Section 15.4. 1581 o An "a=fingerprint" line for each of the endpoint's certificates, 1582 as specified in [RFC4572], Section 5; the digest algorithm used 1583 for the fingerprint MUST match that used in the certificate 1584 signature. 1586 o An "a=setup" line, as specified in [RFC4145], Section 4, and 1587 clarified for use in DTLS-SRTP scenarios in [RFC5763], Section 5. 1588 The role value in the offer MUST be "actpass". 1590 o An "a=rtcp-mux" line, as specified in [RFC5761], Section 5.1.1. 1592 o An "a=rtcp-rsize" line, as specified in [RFC5506], Section 5. 1594 o For each supported RTP header extension, an "a=extmap" line, as 1595 specified in [RFC5285], Section 5. The list of header extensions 1596 that SHOULD/MUST be supported is specified in 1597 [I-D.ietf-rtcweb-rtp-usage], Section 5.2. Any header extensions 1598 that require encryption MUST be specified as indicated in 1599 [RFC6904], Section 4. 1601 o For each supported RTCP feedback mechanism, an "a=rtcp-fb" 1602 mechanism, as specified in [RFC4585], Section 4.2. The list of 1603 RTCP feedback mechanisms that SHOULD/MUST be supported is 1604 specified in [I-D.ietf-rtcweb-rtp-usage], Section 5.1. 1606 o An "a=ssrc" line, as specified in [RFC5576], Section 4.1, 1607 indicating the SSRC to be used for sending media, along with the 1608 mandatory "cname" source attribute, as specified in Section 6.1, 1609 indicating the CNAME for the source. The CNAME MUST be generated 1610 in accordance with Section 4.9 of [I-D.ietf-rtcweb-rtp-usage]. 1612 o If RTX is supported for this media type, another "a=ssrc" line 1613 with the RTX SSRC, and an "a=ssrc-group" line, as specified in 1614 [RFC5576], section 4.2, with semantics set to "FID" and including 1615 the primary and RTX SSRCs. 1617 o If FEC is supported for this media type, another "a=ssrc" line 1618 with the FEC SSRC, and an "a=ssrc-group" line with semantics set 1619 to "FEC-FR" and including the primary and FEC SSRCs, as specified 1620 in [RFC5956], section 4.3. For simplicity, if both RTX and FEC 1621 are supported, the FEC SSRC MUST be the same as the RTX SSRC. 1623 o If the bundle policy for this PeerConnection is set to "max- 1624 bundle", and this is not the first m= section, or the bundle 1625 policy is set to "balanced", and this is not the first m= section 1626 for this media type, an "a=bundle-only" line. 1628 o If the RtpSender of the RtpTransceiver associated with this 1629 m=section is active: 1631 * An "a=msid" line, as specified in [I-D.ietf-mmusic-msid], 1632 Section 2. 1634 * An "a=ssrc" line, as specified in [RFC5576], Section 4.1, 1635 indicating the SSRC to be used for sending media, along with 1636 the mandatory "cname" source attribute, as specified in 1637 Section 6.1, indicating the CNAME for the source. The CNAME 1638 MUST be generated in accordance with Section 4.9 of 1639 [I-D.ietf-rtcweb-rtp-usage]. 1641 * If RTX is supported for this media type, another "a=ssrc" line 1642 with the RTX SSRC, and an "a=ssrc-group" line, as specified in 1643 [RFC5576], section 4.2, with semantics set to "FID" and 1644 including the primary and RTX SSRCs. 1646 * If FEC is supported for this media type, another "a=ssrc" line 1647 with the FEC SSRC, and an "a=ssrc-group" line with semantics 1648 set to "FEC-FR" and including the primary and FEC SSRCs, as 1649 specified in [RFC5956], section 4.3. For simplicity, if both 1650 RTX and FEC are supported, the FEC SSRC MUST be the same as the 1651 RTX SSRC. 1653 o If the RtpTransceiver's RtpSender is active, and the application 1654 has specified RID values or has specified more than one encoding 1655 in the RtpSenders's parameters, an "a=rid" line for each encoding 1656 specified. The "a=rid" line is specified in 1657 [I-D.ietf-mmusic-rid], and its direction MUST be "send". If the 1658 application has chosen a RID value, it MUST be used as the rid- 1659 identifier; otherwise a RID value MUST be generated by the 1660 implementation. When generating RID values, it is RECOMMENDED 1661 that the values be 3 bytes or less, to allow them to efficiently 1662 fit into the RTP header extension defined in 1663 [I-D.ietf-avtext-rid], Section 11. If no encodings have been 1664 specified, or only one encoding is specified but without a RID 1665 value, then no "a=rid" lines are generated. 1667 o If the RtpTransceiver's RtpSender is active and more than one 1668 "a=rid" line has been generated, an "a=simulcast" line, with 1669 direction "send", as defined in [I-D.ietf-mmusic-sdp-simulcast], 1670 Section 6.2. The list of RIDs MUST include all of the RID 1671 identifiers used in the "a=rid" lines for this m= section. 1673 Lastly, if a data channel has been created, a m= section MUST be 1674 generated for data. The field MUST be set to "application" 1675 and the field MUST be set to "UDP/DTLS/SCTP" if the default 1676 candidate uses UDP transport, or "TCP/DTLS/SCTP" if the default 1677 candidate uses TCP transport [I-D.ietf-mmusic-sctp-sdp]. The "fmt" 1678 value MUST be set to "webrtc-datachannel" as specified in 1679 [I-D.ietf-mmusic-sctp-sdp], Section 4.1. 1681 Within the data m= section, the "a=mid", "a=ice-ufrag", "a=ice-pwd", 1682 "a=fingerprint", and "a=setup" lines MUST be included as mentioned 1683 above, along with an "a=fmtp:webrtc-datachannel" line and an "a=sctp- 1684 port" line referencing the SCTP port number as defined in 1685 [I-D.ietf-mmusic-sctp-sdp], Section 4.1. 1687 Once all m= sections have been generated, a session-level "a=group" 1688 attribute MUST be added as specified in [RFC5888]. This attribute 1689 MUST have semantics "bundle", and MUST include the mid identifiers of 1690 each m= section. The effect of this is that the browser offers all 1691 m= sections as one bundle group. However, whether the m= sections 1692 are bundle-only or not depends on the bundle policy. 1694 The next step is to generate session-level lip sync groups as defined 1695 in [RFC5888], Section 7. For each MediaStream referenced by more 1696 than one RtpTransceiver (by passing those MediaStreams as arguments 1697 to the addTrack and addTransceiver methods), a group of type "LS" 1698 MUST be added that contains the mid values for each RtpTransceiver. 1700 Attributes which SDP permits to either be at the session level or the 1701 media level SHOULD generally be at the media level even if they are 1702 identical. This promotes readability, especially if one of a set of 1703 initially identical attributes is subsequently changed. 1705 Attributes other than the ones specified above MAY be included, 1706 except for the following attributes which are specifically 1707 incompatible with the requirements of [I-D.ietf-rtcweb-rtp-usage], 1708 and MUST NOT be included: 1710 o "a=crypto" 1712 o "a=key-mgmt" 1714 o "a=ice-lite" 1716 Note that when bundle is used, any additional attributes that are 1717 added MUST follow the advice in [I-D.ietf-mmusic-sdp-mux-attributes] 1718 on how those attributes interact with bundle. 1720 Note that these requirements are in some cases stricter than those of 1721 SDP. Implementations MUST be prepared to accept compliant SDP even 1722 if it would not conform to the requirements for generating SDP in 1723 this specification. 1725 5.2.2. Subsequent Offers 1727 When createOffer is called a second (or later) time, or is called 1728 after a local description has already been installed, the processing 1729 is somewhat different than for an initial offer. 1731 If the initial offer was not applied using setLocalDescription, 1732 meaning the PeerConnection is still in the "stable" state, the steps 1733 for generating an initial offer should be followed, subject to the 1734 following restriction: 1736 o The fields of the "o=" line MUST stay the same except for the 1737 field, which MUST increment if the session 1738 description changes in any way, including the addition of ICE 1739 candidates. 1741 If the initial offer was applied using setLocalDescription, but an 1742 answer from the remote side has not yet been applied, meaning the 1743 PeerConnection is still in the "local-offer" state, an offer is 1744 generated by following the steps in the "stable" state above, along 1745 with these exceptions: 1747 o The "s=" and "t=" lines MUST stay the same. 1749 o If any RtpTransceiver has been added, and there exists an m= 1750 section with a zero port in the current local description or the 1751 current remote description, that m= section MUST be recycled by 1752 generating an m= section for the added RtpTransceiver as if the m= 1753 section were being added to the session description, placed at the 1754 same index as the m= section with a zero port. 1756 o If an RtpTransceiver is stopped and is not associated with an m= 1757 section, an m= section MUST NOT be generated for it. This 1758 prevents adding back RtpTransceivers whose m= sections were 1759 recycled and used for a new RtpTransceiver in a previous offer/ 1760 answer exchange, as described above. 1762 o If an RtpTransceiver has been stopped and is associated with an m= 1763 section, and the m= section is not being recycled as described 1764 above, an m= section MUST be generated for it with the port set to 1765 zero and the "a=msid", "a=ssrc", and "a=ssrc-group" lines removed. 1767 o For RtpTransceivers that are not stopped, the "a=msid", "a=ssrc", 1768 and "a=ssrc-group" lines MUST stay the same if they are present in 1769 the current description. 1771 o Each "m=" and c=" line MUST be filled in with the port, protocol, 1772 and address of the default candidate for the m= section, as 1773 described in [RFC5245], Section 4.3. If ICE checking has already 1774 completed for one or more candidate pairs and a candidate pair is 1775 in active use, then that pair MUST be used, even if ICE has not 1776 yet completed. Note that this differs from the guidance in 1777 [RFC5245], Section 9.1.2.2, which only refers to offers created 1778 when ICE has completed. Each "a=rtcp" attribute line MUST also be 1779 filled in with the port and address of the appropriate default 1780 candidate, either the default RTP or RTCP candidate, depending on 1781 whether RTCP multiplexing is currently active or not. Note that 1782 if RTCP multiplexing is being offered, but not yet active, the 1783 default RTCP candidate MUST be used, as indicated in [RFC5761], 1784 section 5.1.3. In each case, if no candidates of the desired type 1785 have yet been gathered, dummy values MUST be used, as described 1786 above. 1788 o Each "a=mid" line MUST stay the same. 1790 o Each "a=ice-ufrag" and "a=ice-pwd" line MUST stay the same, unless 1791 the ICE configuration has changed (either changes to the supported 1792 STUN/TURN servers, or the ICE candidate policy), or the 1793 "IceRestart" option (Section 5.2.3.1 was specified. If the m= 1794 section is bundled into another m= section, it still MUST NOT 1795 contain any ICE credentials. 1797 o If the m= section is not bundled into another m= section, for each 1798 candidate that has been gathered during the most recent gathering 1799 phase (see Section 3.5.1), an "a=candidate" line MUST be added, as 1800 defined in [RFC5245], Section 4.3., paragraph 3. If candidate 1801 gathering for the section has completed, an "a=end-of-candidates" 1802 attribute MUST be added, as described in [I-D.ietf-ice-trickle], 1803 Section 9.3. If the m= section is bundled into another m= 1804 section, both "a=candidate" and "a=end-of-candidates" MUST be 1805 omitted. 1807 o For RtpTransceivers that are still present, the "a=msid", 1808 "a=ssrc", and "a=ssrc-group" lines MUST stay the same. 1810 o For RtpTransceivers that are still present, the "a=rid" lines MUST 1811 stay the same. 1813 o For RtpTransceivers that are still present, any "a=simulcast" line 1814 MUST stay the same. 1816 o If any RtpTransceiver has been stopped, the port MUST be set to 1817 zero and the "a=msid", "a=ssrc", and "a=ssrc-group" lines MUST be 1818 removed. 1820 o If any RtpTransceiver has been added, and there exists a m= 1821 section with a zero port in the current local description or the 1822 current remote description, that m= section MUST be recycled by 1823 generating a m= section for the added RtpTransceiver as if the m= 1824 section were being added to session description, except that 1825 instead of adding it, the generated m= section replaces the m= 1826 section with a zero port. 1828 If the initial offer was applied using setLocalDescription, and an 1829 answer from the remote side has been applied using 1830 setRemoteDescription, meaning the PeerConnection is in the "remote- 1831 pranswer" or "stable" states, an offer is generated based on the 1832 negotiated session descriptions by following the steps mentioned for 1833 the "local-offer" state above. 1835 In addition, for each non-recycled, non-rejected m= section in the 1836 new offer, the following adjustments are made based on the contents 1837 of the corresponding m= section in the current remote description: 1839 o The m= line and corresponding "a=rtpmap" and "a=fmtp" lines MUST 1840 only include codecs present in the remote description. 1842 o The RTP header extensions MUST only include those that are present 1843 in the remote description. 1845 o The RTCP feedback extensions MUST only include those that are 1846 present in the remote description. 1848 o The "a=rtcp-mux" line MUST only be added if present in the remote 1849 description. 1851 o The "a=rtcp-rsize" line MUST only be added if present in the 1852 remote description. 1854 The "a=group:BUNDLE" attribute MUST include the mid identifiers 1855 specified in the bundle group in the most recent answer, minus any m= 1856 sections that have been marked as rejected, plus any newly added or 1857 re-enabled m= sections. In other words, the bundle attribute must 1858 contain all m= sections that were previously bundled, as long as they 1859 are still alive, as well as any new m= sections. 1861 The "LS" groups are generated in the same way as with initial offers. 1863 5.2.3. Options Handling 1865 The createOffer method takes as a parameter an RTCOfferOptions 1866 object. Special processing is performed when generating a SDP 1867 description if the following options are present. 1869 5.2.3.1. IceRestart 1871 If the "IceRestart" option is specified, with a value of "true", the 1872 offer MUST indicate an ICE restart by generating new ICE ufrag and 1873 pwd attributes, as specified in [RFC5245], Section 9.1.1.1. If this 1874 option is specified on an initial offer, it has no effect (since a 1875 new ICE ufrag and pwd are already generated). Similarly, if the ICE 1876 configuration has changed, this option has no effect, since new ufrag 1877 and pwd attributes will be generated automatically. This option is 1878 primarily useful for reestablishing connectivity in cases where 1879 failures are detected by the application. 1881 5.2.3.2. VoiceActivityDetection 1883 If the "VoiceActivityDetection" option is specified, with a value of 1884 "true", the offer MUST indicate support for silence suppression in 1885 the audio it receives by including comfort noise ("CN") codecs for 1886 each offered audio codec, as specified in [RFC3389], Section 5.1, 1887 except for codecs that have their own internal silence suppression 1888 support. For codecs that have their own internal silence suppression 1889 support, the appropriate fmtp parameters for that codec MUST be 1890 specified to indicate that silence suppression for received audio is 1891 desired. For example, when using the Opus codec, the "usedtx=1" 1892 parameter would be specified in the offer. This option allows the 1893 endpoint to significantly reduce the amount of audio bandwidth it 1894 receives, at the cost of some fidelity, depending on the quality of 1895 the remote VAD algorithm. 1897 If the "VoiceActivityDetection" option is specified, with a value of 1898 "false", the browser MUST NOT emit "CN" codecs. For codecs that have 1899 their own internal silence suppression support, the appropriate fmtp 1900 parameters for that codec MUST be specified to indicate that silence 1901 suppression for received audio is not desired. For example, when 1902 using the Opus codec, the "usedtx=0" parameter would be specified in 1903 the offer. 1905 Note that setting the "VoiceActivityDetection" parameter when 1906 generating an offer is a request to receive audio with silence 1907 suppression. It has no impact on whether the local endpoint does 1908 silence suppression for the audio it sends. 1910 The "VoiceActivityDetection" option does not have any impact on the 1911 setting of the "vad" value in the signaling of the client to mixer 1912 audio level header extension described in [RFC6464], Section 4. 1914 5.2.4. Direction Attribute in Offers 1916 [RFC3264] direction attributes (defined in Section 6.1) in offers are 1917 chosen according to the states of the RtpSender and RtpReceiver of a 1918 given RtpTransceiver, as follows: 1920 +-----------+-------------+-----------------+ 1921 | RtpSender | RtpReceiver | offer direction | 1922 +-----------+-------------+-----------------+ 1923 | active | active | sendrecv | 1924 | active | inactive | sendonly | 1925 | inactive | active | recvonly | 1926 | inactive | inactive | inactive | 1927 +-----------+-------------+-----------------+ 1929 5.3. Generating an Answer 1931 When createAnswer is called, a new SDP description must be created 1932 that is compatible with the supplied remote description as well as 1933 the requirements specified in [I-D.ietf-rtcweb-rtp-usage]. The exact 1934 details of this process are explained below. 1936 5.3.1. Initial Answers 1938 When createAnswer is called for the first time after a remote 1939 description has been provided, the result is known as the initial 1940 answer. If no remote description has been installed, an answer 1941 cannot be generated, and an error MUST be returned. 1943 Note that the remote description SDP may not have been created by a 1944 JSEP endpoint and may not conform to all the requirements listed in 1945 Section 5.2. For many cases, this is not a problem. However, if any 1946 mandatory SDP attributes are missing, or functionality listed as 1947 mandatory-to-use above is not present, this MUST be treated as an 1948 error, and MUST cause the affected m= sections to be marked as 1949 rejected. 1951 The first step in generating an initial answer is to generate 1952 session-level attributes. The process here is identical to that 1953 indicated in the Initial Offers section above, except that the 1954 "a=ice-options" line, with the "trickle" option as specified in 1955 [I-D.ietf-ice-trickle], Section 4, is only included if such an option 1956 was present in the offer. 1958 The next step is to generate lip sync groups as defined in [RFC5888], 1959 Section 7. For each MediaStream with more than one referenced 1960 RtpTransceiver, a group of type "LS" MUST be added that contains the 1961 mid values for each RtpTransceiver added with that MediaStream. In 1962 some cases this may result in adding a mid to a given LS group that 1963 was not in that LS group in the associated offer. Although this is 1964 not allowed by [RFC5888], it is allowed when implementing this 1965 specification. [[OPEN ISSUE: This is still under discussion. See: 1966 https://github.com/rtcweb-wg/jsep/issues/162.]] 1968 The next step is to generate m= sections for each m= section that is 1969 present in the remote offer, as specified in [RFC3264], Section 6. 1970 For the purposes of this discussion, any session-level attributes in 1971 the offer that are also valid as media-level attributes SHALL be 1972 considered to be present in each m= section. 1974 The next step is to go through each offered m= section. Each offered 1975 m= section will have an associated RtpTransceiver, as described in 1976 Section 5.8. If there are more RtpTransceivers than there are m= 1977 sections, the unmatched RtpTransceivers will need to be associated in 1978 a subsequent offer. 1980 For each offered m= section, if the associated RtpTransceiver has 1981 been stopped, the corresponding m= section in the answer MUST be 1982 marked as rejected by setting the port in the m= line to zero, as 1983 indicated in [RFC3264], Section 6., and further processing for this 1984 m= section can be skipped. 1986 Provided that is not the case, each m= section in the answer should 1987 then be generated as specified in [RFC3264], Section 6.1. For the m= 1988 line itself, the following rules must be followed: 1990 o The port value would normally be set to the port of the default 1991 ICE candidate for this m= section, but given that no candidates 1992 have yet been gathered, the "dummy" port value of 9 (Discard) MUST 1993 be used, as indicated in [I-D.ietf-ice-trickle], Section 5.1. 1995 o The field MUST be set to exactly match the field 1996 for the corresponding m= line in the offer. 1998 The m= line MUST be followed immediately by a "c=" line, as specified 1999 in [RFC4566], Section 5.7. Again, as no candidates have yet been 2000 gathered, the "c=" line must contain the "dummy" value "IN IP4 2001 0.0.0.0", as defined in [I-D.ietf-ice-trickle], Section 5.1. 2003 If the offer supports bundle, all m= sections to be bundled must use 2004 the same ICE credentials and candidates; all m= sections not being 2005 bundled must use unique ICE credentials and candidates. Each m= 2006 section MUST include the following: 2008 o If and only if present in the offer, an "a=mid" line, as specified 2009 in [RFC5888], Section 9.1. The "mid" value MUST match that 2010 specified in the offer. 2012 o An "a=rtcp" line, as specified in [RFC3605], Section 2.1, 2013 containing the dummy value "9 IN IP4 0.0.0.0", because no 2014 candidates have yet been gathered. 2016 o A direction attribute for the associated RtpTransceiver described 2017 by Section 5.3.4. 2019 o For each supported codec that is present in the offer, "a=rtpmap" 2020 and "a=fmtp" lines, as specified in [RFC4566], Section 6, and 2021 [RFC3264], Section 6.1. The audio and video codecs that MUST be 2022 supported are specified in [I-D.ietf-rtcweb-audio] (see Section 3) 2023 and [I-D.ietf-rtcweb-video] (see Section 5). 2025 o If this m= section is for media with configurable frame sizes, 2026 e.g. audio, an "a=maxptime" line, indicating the smallest of the 2027 maximum supported frame sizes out of all codecs included above, as 2028 specified in [RFC4566], Section 6. 2030 o If this m= section is for video media, and there are known 2031 limitations on the size of images which can be decoded, an 2032 "a=imageattr" line, as specified in Section 3.6. 2034 o If "rtx" is present in the offer, for each primary codec where RTP 2035 retransmission should be used, a corresponding "a=rtpmap" line 2036 indicating "rtx" with the clock rate of the primary codec and an 2037 "a=fmtp" line that references the payload type of the primary 2038 codec, as specified in [RFC4588], Section 8.1. 2040 o For each supported FEC mechanism, "a=rtpmap" and "a=fmtp" lines, 2041 as specified in [RFC4566], Section 6. The FEC mechanisms that 2042 MUST be supported are specified in [I-D.ietf-rtcweb-fec], 2043 Section 6, and specific usage for each media type is outlined in 2044 Sections 4 and 5. 2046 o "a=ice-ufrag" and "a=ice-pwd" lines, as specified in [RFC5245], 2047 Section 15.4. 2049 o An "a=fingerprint" line for each of the endpoint's certificates, 2050 as specified in [RFC4572], Section 5; the digest algorithm used 2051 for the fingerprint MUST match that used in the certificate 2052 signature. 2054 o An "a=setup" line, as specified in [RFC4145], Section 4, and 2055 clarified for use in DTLS-SRTP scenarios in [RFC5763], Section 5. 2056 The role value in the answer MUST be "active" or "passive"; the 2057 "active" role is RECOMMENDED. 2059 o If present in the offer, an "a=rtcp-mux" line, as specified in 2060 [RFC5761], Section 5.1.1. If the "require" RTCP multiplexing 2061 policy is set and no "a=rtcp-mux" line is present in the offer, 2062 then the m=line MUST be marked as rejected by setting the port in 2063 the m= line to zero, as indicated in [RFC3264], Section 6. 2065 o If present in the offer, an "a=rtcp-rsize" line, as specified in 2066 [RFC5506], Section 5. 2068 o For each supported RTP header extension that is present in the 2069 offer, an "a=extmap" line, as specified in [RFC5285], Section 5. 2070 The list of header extensions that SHOULD/MUST be supported is 2071 specified in [I-D.ietf-rtcweb-rtp-usage], Section 5.2. Any header 2072 extensions that require encryption MUST be specified as indicated 2073 in [RFC6904], Section 4. 2075 o For each supported RTCP feedback mechanism that is present in the 2076 offer, an "a=rtcp-fb" mechanism, as specified in [RFC4585], 2077 Section 4.2. The list of RTCP feedback mechanisms that SHOULD/ 2078 MUST be supported is specified in [I-D.ietf-rtcweb-rtp-usage], 2079 Section 5.1. 2081 o If the RtpSender of the RtpTransceiver associated with this 2082 m=section is active: 2084 * An "a=msid" line, as specified in [I-D.ietf-mmusic-msid], 2085 Section 2. 2087 * An "a=ssrc" line, as specified in [RFC5576], Section 4.1, 2088 indicating the SSRC to be used for sending media, along with 2089 the mandatory "cname" source attribute, as specified in 2090 Section 6.1, indicating the CNAME for the source. The CNAME 2091 MUST be generated in accordance with Section 4.9 of 2092 [I-D.ietf-rtcweb-rtp-usage]. 2094 * If RTX has been negotiated for this m= section, another 2095 "a=ssrc" line with the RTX SSRC, and an "a=ssrc-group" line, as 2096 specified in [RFC5576], section 4.2, with semantics set to 2097 "FID" and including the primary and RTX SSRCs. 2099 * If FEC has been negotiated for this m= section, another 2100 "a=ssrc" line with the FEC SSRC, and an "a=ssrc-group" line 2101 with semantics set to "FEC-FR" and including the primary and 2102 FEC SSRCs, as specified in [RFC5956], section 4.3. For 2103 simplicity, if both RTX and FEC are supported, the FEC SSRC 2104 MUST be the same as the RTX SSRC. 2106 If a data channel m= section has been offered, a m= section MUST also 2107 be generated for data. The field MUST be set to 2108 "application" and the and "fmt" fields MUST be set to exactly 2109 match the fields in the offer. 2111 Within the data m= section, the "a=mid", "a=ice-ufrag", "a=ice-pwd", 2112 "a=candidate", "a=fingerprint", and "a=setup" lines MUST be included 2113 as mentioned above, along with an "a=fmtp:webrtc-datachannel" line 2114 and an "a=sctp-port" line referencing the SCTP port number as defined 2115 in [I-D.ietf-mmusic-sctp-sdp], Section 4.1. 2117 If "a=group" attributes with semantics of "BUNDLE" are offered, 2118 corresponding session-level "a=group" attributes MUST be added as 2119 specified in [RFC5888]. These attributes MUST have semantics 2120 "BUNDLE", and MUST include the all mid identifiers from the offered 2121 bundle groups that have not been rejected. Note that regardless of 2122 the presence of "a=bundle-only" in the offer, no m= sections in the 2123 answer should have an "a=bundle-only" line. 2125 Attributes that are common between all m= sections MAY be moved to 2126 session-level, if explicitly defined to be valid at session-level. 2128 The attributes prohibited in the creation of offers are also 2129 prohibited in the creation of answers. 2131 5.3.2. Subsequent Answers 2133 When createAnswer is called a second (or later) time, or is called 2134 after a local description has already been installed, the processing 2135 is somewhat different than for an initial answer. 2137 If the initial answer was not applied using setLocalDescription, 2138 meaning the PeerConnection is still in the "have-remote-offer" state, 2139 the steps for generating an initial answer should be followed, 2140 subject to the following restriction: 2142 o The fields of the "o=" line MUST stay the same except for the 2143 field, which MUST increment if the session 2144 description changes in any way from the previously generated 2145 answer. 2147 If any session description was previously supplied to 2148 setLocalDescription, an answer is generated by following the steps in 2149 the "have-remote-offer" state above, along with these exceptions: 2151 o The "s=" and "t=" lines MUST stay the same. 2153 o Each "m=" and c=" line MUST be filled in with the port and address 2154 of the default candidate for the m= section, as described in 2155 [RFC5245], Section 4.3. Note, however, that the m= line protocol 2156 need not match the default candidate, because this protocol value 2157 must instead match what was supplied in the offer, as described 2158 above. Each "a=rtcp" attribute line MUST also be filled in with 2159 the port and address of the appropriate default candidate, either 2160 the default RTP or RTCP candidate, depending on whether RTCP 2161 multiplexing is enabled in the answer. In each case, if no 2162 candidates of the desired type have yet been gathered, dummy 2163 values MUST be used, as described in the initial answer section 2164 above. 2166 o Each "a=ice-ufrag" and "a=ice-pwd" line MUST stay the same, unless 2167 the m= section is restarting, in which case new ICE credentials 2168 must be created as specified in [RFC5245], Section 9.2.1.1. If 2169 the m= section is bundled into another m= section, it still MUST 2170 NOT contain any ICE credentials. 2172 o If the m= section is not bundled into another m= section, for each 2173 candidate that has been gathered during the most recent gathering 2174 phase (see Section 3.5.1), an "a=candidate" line MUST be added, as 2175 defined in [RFC5245], Section 4.3., paragraph 3. If candidate 2176 gathering for the section has completed, an "a=end-of-candidates" 2177 attribute MUST be added, as described in [I-D.ietf-ice-trickle], 2178 Section 9.3. If the m= section is bundled into another m= 2179 section, both "a=candidate" and "a=end-of-candidates" MUST be 2180 omitted. 2182 o For RtpTransceivers that are not stopped, the "a=msid", "a=ssrc", 2183 and "a=ssrc-group" lines MUST stay the same. 2185 5.3.3. Options Handling 2187 The createAnswer method takes as a parameter an RTCAnswerOptions 2188 object. The set of parameters for RTCAnswerOptions is different than 2189 those supported in RTCOfferOptions; the IceRestart option is 2190 unnecessary, as ICE credentials will automatically be changed for all 2191 m= lines where the offerer chose to perform ICE restart. 2193 The following options are supported in RTCAnswerOptions. 2195 5.3.3.1. VoiceActivityDetection 2197 Silence suppression in the answer is handled as described in 2198 Section 5.2.3.2, with one exception: if support for silence 2199 suppression was not indicated in the offer, the 2200 VoiceActivityDetection parameter has no effect, and the answer should 2201 be generated as if VoiceActivityDetection was set to false. This is 2202 done on a per-codec basis (e.g., if the offerer somehow offered 2203 support for CN but set "usedtx=0" for Opus, setting 2204 VoiceActivityDetection to true would result in an answer with CN 2205 codecs and "usedtx=0"). 2207 5.3.4. Direction Attribute in Answers 2209 [RFC3264] direction attributes (defined in Section 6.1) in answers 2210 are chosen according to the direction attribute in the remote offer 2211 and the states of the RtpSender and RtpReceiver of the corresponding 2212 RtpTransceiver, as follows: 2214 +-----------------+-----------+-------------+------------------+ 2215 | offer direction | RtpSender | RtpReceiver | answer direction | 2216 +-----------------+-----------+-------------+------------------+ 2217 | sendrecv | active | active | sendrecv | 2218 | sendrecv | active | inactive | sendonly | 2219 | sendrecv | inactive | active | recvonly | 2220 | sendrecv | inactive | inactive | inactive | 2221 | sendonly | * | active | recvonly | 2222 | sendonly | * | inactive | inactive | 2223 | recvonly | active | * | sendonly | 2224 | recvonly | inactive | * | inactive | 2225 | inactive | * | * | inactive | 2226 +-----------------+-----------+-------------+------------------+ 2228 5.4. Processing a Local Description 2230 When a SessionDescription is supplied to setLocalDescription, the 2231 following steps MUST be performed: 2233 o First, the type of the SessionDescription is checked against the 2234 current state of the PeerConnection: 2236 * If the type is "offer", the PeerConnection state MUST be either 2237 "stable" or "have-local-offer". 2239 * If the type is "pranswer" or "answer", the PeerConnection state 2240 MUST be either "have-remote-offer" or "have-local-pranswer". 2242 o If the type is not correct for the current state, processing MUST 2243 stop and an error MUST be returned. 2245 o Next, the SessionDescription is parsed into a data structure, as 2246 described in the Section 5.6 section below. If parsing fails for 2247 any reason, processing MUST stop and an error MUST be returned. 2249 o Finally, the parsed SessionDescription is applied as described in 2250 the Section 5.7 section below. 2252 5.5. Processing a Remote Description 2254 When a SessionDescription is supplied to setRemoteDescription, the 2255 following steps MUST be performed: 2257 o First, the type of the SessionDescription is checked against the 2258 current state of the PeerConnection: 2260 * If the type is "offer", the PeerConnection state MUST be either 2261 "stable" or "have-remote-offer". 2263 * If the type is "pranswer" or "answer", the PeerConnection state 2264 MUST be either "have-local-offer" or "have-remote-pranswer". 2266 o If the type is not correct for the current state, processing MUST 2267 stop and an error MUST be returned. 2269 o Next, the SessionDescription is parsed into a data structure, as 2270 described in the Section 5.6 section below. If parsing fails for 2271 any reason, processing MUST stop and an error MUST be returned. 2273 o Finally, the parsed SessionDescription is applied as described in 2274 the Section 5.8 section below. 2276 5.6. Parsing a Session Description 2278 When a SessionDescription of any type is supplied to setLocal/ 2279 RemoteDescription, the implementation must parse it and reject it if 2280 it is invalid. The exact details of this process are explained 2281 below. 2283 The SDP contained in the session description object consists of a 2284 sequence of text lines, each containing a key-value expression, as 2285 described in [RFC4566], Section 5. The SDP is read, line-by-line, 2286 and converted to a data structure that contains the deserialized 2287 information. However, SDP allows many types of lines, not all of 2288 which are relevant to JSEP applications. For each line, the 2289 implementation will first ensure it is syntactically correct 2290 according its defining ABNF, check that it conforms to [RFC4566] and 2291 [RFC3264] semantics, and then either parse and store or discard the 2292 provided value, as described below. A partial list of ABNF 2293 definitions for SDP attributes can found in: 2295 +---------------------------+------------------------------------+ 2296 | Attribute | Reference | 2297 +---------------------------+------------------------------------+ 2298 | ptime | [RFC4566] Section 9 | 2299 | maxptime | [RFC4566] Section 9 | 2300 | rtpmap | [RFC4566] Section 9 | 2301 | recvonly | [RFC4566] Section 9 | 2302 | sendrecv | [RFC4566] Section 9 | 2303 | sendonly | [RFC4566] Section 9 | 2304 | inactive | [RFC4566] Section 9 | 2305 | framerate | [RFC4566] Section 9 | 2306 | fmtp | [RFC4566] Section 9 | 2307 | quality | [RFC4566] Section 9 | 2308 | msid | [I-D.ietf-mmusic-msid] Section 2 | 2309 | rtcp | [RFC3605] Section 2.1 | 2310 | setup | [RFC4145] Section 3, 4, and 5 | 2311 | connection | [RFC4145] Section 3, 4, and 5 | 2312 | fingerprint | [RFC4572] Section 5 | 2313 | rtcp-fb | [RFC4585] Section 4.2 | 2314 | candidate | [RFC5245] Section 15 | 2315 | extmap | [RFC5285] Section 7 | 2316 | mid | [RFC5888] Section 4 and 5 | 2317 | group | [RFC5888] Section 4 and 5 | 2318 | imageattr | [RFC6236] Section 3.1 | 2319 | extmap (encrypt option) | [RFC6904] Section 4 | 2320 +---------------------------+------------------------------------+ 2322 Table 1: SDP ABNF References 2324 [TODO: ensure that every line is listed below.] 2326 If the line is not well-formed, or cannot be parsed as described, the 2327 parser MUST stop with an error and reject the session description. 2328 This ensures that implementations do not accidentally misinterpret 2329 ambiguous SDP. 2331 5.6.1. Session-Level Parsing 2333 First, the session-level lines are checked and parsed. These lines 2334 MUST occur in a specific order, and with a specific syntax, as 2335 defined in [RFC4566], Section 5. Note that while the specific line 2336 types (e.g. "v=", "c=") MUST occur in the defined order, lines of the 2337 same type (typically "a=") can occur in any order, and their ordering 2338 is not meaningful. 2340 For non-attribute (non-"a=") lines, their sequencing, syntax, and 2341 semantics, are checked, as mentioned above. The following lines are 2342 not meaningful in the JSEP context and MAY be discarded once they 2343 have been checked. 2345 The "c=" line MUST be checked for syntax but its value is not 2346 used. This supersedes the guidance in [RFC5245], Section 6.1, to 2347 use "ice-mismatch" to indicate mismatches between "c=" and the 2348 candidate lines; because JSEP always uses ICE, "ice-mismatch" is 2349 not useful in this context. 2351 The "i=", "u=", "e=", "p=", "t=", "r=", "z=", and "k=" lines are 2352 not used by this specification; they MUST be checked for syntax 2353 but their values are not used. 2355 The remaining lines are processed as follows: 2357 The "v=" line MUST have a version of 0, as specified in [RFC4566], 2358 Section 5.1. 2360 The "o=" line MUST be parsed as specified in [RFC4566], 2361 Section 5.2. 2363 The "b=" line, if present, MUST be parsed as specified in 2364 [RFC4566], Section 5.8, and the bwtype and bandwidth values 2365 stored. 2367 Specific processing MUST be applied for the following session-level 2368 attribute ("a=") lines: 2370 o Any "a=group" lines are parsed as specified in [RFC5888], 2371 Section 5, and the group's semantics and mids are stored. 2373 o If present, a single "a=ice-lite" line is parsed as specified in 2374 [RFC5245], Section 15.3, and a value indicating the presence of 2375 ice-lite is stored. 2377 o If present, a single "a=ice-ufrag" line is parsed as specified in 2378 [RFC5245], Section 15.4, and the ufrag value is stored. 2380 o If present, a single "a=ice-pwd" line is parsed as specified in 2381 [RFC5245], Section 15.4, and the password value is stored. 2383 o If present, a single "a=ice-options" line is parsed as specified 2384 in [RFC5245], Section 15.5, and the set of specified options is 2385 stored. 2387 o Any "a=fingerprint" lines are parsed as specified in [RFC4572], 2388 Section 5, and the set of fingerprint and algorithm values is 2389 stored. 2391 o If present, a single "a=setup" line is parsed as specified in 2392 [RFC4145], Section 4, and the setup value is stored. 2394 o Any "a=extmap" lines are parsed as specified in [RFC5285], 2395 Section 5, and their values are stored. 2397 o TODO: identity, rtcp-rsize, rtcp-mux, and any other attribs valid 2398 at session level. 2400 Once all the session-level lines have been parsed, processing 2401 continues with the lines in media sections. 2403 5.6.2. Media Section Parsing 2405 Like the session-level lines, the media session lines MUST occur in 2406 the specific order and with the specific syntax defined in [RFC4566], 2407 Section 5. 2409 The "m=" line itself MUST be parsed as described in [RFC4566], 2410 Section 5.14, and the media, port, proto, and fmt values stored. 2412 Following the "m=" line, specific processing MUST be applied for the 2413 following non-attribute lines: 2415 o As with the "c=" line at the session level, the "c=" line MUST be 2416 parsed according to [RFC4566], Section 5.7, but its value is not 2417 used. 2419 o The "b=" line, if present, MUST be parsed as specified in 2420 [RFC4566], Section 5.8, and the bwtype and bandwidth values 2421 stored. 2423 Specific processing MUST also be applied for the following attribute 2424 lines: 2426 o If present, a single "a=ice-ufrag" line is parsed as specified in 2427 [RFC5245], Section 15.4, and the ufrag value is stored. 2429 o If present, a single "a=ice-pwd" line is parsed as specified in 2430 [RFC5245], Section 15.4, and the password value is stored. 2432 o If present, a single "a=ice-options" line is parsed as specified 2433 in [RFC5245], Section 15.5, and the set of specified options is 2434 stored. 2436 o Any "a=fingerprint" lines are parsed as specified in [RFC4572], 2437 Section 5, and the set of fingerprint and algorithm values is 2438 stored. 2440 o If present, a single "a=setup" line is parsed as specified in 2441 [RFC4145], Section 4, and the setup value is stored. 2443 If the "m=" proto value indicates use of RTP, as decribed in the 2444 Section 5.1.3 section above, the following attribute lines MUST be 2445 processed: 2447 o The "m=" fmt value MUST be parsed as specified in [RFC4566], 2448 Section 5.14, and the individual values stored. 2450 o Any "a=rtpmap" or "a=fmtp" lines MUST be parsed as specified in 2451 [RFC4566], Section 6, and their values stored. 2453 o If present, a single "a=ptime" line MUST be parsed as described in 2454 [RFC4566], Section 6, and its value stored. 2456 o If present, a single "a=maxptime" line MUST be parsed as described 2457 in [RFC4566], Section 6, and its value stored. 2459 o If present, a single direction attribute line (e.g. "a=sendrecv") 2460 MUST be parsed as described in [RFC4566], Section 6, and its value 2461 stored. 2463 o Any "a=ssrc" or "a=ssrc-group" attributes MUST be parsed as 2464 specified in [RFC5576], Sections 4.1-4.2, and their values stored. 2466 o Any "a=extmap" attributes MUST be parsed as specified in 2467 [RFC5285], Section 5, and their values stored. 2469 o Any "a=rtcp-fb" attributes MUST be parsed as specified in 2470 [RFC4585], Section 4.2., and their values stored. 2472 o If present, a single "a=rtcp-mux" attribute MUST be parsed as 2473 specified in [RFC5761], Section 5.1.1, and its presence or absence 2474 flagged and stored. 2476 o If present, a single "a=rtcp-rsize" attribute MUST be parsed as 2477 specified in [RFC5506], Section 5, and its presence or absence 2478 flagged and stored. 2480 o If present, a single "a=rtcp" attribute MUST be parsed as 2481 specified in [RFC3605], Section 2.1, but its value is ignored. 2483 o If present, a single "a=msid" attribute MUST be parsed as 2484 specified in [I-D.ietf-mmusic-msid], Section 3.2, and its value 2485 stored. 2487 o Any "a=candidate" attributes MUST be parsed as specified in 2488 [RFC5245], Section 4.3, and their values stored. 2490 o Any "a=remote-candidates" attributes MUST be parsed as specified 2491 in [RFC5245], Section 4.3, but their values are ignored. 2493 o If present, a single "a=end-of-candidates" attribute MUST be 2494 parsed as specified in [I-D.ietf-ice-trickle], Section 8.2, and 2495 its presence or absence flagged and stored. 2497 o Any "a=imageattr" attributes MUST be parsed as specified in 2498 [RFC6236], Section 3, and their values stored. 2500 o Any "a=rid" lines MUST be parsed as specified in 2501 [I-D.ietf-mmusic-rid], Section 10, and their values stored. 2503 o If present, a single "a=simulcast" line MUST be parsed as 2504 specified in [I-D.ietf-mmusic-sdp-simulcast], and its values 2505 stored. 2507 Otherwise, if the "m=" proto value indicates use of SCTP, the 2508 following attribute lines MUST be processed: 2510 o The "m=" fmt value MUST be parsed as specified in 2511 [I-D.ietf-mmusic-sctp-sdp], Section 4.3, and the application 2512 protocol value stored. 2514 o An "a=sctp-port" attribute MUST be present, and it MUST be parsed 2515 as specified in [I-D.ietf-mmusic-sctp-sdp], Section 5.2, and the 2516 value stored. 2518 o If present, a single "a=max-message-size" attribute MUST be parsed 2519 as specified in [I-D.ietf-mmusic-sctp-sdp], Section 6, and the 2520 value stored. Otherwise, use the specified default. 2522 5.6.3. Semantics Verification 2524 Assuming parsing completes successfully, the parsed description is 2525 then evaluated to ensure internal consistency as well as proper 2526 support for mandatory features. Specifically, the following checks 2527 are performed: 2529 o For each m= section, valid values for each of the mandatory-to-use 2530 features enumerated in Section 5.1.2 MUST be present. These 2531 values MAY either be present at the media level, or inherited from 2532 the session level. 2534 * ICE ufrag and password values, which MUST comply with the size 2535 limits specified in [RFC5245], Section 15.4. 2537 * DTLS setup value, which MUST be set according to the rules 2538 specified in [RFC5763], Section 5, and MUST be consistent with 2539 the selected role of the current DTLS connection, if one 2540 exists.[TODO: may need revision, i.e., use of actpass 2542 * DTLS fingerprint values, where at least one fingerprint MUST be 2543 present. 2545 o All RID values referenced in an "a=simulcast" line MUST exist as 2546 "a=rid" lines. 2548 o Each m= section is also checked to ensure prohibited features are 2549 not used. If this is a local description, the "ice-lite" 2550 attribute MUST NOT be specified. 2552 If this session description is of type "pranswer" or "answer", the 2553 following additional checks are applied: 2555 o The session description must follow the rules defined in 2556 [RFC3264], Section 6, including the requirement that the number of 2557 m= sections MUST exactly match the number of m= sections in the 2558 associated offer. 2560 o For each m= section, the media type and protocol values MUST 2561 exactly match the media type and protocol values in the 2562 corresponding m= section in the associated offer. 2564 5.7. Applying a Local Description 2566 The following steps are performed at the media engine level to apply 2567 a local description. 2569 First, the parsed parameters are checked to ensure that any 2570 modifications performed fall within those explicitly permitted by 2571 Section 6; otherwise, processing MUST stop and an error MUST be 2572 returned. 2574 Next, media sections are processed. For each media section, the 2575 following steps MUST be performed; if any parameters are out of 2576 bounds, or cannot be applied, processing MUST stop and an error MUST 2577 be returned. 2579 o If this media section is new, begin gathering candidates for it, 2580 as defined in [RFC5245], Section 4.1.1, unless it has been marked 2581 as bundle-only. 2583 o Or, if the ICE ufrag and password values have changed, trigger the 2584 ICE Agent to start an ICE restart and begin gathering new 2585 candidates for the media section, as defined in [RFC5245], 2586 Section 9.1.1.1, unless it has been marked as bundle-only. 2588 o If the media section proto value indicates use of RTP: 2590 * If there is no RtpTransceiver associated with this m= section 2591 (which should only happen when applying an offer), find one and 2592 associate it with this m= section according to the following 2593 steps: 2595 + Find the RtpTransceiver that corresponds to the m= section 2596 with the same MID in the created offer. 2598 + Set the value of the RtpTransceiver's mid attribute to the 2599 MID of the m= section. 2601 * If RTCP mux is indicated, prepare to demux RTP and RTCP from 2602 the RTP ICE component, as specified in [RFC5761], 2603 Section 5.1.1. If RTCP mux is not indicated, but was indicated 2604 in a previous description, this MUST result in an error. 2606 * For each specified RTP header extension, establish a mapping 2607 between the extension ID and URI, as described in section 6 of 2608 [RFC5285]. If any indicated RTP header extension is unknown, 2609 this MUST result in an error. 2611 * If the MID header extension is supported, prepare to demux RTP 2612 data intended for this media section based on the MID header 2613 extension, as described in [I-D.ietf-mmusic-msid], Section 3.2. 2615 * For each specified payload type, establish a mapping between 2616 the payload type ID and the actual media format, as descibed in 2617 [RFC3264]. If any indicated payload type is unknown, this MUST 2618 result in an error. 2620 * For each specified "rtx" media format, establish a mapping 2621 between the RTX payload type and its associated primary payload 2622 type, as described in [RFC4588], Sections 8.6 and 8.7. If any 2623 referenced primary payload types are not present, this MUST 2624 result in an error. 2626 * If the directional attribute is of type "sendrecv" or 2627 "recvonly", enable receipt and decoding of media. 2629 Finally, if this description is of type "pranswer" or "answer", 2630 follow the processing defined in the Section 5.9 section below. 2632 5.8. Applying a Remote Description 2634 If the answer contains any "a=ice-options" attributes where "trickle" 2635 is listed as an attribute, update the PeerConnection canTrickle 2636 property to be true. Otherwise, set this property to false. 2638 The following steps are performed at the media engine level to apply 2639 a remote description. 2641 The following steps MUST be performed for attributes at the session 2642 level; if any parameters are out of bounds, or cannot be applied, 2643 processing MUST stop and an error MUST be returned. 2645 o For any specified "CT" bandwidth value, set this as the limit for 2646 the maximum total bitrate for all m= sections, as specified in 2647 Section 5.8 of [RFC4566]. The implementation can decide how to 2648 allocate the available bandwidth between m= sections to 2649 simultaneously meet any limits on individual m= sections, as well 2650 as this overall session limit. 2652 o For any specified "RR" or "RS" bandwidth values, handle as 2653 specified in [RFC3556], Section 2. 2655 o Any "AS" bandwidth value MUST be ignored, as the meaning of this 2656 construct at the session level is not well defined. 2658 For each media section, the following steps MUST be performed; if any 2659 parameters are out of bounds, or cannot be applied, processing MUST 2660 stop and an error MUST be returned. 2662 o If the description is of type "offer", and the ICE ufrag or 2663 password changed from the previous remote description, as 2664 described in Section 9.1.1.1 of [RFC5245], mark that an ICE 2665 restart is needed. 2667 o Configure the ICE components associated with this media section to 2668 use the supplied ICE remote ufrag and password for their 2669 connectivity checks. 2671 o Pair any supplied ICE candidates with any gathered local 2672 candidates, as described in Section 5.7 of [RFC5245] and start 2673 connectivity checks with the appropriate credentials. 2675 o If an "a=end-of-candidates" attribute is present, process the end- 2676 of-candidates indication as described in [I-D.ietf-ice-trickle] 2677 Section 11. 2679 o If the media section proto value indicates use of RTP: 2681 * [TODO: header extensions] 2683 * If the m= section is being recycled (see Section 5.2.2), 2684 dissociate the currently associated RtpTransceiver by setting 2685 its mid attribute to null. 2687 * If the m= section is not associated with any RtpTransceiver 2688 (possibly because it was dissociated in the previous step), 2689 either find an RtpTransceiver or create one according to the 2690 following steps: 2692 + If the m= section is sendrecv or recvonly, and there are 2693 RtpTransceivers of the same type that were added to the 2694 PeerConnection by addTrack and are not associated with any 2695 m= section and are not stopped, find the first (according to 2696 the canonical order described in Section 5.2.1) such 2697 RtpTransceiver. 2699 + If no RtpTransceiver was found in the previous step, create 2700 one with an inactive RtpSender and active RtpReceiver. 2702 + Associate the found or created RtpTransceiver with the m= 2703 section by setting the value of the RtpTransceiver's mid 2704 attribute to the MID of the m= section. 2706 * For each specified payload type that is also supported by the 2707 local implementation, establish a mapping between the payload 2708 type ID and the actual media format. [TODO - Justin to add 2709 more to explain mapping.] If any indicated payload type is 2710 unknown, it MUST be ignored. [TODO: should fail on answers] 2712 * For each specified "rtx" media format, establish a mapping 2713 between the RTX payload type and its associated primary payload 2714 type, as described in [RFC4588]. If any referenced primary 2715 payload types are not present, this MUST result in an error. 2717 * For each specified fmtp parameter that is supported by the 2718 local implementation, enable them on the associated payload 2719 types. 2721 * For each specified RTCP feedback mechanism that is supported by 2722 the local implementation, enable them on the associated payload 2723 types. 2725 * For any specified "TIAS" bandwidth value, set this value as a 2726 constraint on the maximum RTP bitrate to be used when sending 2727 media, as specified in [RFC3890]. If a "TIAS" value is not 2728 present, but an "AS" value is specified, generate a "TIAS" 2729 value using this formula: 2731 TIAS = AS * 0.95 - 50 * 40 * 8 2733 The 50 is based on 50 packets per second, the 40 is based on an 2734 estimate of total header size, and the 0.95 is to allocate 5% 2735 to RTCP. If more accurate control of bandwidth is needed, 2736 "TIAS" should be used instead of "AS". 2738 * For any "RR" or "RS" bandwidth values, handle as specified in 2739 [RFC3556], Section 2. 2741 * Any specified "CT" bandwidth value MUST be ignored, as the 2742 meaning of this construct at the media level is not well 2743 defined. 2745 * [TODO: handling of CN, telephone-event, "red"] 2747 * If the media section if of type audio: 2749 + For any specified "ptime" value, configure the available 2750 payload types to use the specified packet size. If the 2751 specified size is not supported for a payload type, use the 2752 next closest value instead. 2754 Finally, if this description is of type "pranswer" or "answer", 2755 follow the processing defined in the Section 5.9 section below. 2757 5.9. Applying an Answer 2759 In addition to the steps mentioned above for processing a local or 2760 remote description, the following steps are performed when processing 2761 a description of type "pranswer" or "answer". 2763 For each media section, the following steps MUST be performed: 2765 o If the media section has been rejected (i.e. port is set to zero 2766 in the answer), stop any reception or transmission of media for 2767 this section, and discard any associated ICE components, as 2768 described in Section 9.2.1.3 of [RFC5245]. 2770 o If the remote DTLS fingerprint has been changed, tear down the 2771 existing DTLS connection. 2773 o If no valid DTLS connection exists, prepare to start a DTLS 2774 connection, using the specified roles and fingerprints, on any 2775 underlying ICE components, once they are active. 2777 o If the media section proto value indicates use of RTP: 2779 * If the media section has RTCP mux enabled, discard any RTCP 2780 component, and begin or continue muxing RTCP over the RTP 2781 component, as specified in [RFC5761], Section 5.1.3. 2782 Otherwise, transmit RTCP over the RTCP component; if no RTCP 2783 component exists, because RTCP mux was previously enabled, this 2784 MUST result in an error. 2786 * If the media section has reduced-size RTCP enabled, configure 2787 the RTCP transmission for this media section to use reduced- 2788 size RTCP, as specified in [RFC5506]. 2790 * If the directional attribute in the answer is of type 2791 "sendrecv" or "sendonly", prepare to start transmitting media 2792 using the specified primary SSRC and one of the selected 2793 payload types, once the underlying transport layers have been 2794 established. If RID values are specified, include the RID 2795 header extension in the RTP streams, as indicated in 2796 [I-D.ietf-mmusic-rid], Section 4). If simulcast is negotiated, 2797 send the number of Source RTP Streams as specified in 2798 [I-D.ietf-mmusic-sdp-simulcast], Section 6.2.2. If the 2799 directional attribute is of type "recvonly" or "inactive", stop 2800 transmitting RTP media, although RTCP should still be sent, as 2801 described in [RFC3264], Section 5.1. 2803 o If the media section proto value indicates use of SCTP: 2805 * If no SCTP association yet exists, prepare to initiate a SCTP 2806 association over the associated ICE component and DTLS 2807 connection, using the local SCTP port value from the local 2808 description, and the remote SCTP port value from the remote 2809 description, as described in [I-D.ietf-mmusic-sctp-sdp], 2810 Section 10.2. 2812 If the answer contains valid bundle groups, discard any ICE 2813 components for the m= sections that will be bundled onto the primary 2814 ICE components in each bundle, and begin muxing these m= sections 2815 accordingly, as described in 2816 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 8.2. 2818 6. Configurable SDP Parameters 2820 It is possible to change elements in the SDP returned from 2821 createOffer before passing it to setLocalDescription. When an 2822 implementation receives modified SDP it MUST either: 2824 o Accept the changes and adjust its behavior to match the SDP. 2826 o Reject the changes and return an error via the error callback. 2828 Changes MUST NOT be silently ignored. 2830 The following elements of the session description MUST NOT be changed 2831 between the createOffer and the setLocalDescription (or between the 2832 createAnswer and the setLocalDescription), since they reflect 2833 transport attributes that are solely under browser control, and the 2834 browser MUST NOT honor an attempt to change them: 2836 o The number, type and port number of m= lines. 2838 o The generated MID attributes (a=mid). 2840 o The generated ICE credentials (a=ice-ufrag and a=ice-pwd). 2842 o The set of ICE candidates and their parameters (a=candidate). 2844 o The DTLS fingerprint(s) (a=fingerprint). 2846 o The contents of bundle groups, bundle-only parameters, or "a=rtcp- 2847 mux" parameters. 2849 The following modifications, if done by the browser to a description 2850 between createOffer/createAnswer and the setLocalDescription, MUST be 2851 honored by the browser: 2853 o Remove or reorder codecs (m=) 2855 The following parameters may be controlled by options passed into 2856 createOffer/createAnswer. As an open issue, these changes may also 2857 be be performed by manipulating the SDP returned from createOffer/ 2858 createAnswer, as indicated above, as long as the capabilities of the 2859 endpoint are not exceeded (e.g. asking for a resolution greater than 2860 what the endpoint can encode): 2862 o [[OPEN ISSUE: This is a placeholder for other modifications, which 2863 we may continue adding as use cases appear.]] 2865 Implementations MAY choose to either honor or reject any elements not 2866 listed in the above two categories, but must do so explicitly as 2867 described at the beginning of this section. Note that future 2868 standards may add new SDP elements to the list of elements which must 2869 be accepted or rejected, but due to version skew, applications must 2870 be prepared for implementations to accept changes which must be 2871 rejected and vice versa. 2873 The application can also modify the SDP to reduce the capabilities in 2874 the offer it sends to the far side or the offer that it installs from 2875 the far side in any way the application sees fit, as long as it is a 2876 valid SDP offer and specifies a subset of what was in the original 2877 offer. This is safe because the answer is not permitted to expand 2878 capabilities and therefore will just respond to what is actually in 2879 the offer. 2881 As always, the application is solely responsible for what it sends to 2882 the other party, and all incoming SDP will be processed by the 2883 browser to the extent of its capabilities. It is an error to assume 2884 that all SDP is well-formed; however, one should be able to assume 2885 that any implementation of this specification will be able to 2886 process, as a remote offer or answer, unmodified SDP coming from any 2887 other implementation of this specification. 2889 7. Examples 2891 Note that this example section shows several SDP fragments. To 2892 format in 72 columns, some of the lines in SDP have been split into 2893 multiple lines, where leading whitespace indicates that a line is a 2894 continuation of the previous line. In addition, some blank lines 2895 have been added to improve readability but are not valid in SDP. 2897 More examples of SDP for WebRTC call flows can be found in 2898 [I-D.nandakumar-rtcweb-sdp]. 2900 7.1. Simple Example 2902 This section shows a very simple example that sets up a minimal audio 2903 / video call between two browsers and does not use trickle ICE. The 2904 example in the following section provides a more realistic example of 2905 what would happen in a normal browser to browser connection. 2907 The flow shows Alice's browser initiating the session to Bob's 2908 browser. The messages from Alice's JS to Bob's JS are assumed to 2909 flow over some signaling protocol via a web server. The JS on both 2910 Alice's side and Bob's side waits for all candidates before sending 2911 the offer or answer, so the offers and answers are complete. Trickle 2912 ICE is not used. Both Alice and Bob are using the default policy of 2913 balanced. 2915 // set up local media state 2916 AliceJS->AliceUA: create new PeerConnection 2917 AliceJS->AliceUA: addTrack with two tracks: one for audio and one for video 2918 AliceJS->AliceUA: createOffer to get offer 2919 AliceJS->AliceUA: setLocalDescription with offer 2920 AliceUA->AliceJS: multiple onicecandidate events with candidates 2922 // wait for ICE gathering to complete 2923 AliceUA->AliceJS: onicecandidate event with null candidate 2924 AliceJS->AliceUA: get |offer-A1| from pendingLocalDescription 2926 // |offer-A1| is sent over signaling protocol to Bob 2927 AliceJS->WebServer: signaling with |offer-A1| 2928 WebServer->BobJS: signaling with |offer-A1| 2930 // |offer-A1| arrives at Bob 2931 BobJS->BobUA: create a PeerConnection 2932 BobJS->BobUA: setRemoteDescription with |offer-A1| 2933 BobUA->BobJS: onaddstream event with remoteStream 2935 // Bob accepts call 2936 BobJS->BobUA: addTrack with local tracks 2937 BobJS->BobUA: createAnswer 2938 BobJS->BobUA: setLocalDescription with answer 2939 BobUA->BobJS: multiple onicecandidate events with candidates 2941 // wait for ICE gathering to complete 2942 BobUA->BobJS: onicecandidate event with null candidate 2943 BobJS->BobUA: get |answer-A1| from currentLocalDescription 2945 // |answer-A1| is sent over signaling protocol to Alice 2946 BobJS->WebServer: signaling with |answer-A1| 2947 WebServer->AliceJS: signaling with |answer-A1| 2949 // |answer-A1| arrives at Alice 2950 AliceJS->AliceUA: setRemoteDescription with |answer-A1| 2951 AliceUA->AliceJS: onaddstream event with remoteStream 2953 // media flows 2954 BobUA->AliceUA: media sent from Bob to Alice 2955 AliceUA->BobUA: media sent from Alice to Bob 2957 The SDP for |offer-A1| looks like: 2959 v=0 2960 o=- 4962303333179871722 1 IN IP4 0.0.0.0 2961 s=- 2962 t=0 0 2963 a=group:BUNDLE a1 v1 2964 a=ice-options:trickle 2965 m=audio 56500 UDP/TLS/RTP/SAVPF 96 0 8 97 98 2966 c=IN IP4 192.0.2.1 2967 a=mid:a1 2968 a=rtcp:56501 IN IP4 192.0.2.1 2969 a=msid:47017fee-b6c1-4162-929c-a25110252400 2970 f83006c5-a0ff-4e0a-9ed9-d3e6747be7d9 2971 a=sendrecv 2972 a=rtpmap:96 opus/48000/2 2973 a=rtpmap:0 PCMU/8000 2974 a=rtpmap:8 PCMA/8000 2975 a=rtpmap:97 telephone-event/8000 2976 a=rtpmap:98 telephone-event/48000 2977 a=maxptime:120 2978 a=ice-ufrag:ETEn1v9DoTMB9J4r 2979 a=ice-pwd:OtSK0WpNtpUjkY4+86js7ZQl 2980 a=fingerprint:sha-256 2981 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 2982 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 2983 a=setup:actpass 2984 a=rtcp-mux 2985 a=rtcp-rsize 2986 a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level 2987 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 2988 a=ssrc:1732846380 cname:EocUG1f0fcg/yvY7 2989 a=candidate:3348148302 1 udp 2113937151 192.0.2.1 56500 2990 typ host 2991 a=candidate:3348148302 2 udp 2113937151 192.0.2.1 56501 2992 typ host 2993 a=end-of-candidates 2995 m=video 56502 UDP/TLS/RTP/SAVPF 100 101 2996 c=IN IP4 192.0.2.1 2997 a=rtcp:56503 IN IP4 192.0.2.1 2998 a=mid:v1 2999 a=msid:61317484-2ed4-49d7-9eb7-1414322a7aae 3000 f30bdb4a-5db8-49b5-bcdc-e0c9a23172e0 3001 a=sendrecv 3002 a=rtpmap:100 VP8/90000 3003 a=rtpmap:101 rtx/90000 3004 a=fmtp:101 apt=100 3005 a=ice-ufrag:BGKkWnG5GmiUpdIV 3006 a=ice-pwd:mqyWsAjvtKwTGnvhPztQ9mIf 3007 a=fingerprint:sha-256 3008 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3009 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3010 a=setup:actpass 3011 a=rtcp-mux 3012 a=rtcp-rsize 3013 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid 3014 a=rtcp-fb:100 ccm fir 3015 a=rtcp-fb:100 nack 3016 a=rtcp-fb:100 nack pli 3017 a=ssrc:1366781083 cname:EocUG1f0fcg/yvY7 3018 a=ssrc:1366781084 cname:EocUG1f0fcg/yvY7 3019 a=ssrc-group:FID 1366781083 1366781084 3020 a=candidate:3348148302 1 udp 2113937151 192.0.2.1 56502 3021 typ host 3022 a=candidate:3348148302 2 udp 2113937151 192.0.2.1 56503 3023 typ host 3024 a=end-of-candidates 3026 The SDP for |answer-A1| looks like: 3028 v=0 3029 o=- 6729291447651054566 1 IN IP4 0.0.0.0 3030 s=- 3031 t=0 0 3032 a=group:BUNDLE a1 v1 3033 m=audio 20000 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3034 c=IN IP4 192.0.2.2 3035 a=mid:a1 3036 a=rtcp:20000 IN IP4 192.0.2.2 3037 a=msid:PI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1 3038 PI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1a0 3039 a=sendrecv 3040 a=rtpmap:96 opus/48000/2 3041 a=rtpmap:0 PCMU/8000 3042 a=rtpmap:8 PCMA/8000 3043 a=rtpmap:97 telephone-event/8000 3044 a=rtpmap:98 telephone-event/48000 3045 a=maxptime:120 3046 a=ice-ufrag:6sFvz2gdLkEwjZEr 3047 a=ice-pwd:cOTZKZNVlO9RSGsEGM63JXT2 3048 a=fingerprint:sha-256 6B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35 3049 :DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3050 a=setup:active 3051 a=rtcp-mux 3052 a=rtcp-rsize 3053 a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3054 a=ssrc:3429951804 cname:Q/NWs1ao1HmN4Xa5 3055 a=candidate:2299743422 1 udp 2113937151 192.0.2.2 20000 3056 typ host 3057 a=end-of-candidates 3058 m=video 20000 UDP/TLS/RTP/SAVPF 100 101 3059 c=IN IP4 192.0.2.2 3060 a=rtcp 20001 IN IP4 192.0.2.2 3061 a=mid:v1 3062 a=msid:PI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1 3063 PI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1v0 3064 a=sendrecv 3065 a=rtpmap:100 VP8/90000 3066 a=rtpmap:101 rtx/90000 3067 a=fmtp:101 apt=100 3068 a=fingerprint:sha-256 6B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35 3069 :DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3070 a=setup:active 3071 a=rtcp-mux 3072 a=rtcp-rsize 3073 a=rtcp-fb:100 ccm fir 3074 a=rtcp-fb:100 nack 3075 a=rtcp-fb:100 nack pli 3076 a=ssrc:3229706345 cname:Q/NWs1ao1HmN4Xa5 3077 a=ssrc:3229706346 cname:Q/NWs1ao1HmN4Xa5 3078 a=ssrc-group:FID 3229706345 3229706346 3080 7.2. Normal Examples 3082 This section shows a typical example of a session between two 3083 browsers setting up an audio channel and a data channel. Trickle ICE 3084 is used in full trickle mode with a bundle policy of max-bundle, an 3085 RTCP mux policy of require, and a single TURN server. Later, two 3086 video flows, one for the presenter and one for screen sharing, are 3087 added to the session. This example shows Alice's browser initiating 3088 the session to Bob's browser. The messages from Alice's JS to Bob's 3089 JS are assumed to flow over some signaling protocol via a web server. 3091 // set up local media state 3092 AliceJS->AliceUA: create new PeerConnection 3093 AliceJS->AliceUA: addTrack with an audio track 3094 AliceJS->AliceUA: createDataChannel to get data channel 3095 AliceJS->AliceUA: createOffer to get |offer-B1| 3096 AliceJS->AliceUA: setLocalDescription with |offer-B1| 3098 // |offer-B1| is sent over signaling protocol to Bob 3099 AliceJS->WebServer: signaling with |offer-B1| 3100 WebServer->BobJS: signaling with |offer-B1| 3102 // |offer-B1| arrives at Bob 3103 BobJS->BobUA: create a PeerConnection 3104 BobJS->BobUA: setRemoteDescription with |offer-B1| 3105 BobUA->BobJS: onaddstream with audio track from Alice 3106 // candidates are sent to Bob 3107 AliceUA->AliceJS: onicecandidate event with |candidate-B1| (host) 3108 AliceJS->WebServer: signaling with |candidate-B1| 3109 AliceUA->AliceJS: onicecandidate event with |candidate-B2| (srflx) 3110 AliceJS->WebServer: signaling with |candidate-B2| 3112 WebServer->BobJS: signaling with |candidate-B1| 3113 BobJS->BobUA: addIceCandidate with |candidate-B1| 3114 WebServer->BobJS: signaling with |candidate-B2| 3115 BobJS->BobUA: addIceCandidate with |candidate-B2| 3117 // Bob accepts call 3118 BobJS->BobUA: addTrack with local audio 3119 BobJS->BobUA: createDataChannel to get data channel 3120 BobJS->BobUA: createAnswer to get |answer-B1| 3121 BobJS->BobUA: setLocalDescription with |answer-B1| 3123 // |answer-B1| is sent to Alice 3124 BobJS->WebServer: signaling with |answer-B1| 3125 WebServer->AliceJS: signaling with |answer-B1| 3126 AliceJS->AliceUA: setRemoteDescription with |answer-B1| 3127 AliceUA->AliceJS: onaddstream event with audio track from Bob 3129 // candidates are sent to Alice 3130 BobUA->BobJS: onicecandidate event with |candidate-B3| (host) 3131 BobJS->WebServer: signaling with |candidate-B3| 3132 BobUA->BobJS: onicecandidate event with |candidate-B4| (srflx) 3133 BobJS->WebServer: signaling with |candidate-B4| 3135 WebServer->AliceJS: signaling with |candidate-B3| 3136 AliceJS->AliceUA: addIceCandidate with |candidate-B3| 3137 WebServer->AliceJS: signaling with |candidate-B4| 3138 AliceJS->AliceUA: addIceCandidate with |candidate-B4| 3140 // data channel opens 3141 BobUA->BobJS: ondatachannel event 3142 AliceUA->AliceJS: ondatachannel event 3143 BobUA->BobJS: onopen 3144 AliceUA->AliceJS: onopen 3146 // media is flowing between browsers 3147 BobUA->AliceUA: audio+data sent from Bob to Alice 3148 AliceUA->BobUA: audio+data sent from Alice to Bob 3150 // some time later Bob adds two video streams 3151 // note, no candidates exchanged, because of bundle 3152 BobJS->BobUA: addTrack with first video stream 3153 BobJS->BobUA: addTrack with second video stream 3154 BobJS->BobUA: createOffer to get |offer-B2| 3155 BobJS->BobUA: setLocalDescription with |offer-B2| 3157 // |offer-B2| is sent to Alice 3158 BobJS->WebServer: signaling with |offer-B2| 3159 WebServer->AliceJS: signaling with |offer-B2| 3160 AliceJS->AliceUA: setRemoteDescription with |offer-B2| 3161 AliceUA->AliceJS: onaddstream event with first video stream 3162 AliceUA->AliceJS: onaddstream event with second video stream 3163 AliceJS->AliceUA: createAnswer to get |answer-B2| 3164 AliceJS->AliceUA: setLocalDescription with |answer-B2| 3166 // |answer-B2| is sent over signaling protocol to Bob 3167 AliceJS->WebServer: signaling with |answer-B2| 3168 WebServer->BobJS: signaling with |answer-B2| 3169 BobJS->BobUA: setRemoteDescription with |answer-B2| 3171 // media is flowing between browsers 3172 BobUA->AliceUA: audio+video+data sent from Bob to Alice 3173 AliceUA->BobUA: audio+video+data sent from Alice to Bob 3175 The SDP for |offer-B1| looks like: 3177 v=0 3178 o=- 4962303333179871723 1 IN IP4 0.0.0.0 3179 s=- 3180 t=0 0 3181 a=group:BUNDLE a1 d1 3182 a=ice-options:trickle 3183 m=audio 9 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3184 c=IN IP4 0.0.0.0 3185 a=rtcp:9 IN IP4 0.0.0.0 3186 a=mid:a1 3187 a=msid:57017fee-b6c1-4162-929c-a25110252400 3188 e83006c5-a0ff-4e0a-9ed9-d3e6747be7d9 3189 a=sendrecv 3190 a=rtpmap:96 opus/48000/2 3191 a=rtpmap:0 PCMU/8000 3192 a=rtpmap:8 PCMA/8000 3193 a=rtpmap:97 telephone-event/8000 3194 a=rtpmap:98 telephone-event/48000 3195 a=maxptime:120 3196 a=ice-ufrag:ATEn1v9DoTMB9J4r 3197 a=ice-pwd:AtSK0WpNtpUjkY4+86js7ZQl 3198 a=fingerprint:sha-256 3199 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3200 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3201 a=setup:actpass 3202 a=rtcp-mux 3203 a=rtcp-rsize 3204 a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3205 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3206 a=ssrc:1732846380 cname:FocUG1f0fcg/yvY7 3208 m=application 0 UDP/DTLS/SCTP webrtc-datachannel 3209 c=IN IP4 0.0.0.0 3210 a=bundle-only 3211 a=mid:d1 3212 a=fmtp:webrtc-datachannel max-message-size=65536 3213 a=sctp-port 5000 3214 a=fingerprint:sha-256 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3215 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3216 a=setup:actpass 3218 The SDP for |candidate-B1| looks like: 3220 candidate:109270923 1 udp 2122194687 192.168.1.2 51556 typ host 3222 The SDP for |candidate-B2| looks like: 3224 candidate:4036177503 1 udp 1685987071 11.22.33.44 52546 typ srflx 3225 raddr 192.168.1.2 rport 51556 3227 The SDP for |answer-B1| looks like: 3229 v=0 3230 o=- 7729291447651054566 1 IN IP4 0.0.0.0 3231 s=- 3232 t=0 0 3233 a=group:BUNDLE a1 d1 3234 a=ice-options:trickle 3235 m=audio 9 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3236 c=IN IP4 0.0.0.0 3237 a=rtcp:9 IN IP4 0.0.0.0 3238 a=mid:a1 3239 a=msid:QI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1 3240 QI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1a0 3241 a=sendrecv 3242 a=rtpmap:96 opus/48000/2 3243 a=rtpmap:0 PCMU/8000 3244 a=rtpmap:8 PCMA/8000 3245 a=rtpmap:97 telephone-event/8000 3246 a=rtpmap:98 telephone-event/48000 3247 a=maxptime:120 3248 a=ice-ufrag:7sFvz2gdLkEwjZEr 3249 a=ice-pwd:dOTZKZNVlO9RSGsEGM63JXT2 3250 a=fingerprint:sha-256 6B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35 3251 :DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3252 a=setup:active 3253 a=rtcp-mux 3254 a=rtcp-rsize 3255 a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3256 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3257 a=ssrc:4429951804 cname:Q/NWs1ao1HmN4Xa5 3259 m=application 9 UDP/DTLS/SCTP webrtc-datachannel 3260 c=IN IP4 0.0.0.0 3261 a=mid:d1 3262 a=fmtp:webrtc-datachannel max-message-size=65536 3263 a=sctp-port 5000 3264 a=fingerprint:sha-256 6B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35 3265 :DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3266 a=setup:active 3268 The SDP for |candidate-B3| looks like: 3270 candidate:109270924 1 udp 2122194687 192.168.2.3 61665 typ host 3271 The SDP for |candidate-B4| looks like: 3273 candidate:4036177504 1 udp 1685987071 55.66.77.88 64532 typ srflx 3274 raddr 192.168.2.3 rport 61665 3276 The SDP for |offer-B2| looks like: (note the increment of the version 3277 number in the o= line, and the c= and a=rtcp lines, which indicate 3278 the local candidate that was selected) 3280 v=0 3281 o=- 7729291447651054566 2 IN IP4 0.0.0.0 3282 s=- 3283 t=0 0 3284 a=group:BUNDLE a1 d1 v1 v2 3285 a=ice-options:trickle 3286 m=audio 64532 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3287 c=IN IP4 55.66.77.88 3288 a=rtcp:64532 IN IP4 55.66.77.88 3289 a=mid:a1 3290 a=msid:QI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1 3291 QI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1a0 3292 a=sendrecv 3293 a=rtpmap:96 opus/48000/2 3294 a=rtpmap:0 PCMU/8000 3295 a=rtpmap:8 PCMA/8000 3296 a=rtpmap:97 telephone-event/8000 3297 a=rtpmap:98 telephone-event/48000 3298 a=maxptime:120 3299 a=ice-ufrag:7sFvz2gdLkEwjZEr 3300 a=ice-pwd:dOTZKZNVlO9RSGsEGM63JXT2 3301 a=fingerprint:sha-256 6B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35 3302 :DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3303 a=setup:actpass 3304 a=rtcp-mux 3305 a=rtcp-rsize 3306 a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3307 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3308 a=ssrc:4429951804 cname:Q/NWs1ao1HmN4Xa5 3309 a=candidate:109270924 1 udp 2122194687 192.168.2.3 61665 typ host 3310 a=candidate:4036177504 1 udp 1685987071 55.66.77.88 64532 typ srflx 3311 raddr 192.168.2.3 rport 61665 3312 a=candidate:3671762467 1 udp 41819903 66.77.88.99 50416 typ relay 3313 raddr 55.66.77.88 rport 64532 3314 a=end-of-candidates 3316 m=application 64532 UDP/DTLS/SCTP webrtc-datachannel 3317 c=IN IP4 55.66.77.88 3318 a=mid:d1 3319 a=fmtp:webrtc-datachannel max-message-size=65536 3320 a=sctp-port 5000 3321 a=ice-ufrag:7sFvz2gdLkEwjZEr 3322 a=ice-pwd:dOTZKZNVlO9RSGsEGM63JXT2 3323 a=fingerprint:sha-256 6B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35 3324 :DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3325 a=setup:actpass 3326 a=candidate:109270924 1 udp 2122194687 192.168.2.3 61665 typ host 3327 a=candidate:4036177504 1 udp 1685987071 55.66.77.88 64532 typ srflx 3328 raddr 192.168.2.3 rport 61665 3329 a=candidate:3671762467 1 udp 41819903 66.77.88.99 50416 typ relay 3330 raddr 55.66.77.88 rport 64532 3331 a=end-of-candidates 3333 m=video 0 UDP/TLS/RTP/SAVPF 100 101 3334 c=IN IP4 55.66.77.88 3335 a=bundle-only 3336 a=rtcp:64532 IN IP4 55.66.77.88 3337 a=mid:v1 3338 a=msid:61317484-2ed4-49d7-9eb7-1414322a7aae 3339 f30bdb4a-5db8-49b5-bcdc-e0c9a23172e0 3340 a=sendrecv 3341 a=rtpmap:100 VP8/90000 3342 a=rtpmap:101 rtx/90000 3343 a=fmtp:101 apt=100 3344 a=fingerprint:sha-256 3345 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3346 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3347 a=setup:actpass 3348 a=rtcp-mux 3349 a=rtcp-rsize 3350 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3351 a=rtcp-fb:100 ccm fir 3352 a=rtcp-fb:100 nack 3353 a=rtcp-fb:100 nack pli 3354 a=ssrc:1366781083 cname:Q/NWs1ao1HmN4Xa5 3355 a=ssrc:1366781084 cname:Q/NWs1ao1HmN4Xa5 3356 a=ssrc-group:FID 1366781083 1366781084 3358 m=video 0 UDP/TLS/RTP/SAVPF 100 101 3359 c=IN IP4 55.66.77.88 3360 a=bundle-only 3361 a=rtcp:64532 IN IP4 55.66.77.88 3362 a=mid:v1 3363 a=msid:71317484-2ed4-49d7-9eb7-1414322a7aae 3364 f30bdb4a-5db8-49b5-bcdc-e0c9a23172e0 3365 a=sendrecv 3366 a=rtpmap:100 VP8/90000 3367 a=rtpmap:101 rtx/90000 3368 a=fmtp:101 apt=100 3369 a=fingerprint:sha-256 3370 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3371 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3372 a=setup:actpass 3373 a=rtcp-mux 3374 a=rtcp-rsize 3375 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3376 a=rtcp-fb:100 ccm fir 3377 a=rtcp-fb:100 nack 3378 a=rtcp-fb:100 nack pli 3379 a=ssrc:2366781083 cname:Q/NWs1ao1HmN4Xa5 3380 a=ssrc:2366781084 cname:Q/NWs1ao1HmN4Xa5 3381 a=ssrc-group:FID 2366781083 2366781084 3383 The SDP for |answer-B2| looks like: (note the use of setup:passive to 3384 maintain the existing DTLS roles, and the use of a=recvonly to 3385 indicate that the video streams are one-way) 3387 v=0 3388 o=- 4962303333179871723 2 IN IP4 0.0.0.0 3389 s=- 3390 t=0 0 3391 a=group:BUNDLE a1 d1 v1 v2 3392 a=ice-options:trickle 3393 m=audio 52546 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3394 c=IN IP4 11.22.33.44 3395 a=rtcp:52546 IN IP4 11.22.33.44 3396 a=mid:a1 3397 a=msid:57017fee-b6c1-4162-929c-a25110252400 3398 e83006c5-a0ff-4e0a-9ed9-d3e6747be7d9 3399 a=sendrecv 3400 a=rtpmap:96 opus/48000/2 3401 a=rtpmap:0 PCMU/8000 3402 a=rtpmap:8 PCMA/8000 3403 a=rtpmap:97 telephone-event/8000 3404 a=rtpmap:98 telephone-event/48000 3405 a=maxptime:120 3406 a=ice-ufrag:ATEn1v9DoTMB9J4r 3407 a=ice-pwd:AtSK0WpNtpUjkY4+86js7ZQl 3408 a=fingerprint:sha-256 3409 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3410 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3411 a=setup:passive 3412 a=rtcp-mux 3413 a=rtcp-rsize 3414 a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3415 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3416 a=ssrc:1732846380 cname:FocUG1f0fcg/yvY7 3417 a=candidate:109270923 1 udp 2122194687 192.168.1.2 51556 typ host 3418 a=candidate:4036177503 1 udp 1685987071 11.22.33.44 52546 typ srflx 3419 raddr 192.168.1.2 rport 51556 3420 a=candidate:3671762466 1 udp 41819903 22.33.44.55 61405 typ relay 3421 raddr 11.22.33.44 rport 52546 3422 a=end-of-candidates 3424 m=application 52546 UDP/DTLS/SCTP webrtc-datachannel 3425 c=IN IP4 11.22.33.44 3426 a=mid:d1 3427 a=fmtp:webrtc-datachannel max-message-size=65536 3428 a=sctp-port 5000 3429 a=fingerprint:sha-256 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3430 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3431 a=setup:passive 3433 m=video 52546 UDP/TLS/RTP/SAVPF 100 101 3434 c=IN IP4 11.22.33.44 3435 a=rtcp:52546 IN IP4 11.22.33.44 3436 a=mid:v1 3437 a=recvonly 3438 a=rtpmap:100 VP8/90000 3439 a=rtpmap:101 rtx/90000 3440 a=fmtp:101 apt=100 3441 a=fingerprint:sha-256 3442 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3443 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3444 a=setup:passive 3445 a=rtcp-mux 3446 a=rtcp-rsize 3447 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3448 a=rtcp-fb:100 ccm fir 3449 a=rtcp-fb:100 nack 3450 a=rtcp-fb:100 nack pli 3452 m=video 52546 UDP/TLS/RTP/SAVPF 100 101 3453 c=IN IP4 11.22.33.44 3454 a=rtcp:52546 IN IP4 11.22.33.44 3455 a=mid:v2 3456 a=recvonly 3457 a=rtpmap:100 VP8/90000 3458 a=rtpmap:101 rtx/90000 3459 a=fmtp:101 apt=100 3460 a=fingerprint:sha-256 3461 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3462 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3464 a=setup:passive 3465 a=rtcp-mux 3466 a=rtcp-rsize 3467 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3468 a=rtcp-fb:100 ccm fir 3469 a=rtcp-fb:100 nack 3470 a=rtcp-fb:100 nack pli 3472 8. Security Considerations 3474 The IETF has published separate documents 3475 [I-D.ietf-rtcweb-security-arch] [I-D.ietf-rtcweb-security] describing 3476 the security architecture for WebRTC as a whole. The remainder of 3477 this section describes security considerations for this document. 3479 While formally the JSEP interface is an API, it is better to think of 3480 it is an Internet protocol, with the JS being untrustworthy from the 3481 perspective of the browser. Thus, the threat model of [RFC3552] 3482 applies. In particular, JS can call the API in any order and with 3483 any inputs, including malicious ones. This is particularly relevant 3484 when we consider the SDP which is passed to setLocalDescription(). 3485 While correct API usage requires that the application pass in SDP 3486 which was derived from createOffer() or createAnswer() (perhaps 3487 suitably modified as described in Section 6, there is no guarantee 3488 that applications do so. The browser MUST be prepared for the JS to 3489 pass in bogus data instead. 3491 Conversely, the application programmer MUST recognize that the JS 3492 does not have complete control of browser behavior. One case that 3493 bears particular mention is that editing ICE candidates out of the 3494 SDP or suppressing trickled candidates does not have the expected 3495 behavior: implementations will still perform checks from those 3496 candidates even if they are not sent to the other side. Thus, for 3497 instance, it is not possible to prevent the remote peer from learning 3498 your public IP address by removing server reflexive candidates. 3499 Applications which wish to conceal their public IP address should 3500 instead configure the ICE agent to use only relay candidates. 3502 9. IANA Considerations 3504 This document requires no actions from IANA. 3506 10. Acknowledgements 3508 Significant text incorporated in the draft as well and review was 3509 provided by Peter Thatcher, Taylor Brandstetter, Harald Alvestrand 3510 and Suhas Nandakumar. Dan Burnett, Neil Stratford, Anant Narayanan, 3511 Andrew Hutton, Richard Ejzak, Adam Bergkvist and Matthew Kaufman all 3512 provided valuable feedback on this proposal. 3514 11. References 3516 11.1. Normative References 3518 [I-D.ietf-ice-trickle] 3519 Ivov, E., Rescorla, E., Uberti, J., and P. Saint-Andre, 3520 "Trickle ICE: Incremental Provisioning of Candidates for 3521 the Interactive Connectivity Establishment (ICE) 3522 Protocol". 3524 [I-D.ietf-mmusic-msid] 3525 Alvestrand, H., "Cross Session Stream Identification in 3526 the Session Description Protocol", draft-ietf-mmusic- 3527 msid-01 (work in progress), August 2013. 3529 [I-D.ietf-mmusic-sctp-sdp] 3530 Loreto, S. and G. Camarillo, "Stream Control Transmission 3531 Protocol (SCTP)-Based Media Transport in the Session 3532 Description Protocol (SDP)", draft-ietf-mmusic-sctp-sdp-04 3533 (work in progress), June 2013. 3535 [I-D.ietf-mmusic-sdp-bundle-negotiation] 3536 Holmberg, C., Alvestrand, H., and C. Jennings, 3537 "Multiplexing Negotiation Using Session Description 3538 Protocol (SDP) Port Numbers", draft-ietf-mmusic-sdp- 3539 bundle-negotiation-04 (work in progress), June 2013. 3541 [I-D.ietf-mmusic-sdp-mux-attributes] 3542 Nandakumar, S., "A Framework for SDP Attributes when 3543 Multiplexing", draft-ietf-mmusic-sdp-mux-attributes-01 3544 (work in progress), February 2014. 3546 [I-D.ietf-rtcweb-audio] 3547 Valin, J. and C. Bran, "WebRTC Audio Codec and Processing 3548 Requirements", draft-ietf-rtcweb-audio-02 (work in 3549 progress), August 2013. 3551 [I-D.ietf-rtcweb-fec] 3552 Uberti, J., "WebRTC Forward Error Correction 3553 Requirements", draft-ietf-rtcweb-fec-00 (work in 3554 progress), February 2015. 3556 [I-D.ietf-rtcweb-rtp-usage] 3557 Perkins, C., Westerlund, M., and J. Ott, "Web Real-Time 3558 Communication (WebRTC): Media Transport and Use of RTP", 3559 draft-ietf-rtcweb-rtp-usage-09 (work in progress), 3560 September 2013. 3562 [I-D.ietf-rtcweb-security] 3563 Rescorla, E., "Security Considerations for WebRTC", draft- 3564 ietf-rtcweb-security-06 (work in progress), January 2014. 3566 [I-D.ietf-rtcweb-security-arch] 3567 Rescorla, E., "WebRTC Security Architecture", draft-ietf- 3568 rtcweb-security-arch-09 (work in progress), February 2014. 3570 [I-D.ietf-rtcweb-video] 3571 Roach, A., "WebRTC Video Processing and Codec 3572 Requirements", draft-ietf-rtcweb-video-00 (work in 3573 progress), July 2014. 3575 [I-D.nandakumar-mmusic-proto-iana-registration] 3576 Nandakumar, S., "IANA registration of SDP 'proto' 3577 attribute for transporting RTP Media over TCP under 3578 various RTP profiles.", September 2014. 3580 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 3581 Requirement Levels", BCP 14, RFC 2119, March 1997. 3583 [RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, 3584 A., Peterson, J., Sparks, R., Handley, M., and E. 3585 Schooler, "SIP: Session Initiation Protocol", RFC 3261, 3586 June 2002. 3588 [RFC3264] Rosenberg, J. and H. Schulzrinne, "An Offer/Answer Model 3589 with Session Description Protocol (SDP)", RFC 3264, June 3590 2002. 3592 [RFC3552] Rescorla, E. and B. Korver, "Guidelines for Writing RFC 3593 Text on Security Considerations", BCP 72, RFC 3552, July 3594 2003. 3596 [RFC3605] Huitema, C., "Real Time Control Protocol (RTCP) attribute 3597 in Session Description Protocol (SDP)", RFC 3605, October 3598 2003. 3600 [RFC3890] Westerlund, M., "A Transport Independent Bandwidth 3601 Modifier for the Session Description Protocol (SDP)", 3602 RFC 3890, DOI 10.17487/RFC3890, September 2004, 3603 . 3605 [RFC4145] Yon, D. and G. Camarillo, "TCP-Based Media Transport in 3606 the Session Description Protocol (SDP)", RFC 4145, 3607 September 2005. 3609 [RFC4566] Handley, M., Jacobson, V., and C. Perkins, "SDP: Session 3610 Description Protocol", RFC 4566, July 2006. 3612 [RFC4572] Lennox, J., "Connection-Oriented Media Transport over the 3613 Transport Layer Security (TLS) Protocol in the Session 3614 Description Protocol (SDP)", RFC 4572, July 2006. 3616 [RFC4585] Ott, J., Wenger, S., Sato, N., Burmeister, C., and J. Rey, 3617 "Extended RTP Profile for Real-time Transport Control 3618 Protocol (RTCP)-Based Feedback (RTP/AVPF)", RFC 4585, July 3619 2006. 3621 [RFC5245] Rosenberg, J., "Interactive Connectivity Establishment 3622 (ICE): A Protocol for Network Address Translator (NAT) 3623 Traversal for Offer/Answer Protocols", RFC 5245, April 3624 2010. 3626 [RFC5285] Singer, D. and H. Desineni, "A General Mechanism for RTP 3627 Header Extensions", RFC 5285, July 2008. 3629 [RFC5761] Perkins, C. and M. Westerlund, "Multiplexing RTP Data and 3630 Control Packets on a Single Port", RFC 5761, April 2010. 3632 [RFC5888] Camarillo, G. and H. Schulzrinne, "The Session Description 3633 Protocol (SDP) Grouping Framework", RFC 5888, June 2010. 3635 [RFC6236] Johansson, I. and K. Jung, "Negotiation of Generic Image 3636 Attributes in the Session Description Protocol (SDP)", 3637 RFC 6236, May 2011. 3639 [RFC6347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 3640 Security Version 1.2", RFC 6347, January 2012. 3642 [RFC6904] Lennox, J., "Encryption of Header Extensions in the Secure 3643 Real-time Transport Protocol (SRTP)", RFC 6904, April 3644 2013. 3646 11.2. Informative References 3648 [I-D.ietf-avtext-rid] 3649 Roach, A., Nandakumar, S., and P. Thatcher, "RTP Stream 3650 Identifier (RID) Source Description (SDES)", draft-ietf- 3651 avtext-rid-00 (work in progress), February 2016. 3653 [I-D.ietf-mmusic-rid] 3654 Thatcher, P., Zanaty, M., Nandakumar, S., Burman, B., 3655 Roach, A., and B. Campen, "RTP Payload Format 3656 Constraints", draft-ietf-mmusic-rid-04 (work in progress), 3657 February 2016. 3659 [I-D.ietf-mmusic-sdp-simulcast] 3660 Burman, B., Westerlund, M., Nandakumar, S., and M. Zanaty, 3661 "Using Simulcast in SDP and RTP Sessions", draft-ietf- 3662 mmusic-sdp-simulcast-04 (work in progress), February 2016. 3664 [I-D.nandakumar-rtcweb-sdp] 3665 Nandakumar, S. and C. Jennings, "SDP for the WebRTC", 3666 draft-nandakumar-rtcweb-sdp-02 (work in progress), July 3667 2013. 3669 [I-D.shieh-rtcweb-ip-handling] 3670 Shieh, G. and J. Uberti, "WebRTC IP Address Handling 3671 Recommendations", draft-shieh-rtcweb-ip-handling-00 (work 3672 in progress), October 2015. 3674 [RFC3389] Zopf, R., "Real-time Transport Protocol (RTP) Payload for 3675 Comfort Noise (CN)", RFC 3389, September 2002. 3677 [RFC3556] Casner, S., "Session Description Protocol (SDP) Bandwidth 3678 Modifiers for RTP Control Protocol (RTCP) Bandwidth", 3679 RFC 3556, July 2003. 3681 [RFC3960] Camarillo, G. and H. Schulzrinne, "Early Media and Ringing 3682 Tone Generation in the Session Initiation Protocol (SIP)", 3683 RFC 3960, December 2004. 3685 [RFC4568] Andreasen, F., Baugher, M., and D. Wing, "Session 3686 Description Protocol (SDP) Security Descriptions for Media 3687 Streams", RFC 4568, July 2006. 3689 [RFC4588] Rey, J., Leon, D., Miyazaki, A., Varsa, V., and R. 3690 Hakenberg, "RTP Retransmission Payload Format", RFC 4588, 3691 July 2006. 3693 [RFC5506] Johansson, I. and M. Westerlund, "Support for Reduced-Size 3694 Real-Time Transport Control Protocol (RTCP): Opportunities 3695 and Consequences", RFC 5506, April 2009. 3697 [RFC5576] Lennox, J., Ott, J., and T. Schierl, "Source-Specific 3698 Media Attributes in the Session Description Protocol 3699 (SDP)", RFC 5576, June 2009. 3701 [RFC5763] Fischl, J., Tschofenig, H., and E. Rescorla, "Framework 3702 for Establishing a Secure Real-time Transport Protocol 3703 (SRTP) Security Context Using Datagram Transport Layer 3704 Security (DTLS)", RFC 5763, May 2010. 3706 [RFC5764] McGrew, D. and E. Rescorla, "Datagram Transport Layer 3707 Security (DTLS) Extension to Establish Keys for the Secure 3708 Real-time Transport Protocol (SRTP)", RFC 5764, May 2010. 3710 [RFC5956] Begen, A., "Forward Error Correction Grouping Semantics in 3711 the Session Description Protocol", RFC 5956, September 3712 2010. 3714 [RFC6464] Lennox, J., Ed., Ivov, E., and E. Marocco, "A Real-time 3715 Transport Protocol (RTP) Header Extension for Client-to- 3716 Mixer Audio Level Indication", RFC 6464, 3717 DOI 10.17487/RFC6464, December 2011, 3718 . 3720 [W3C.WD-webrtc-20140617] 3721 Bergkvist, A., Burnett, D., Narayanan, A., and C. 3722 Jennings, "WebRTC 1.0: Real-time Communication Between 3723 Browsers", World Wide Web Consortium WD WD-webrtc- 3724 20140617, June 2014, 3725 . 3727 Appendix A. Change log 3729 Note: This section will be removed by RFC Editor before publication. 3731 Changes in draft-14: 3733 o Added discussion of RtpTransceivers + RtpSenders + RtpReceivers, 3734 and how they interact with createOffer/createAnswer. 3736 o Removed obsolete OfferToReceiveX options. 3738 o Explained how addIceCandidate can be used for end-of-candidates. 3740 Changes in draft-13: 3742 o Clarified which SDP lines can be ignored. 3744 o Clarified how to handle various received attributes. 3746 o Revised how atttributes should be generated for bundled m= lines. 3748 o Remove unused references. 3750 o Remove text advocating use of unilateral PTs. 3752 o Trigger an ICE restart even if the ICE candidate policy is being 3753 made more strict. 3755 o Remove the 'public' ICE candidate policy. 3757 o Move open issues/TODOs into GitHub issues. 3759 o Split local/remote description accessors into current/pending. 3761 o Clarify a=imageattr handling. 3763 o Add more detail on VoiceActivityDetection handling. 3765 o Reference draft-shieh-rtcweb-ip-handling. 3767 o Make it clear when an ICE restart should occur. 3769 o Resolve reference TODOs. 3771 o Remove MSID semantics. 3773 o ice-options are now at session level. 3775 o Default RTCP mux policy is now 'require'. 3777 Changes in draft-12: 3779 o Filled in sections on applying local and remote descriptions. 3781 o Discussed downscaling and upscaling to fulfill imageattr 3782 requirements. 3784 o Updated what SDP can be modified by the application. 3786 o Updated to latest datachannel SDP. 3788 o Allowed multiple fingerprint lines. 3790 o Switched back to IPv4 for dummy candidates. 3792 o Added additional clarity on ICE default candidates. 3794 Changes in draft-11: 3796 o Clarified handling of RTP CNAMEs. 3798 o Updated what SDP lines should be processed or ignored. 3800 o Specified how a=imageattr should be used. 3802 Changes in draft-10: 3804 o TODO 3806 Changes in draft-09: 3808 o Don't return null for {local,remote}Description after close(). 3810 o Changed TCP/TLS to UDP/DTLS in RTP profile names. 3812 o Separate out bundle and mux policy. 3814 o Added specific references to FEC mechanisms. 3816 o Added canTrickle mechanism. 3818 o Added section on subsequent answers and, answer options. 3820 o Added text defining set{Local,Remote}Description behavior. 3822 Changes in draft-08: 3824 o Added new example section and removed old examples in appendix. 3826 o Fixed field handling. 3828 o Added text describing a=rtcp attribute. 3830 o Reworked handling of OfferToReceiveAudio and OfferToReceiveVideo 3831 per discussion at IETF 90. 3833 o Reworked trickle ICE handling and its impact on m= and c= lines 3834 per discussion at interim. 3836 o Added max-bundle-and-rtcp-mux policy. 3838 o Added description of maxptime handling. 3840 o Updated ICE candidate pool default to 0. 3842 o Resolved open issues around AppID/receiver-ID. 3844 o Reworked and expanded how changes to the ICE configuration are 3845 handled. 3847 o Some reference updates. 3849 o Editorial clarification. 3851 Changes in draft-07: 3853 o Expanded discussion of VAD and Opus DTX. 3855 o Added a security considerations section. 3857 o Rewrote the section on modifying SDP to require implementations to 3858 clearly indicate whether any given modification is allowed. 3860 o Clarified impact of IceRestart on CreateOffer in local-offer 3861 state. 3863 o Guidance on whether attributes should be defined at the media 3864 level or the session level. 3866 o Renamed "default" bundle policy to "balanced". 3868 o Removed default ICE candidate pool size and clarify how it works. 3870 o Defined a canonical order for assignment of MSTs to m= lines. 3872 o Removed discussion of rehydration. 3874 o Added Eric Rescorla as a draft editor. 3876 o Cleaned up references. 3878 o Editorial cleanup 3880 Changes in draft-06: 3882 o Reworked handling of m= line recycling. 3884 o Added handling of BUNDLE and bundle-only. 3886 o Clarified handling of rollback. 3888 o Added text describing the ICE Candidate Pool and its behavior. 3890 o Allowed OfferToReceiveX to create multiple recvonly m= sections. 3892 Changes in draft-05: 3894 o Fixed several issues identified in the createOffer/Answer sections 3895 during document review. 3897 o Updated references. 3899 Changes in draft-04: 3901 o Filled in sections on createOffer and createAnswer. 3903 o Added SDP examples. 3905 o Fixed references. 3907 Changes in draft-03: 3909 o Added text describing relationship to W3C specification 3911 Changes in draft-02: 3913 o Converted from nroff 3915 o Removed comparisons to old approaches abandoned by the working 3916 group 3918 o Removed stuff that has moved to W3C specification 3920 o Align SDP handling with W3C draft 3922 o Clarified section on forking. 3924 Changes in draft-01: 3926 o Added diagrams for architecture and state machine. 3928 o Added sections on forking and rehydration. 3930 o Clarified meaning of "pranswer" and "answer". 3932 o Reworked how ICE restarts and media directions are controlled. 3934 o Added list of parameters that can be changed in a description. 3936 o Updated suggested API and examples to match latest thinking. 3938 o Suggested API and examples have been moved to an appendix. 3940 Changes in draft -00: 3942 o Migrated from draft-uberti-rtcweb-jsep-02. 3944 Authors' Addresses 3946 Justin Uberti 3947 Google 3948 747 6th St S 3949 Kirkland, WA 98033 3950 USA 3952 Email: justin@uberti.name 3954 Cullen Jennings 3955 Cisco 3956 170 West Tasman Drive 3957 San Jose, CA 95134 3958 USA 3960 Email: fluffy@iii.ca 3962 Eric Rescorla (editor) 3963 Mozilla 3964 331 Evelyn Ave 3965 Mountain View, CA 94041 3966 USA 3968 Email: ekr@rtfm.com