idnits 2.17.1 draft-ietf-rtcweb-jsep-15.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- == There are 25 instances of lines with non-RFC6890-compliant IPv4 addresses in the document. If these are example addresses, they should be changed. == There are 10 instances of lines with private range IPv4 addresses in the document. If these are generic example addresses, they should be changed to use any of the ranges defined in RFC 6890 (or successor): 192.0.2.x, 198.51.100.x or 203.0.113.x. -- The document has examples using IPv4 documentation addresses according to RFC6890, but does not use any IPv6 documentation addresses. Maybe there should be IPv6 examples, too? Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (July 7, 2016) is 2848 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 751 == Missing Reference: 'TODO' is mentioned on line 959, but not defined == Unused Reference: 'I-D.ietf-rtcweb-audio' is defined on line 3609, but no explicit reference was found in the text == Unused Reference: 'I-D.ietf-rtcweb-video' is defined on line 3633, but no explicit reference was found in the text == Outdated reference: A later version (-09) exists of draft-ietf-avtext-rid-00 == Outdated reference: A later version (-17) exists of draft-ietf-mmusic-msid-01 == Outdated reference: A later version (-15) exists of draft-ietf-mmusic-rid-04 == Outdated reference: A later version (-26) exists of draft-ietf-mmusic-sctp-sdp-04 == Outdated reference: A later version (-54) exists of draft-ietf-mmusic-sdp-bundle-negotiation-04 == Outdated reference: A later version (-19) exists of draft-ietf-mmusic-sdp-mux-attributes-01 == Outdated reference: A later version (-14) exists of draft-ietf-mmusic-sdp-simulcast-04 == Outdated reference: A later version (-11) exists of draft-ietf-rtcweb-audio-02 == Outdated reference: A later version (-10) exists of draft-ietf-rtcweb-fec-00 == Outdated reference: A later version (-26) exists of draft-ietf-rtcweb-rtp-usage-09 == Outdated reference: A later version (-12) exists of draft-ietf-rtcweb-security-06 == Outdated reference: A later version (-20) exists of draft-ietf-rtcweb-security-arch-09 == Outdated reference: A later version (-06) exists of draft-ietf-rtcweb-video-00 -- 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 (-12) exists of draft-ietf-rtcweb-ip-handling-01 == Outdated reference: A later version (-08) exists of draft-nandakumar-rtcweb-sdp-02 Summary: 5 errors (**), 0 flaws (~~), 21 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: January 8, 2017 Cisco 6 E. Rescorla, Ed. 7 Mozilla 8 July 7, 2016 10 Javascript Session Establishment Protocol 11 draft-ietf-rtcweb-jsep-15 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 January 8, 2017. 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 . . . . . . . . . 16 75 3.7. Interactions With Forking . . . . . . . . . . . . . . . . 17 76 3.7.1. Sequential Forking . . . . . . . . . . . . . . . . . 17 77 3.7.2. Parallel Forking . . . . . . . . . . . . . . . . . . 18 78 4. Interface . . . . . . . . . . . . . . . . . . . . . . . . . . 19 79 4.1. Methods . . . . . . . . . . . . . . . . . . . . . . . . . 19 80 4.1.1. Constructor . . . . . . . . . . . . . . . . . . . . . 19 81 4.1.2. addTrack . . . . . . . . . . . . . . . . . . . . . . 21 82 4.1.3. addTransceiver . . . . . . . . . . . . . . . . . . . 21 83 4.1.4. createDataChannel . . . . . . . . . . . . . . . . . . 21 84 4.1.5. createOffer . . . . . . . . . . . . . . . . . . . . . 21 85 4.1.6. createAnswer . . . . . . . . . . . . . . . . . . . . 22 86 4.1.7. SessionDescriptionType . . . . . . . . . . . . . . . 23 87 4.1.7.1. Use of Provisional Answers . . . . . . . . . . . 24 88 4.1.7.2. Rollback . . . . . . . . . . . . . . . . . . . . 24 89 4.1.8. setLocalDescription . . . . . . . . . . . . . . . . . 25 90 4.1.9. setRemoteDescription . . . . . . . . . . . . . . . . 26 91 4.1.10. currentLocalDescription . . . . . . . . . . . . . . . 26 92 4.1.11. pendingLocalDescription . . . . . . . . . . . . . . . 27 93 4.1.12. currentRemoteDescription . . . . . . . . . . . . . . 27 94 4.1.13. pendingRemoteDescription . . . . . . . . . . . . . . 27 95 4.1.14. canTrickleIceCandidates . . . . . . . . . . . . . . . 27 96 4.1.15. setConfiguration . . . . . . . . . . . . . . . . . . 28 97 4.1.16. addIceCandidate . . . . . . . . . . . . . . . . . . . 29 98 5. SDP Interaction Procedures . . . . . . . . . . . . . . . . . 29 99 5.1. Requirements Overview . . . . . . . . . . . . . . . . . . 29 100 5.1.1. Implementation Requirements . . . . . . . . . . . . . 29 101 5.1.2. Usage Requirements . . . . . . . . . . . . . . . . . 31 102 5.1.3. Profile Names and Interoperability . . . . . . . . . 31 103 5.2. Constructing an Offer . . . . . . . . . . . . . . . . . . 32 104 5.2.1. Initial Offers . . . . . . . . . . . . . . . . . . . 32 105 5.2.2. Subsequent Offers . . . . . . . . . . . . . . . . . . 38 106 5.2.3. Options Handling . . . . . . . . . . . . . . . . . . 41 107 5.2.3.1. IceRestart . . . . . . . . . . . . . . . . . . . 41 108 5.2.3.2. VoiceActivityDetection . . . . . . . . . . . . . 41 109 5.2.4. Direction Attribute in Offers . . . . . . . . . . . . 42 110 5.3. Generating an Answer . . . . . . . . . . . . . . . . . . 42 111 5.3.1. Initial Answers . . . . . . . . . . . . . . . . . . . 42 112 5.3.2. Subsequent Answers . . . . . . . . . . . . . . . . . 47 113 5.3.3. Options Handling . . . . . . . . . . . . . . . . . . 48 114 5.3.3.1. VoiceActivityDetection . . . . . . . . . . . . . 48 115 5.3.4. Direction Attribute in Answers . . . . . . . . . . . 48 116 5.4. Processing a Local Description . . . . . . . . . . . . . 49 117 5.5. Processing a Remote Description . . . . . . . . . . . . . 49 118 5.6. Parsing a Session Description . . . . . . . . . . . . . . 50 119 5.6.1. Session-Level Parsing . . . . . . . . . . . . . . . . 51 120 5.6.2. Media Section Parsing . . . . . . . . . . . . . . . . 53 121 5.6.3. Semantics Verification . . . . . . . . . . . . . . . 55 122 5.7. Applying a Local Description . . . . . . . . . . . . . . 56 123 5.8. Applying a Remote Description . . . . . . . . . . . . . . 58 124 5.9. Applying an Answer . . . . . . . . . . . . . . . . . . . 60 125 6. Configurable SDP Parameters . . . . . . . . . . . . . . . . . 62 126 7. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 63 127 7.1. Simple Example . . . . . . . . . . . . . . . . . . . . . 63 128 7.2. Normal Examples . . . . . . . . . . . . . . . . . . . . . 67 129 8. Security Considerations . . . . . . . . . . . . . . . . . . . 77 130 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 77 131 10. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 78 132 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 78 133 11.1. Normative References . . . . . . . . . . . . . . . . . . 78 134 11.2. Informative References . . . . . . . . . . . . . . . . . 81 135 Appendix A. Change log . . . . . . . . . . . . . . . . . . . . . 82 136 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 87 138 1. Introduction 140 This document describes how the W3C WEBRTC RTCPeerConnection 141 interface [W3C.WD-webrtc-20140617] is used to control the setup, 142 management and teardown of a multimedia session. 144 1.1. General Design of JSEP 146 The thinking behind WebRTC call setup has been to fully specify and 147 control the media plane, but to leave the signaling plane up to the 148 application as much as possible. The rationale is that different 149 applications may prefer to use different protocols, such as the 150 existing SIP or Jingle call signaling protocols, or something custom 151 to the particular application, perhaps for a novel use case. In this 152 approach, the key information that needs to be exchanged is the 153 multimedia session description, which specifies the necessary 154 transport and media configuration information necessary to establish 155 the media plane. 157 With these considerations in mind, this document describes the 158 Javascript Session Establishment Protocol (JSEP) that allows for full 159 control of the signaling state machine from Javascript. JSEP removes 160 the browser almost entirely from the core signaling flow, which is 161 instead handled by the Javascript making use of two interfaces: (1) 162 passing in local and remote session descriptions and (2) interacting 163 with the ICE state machine. 165 In this document, the use of JSEP is described as if it always occurs 166 between two browsers. Note though in many cases it will actually be 167 between a browser and some kind of server, such as a gateway or MCU. 168 This distinction is invisible to the browser; it just follows the 169 instructions it is given via the API. 171 JSEP's handling of session descriptions is simple and 172 straightforward. Whenever an offer/answer exchange is needed, the 173 initiating side creates an offer by calling a createOffer() API. The 174 application optionally modifies that offer, and then uses it to set 175 up its local config via the setLocalDescription() API. The offer is 176 then sent off to the remote side over its preferred signaling 177 mechanism (e.g., WebSockets); upon receipt of that offer, the remote 178 party installs it using the setRemoteDescription() API. 180 To complete the offer/answer exchange, the remote party uses the 181 createAnswer() API to generate an appropriate answer, applies it 182 using the setLocalDescription() API, and sends the answer back to the 183 initiator over the signaling channel. When the initiator gets that 184 answer, it installs it using the setRemoteDescription() API, and 185 initial setup is complete. This process can be repeated for 186 additional offer/answer exchanges. 188 Regarding ICE [RFC5245], JSEP decouples the ICE state machine from 189 the overall signaling state machine, as the ICE state machine must 190 remain in the browser, because only the browser has the necessary 191 knowledge of candidates and other transport info. Performing this 192 separation also provides additional flexibility; in protocols that 193 decouple session descriptions from transport, such as Jingle, the 194 session description can be sent immediately and the transport 195 information can be sent when available. In protocols that don't, 196 such as SIP, the information can be used in the aggregated form. 197 Sending transport information separately can allow for faster ICE and 198 DTLS startup, since ICE checks can start as soon as any transport 199 information is available rather than waiting for all of it. 201 Through its abstraction of signaling, the JSEP approach does require 202 the application to be aware of the signaling process. While the 203 application does not need to understand the contents of session 204 descriptions to set up a call, the application must call the right 205 APIs at the right times, convert the session descriptions and ICE 206 information into the defined messages of its chosen signaling 207 protocol, and perform the reverse conversion on the messages it 208 receives from the other side. 210 One way to mitigate this is to provide a Javascript library that 211 hides this complexity from the developer; said library would 212 implement a given signaling protocol along with its state machine and 213 serialization code, presenting a higher level call-oriented interface 214 to the application developer. For example, libraries exist to adapt 215 the JSEP API into an API suitable for a SIP or XMPP. Thus, JSEP 216 provides greater control for the experienced developer without 217 forcing any additional complexity on the novice developer. 219 1.2. Other Approaches Considered 221 One approach that was considered instead of JSEP was to include a 222 lightweight signaling protocol. Instead of providing session 223 descriptions to the API, the API would produce and consume messages 224 from this protocol. While providing a more high-level API, this put 225 more control of signaling within the browser, forcing the browser to 226 have to understand and handle concepts like signaling glare. In 227 addition, it prevented the application from driving the state machine 228 to a desired state, as is needed in the page reload case. 230 A second approach that was considered but not chosen was to decouple 231 the management of the media control objects from session 232 descriptions, instead offering APIs that would control each component 233 directly. This was rejected based on a feeling that requiring 234 exposure of this level of complexity to the application programmer 235 would not be beneficial; it would result in an API where even a 236 simple example would require a significant amount of code to 237 orchestrate all the needed interactions, as well as creating a large 238 API surface that needed to be agreed upon and documented. In 239 addition, these API points could be called in any order, resulting in 240 a more complex set of interactions with the media subsystem than the 241 JSEP approach, which specifies how session descriptions are to be 242 evaluated and applied. 244 One variation on JSEP that was considered was to keep the basic 245 session description-oriented API, but to move the mechanism for 246 generating offers and answers out of the browser. Instead of 247 providing createOffer/createAnswer methods within the browser, this 248 approach would instead expose a getCapabilities API which would 249 provide the application with the information it needed in order to 250 generate its own session descriptions. This increases the amount of 251 work that the application needs to do; it needs to know how to 252 generate session descriptions from capabilities, and especially how 253 to generate the correct answer from an arbitrary offer and the 254 supported capabilities. While this could certainly be addressed by 255 using a library like the one mentioned above, it basically forces the 256 use of said library even for a simple example. Providing 257 createOffer/createAnswer avoids this problem, but still allows 258 applications to generate their own offers/answers (to a large extent) 259 if they choose, using the description generated by createOffer as an 260 indication of the browser's capabilities. 262 2. Terminology 264 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 265 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 266 document are to be interpreted as described in [RFC2119]. 268 3. Semantics and Syntax 270 3.1. Signaling Model 272 JSEP does not specify a particular signaling model or state machine, 273 other than the generic need to exchange session descriptions in the 274 fashion described by [RFC3264](offer/answer) in order for both sides 275 of the session to know how to conduct the session. JSEP provides 276 mechanisms to create offers and answers, as well as to apply them to 277 a session. However, the browser is totally decoupled from the actual 278 mechanism by which these offers and answers are communicated to the 279 remote side, including addressing, retransmission, forking, and glare 280 handling. These issues are left entirely up to the application; the 281 application has complete control over which offers and answers get 282 handed to the browser, and when. 284 +-----------+ +-----------+ 285 | Web App |<--- App-Specific Signaling -->| Web App | 286 +-----------+ +-----------+ 287 ^ ^ 288 | SDP | SDP 289 V V 290 +-----------+ +-----------+ 291 | Browser |<----------- Media ------------>| Browser | 292 +-----------+ +-----------+ 294 Figure 1: JSEP Signaling Model 296 3.2. Session Descriptions and State Machine 298 In order to establish the media plane, the user agent needs specific 299 parameters to indicate what to transmit to the remote side, as well 300 as how to handle the media that is received. These parameters are 301 determined by the exchange of session descriptions in offers and 302 answers, and there are certain details to this process that must be 303 handled in the JSEP APIs. 305 Whether a session description applies to the local side or the remote 306 side affects the meaning of that description. For example, the list 307 of codecs sent to a remote party indicates what the local side is 308 willing to receive, which, when intersected with the set of codecs 309 the remote side supports, specifies what the remote side should send. 310 However, not all parameters follow this rule; for example, the DTLS- 311 SRTP parameters [RFC5763] sent to a remote party indicate what 312 certificate the local side will use in DTLS setup, and thereby what 313 the remote party should expect to receive; the remote party will have 314 to accept these parameters, with no option to choose different 315 values. 317 In addition, various RFCs put different conditions on the format of 318 offers versus answers. For example, an offer may propose an 319 arbitrary number of media streams (i.e. m= sections), but an answer 320 must contain the exact same number as the offer. 322 Lastly, while the exact media parameters are only known only after an 323 offer and an answer have been exchanged, it is possible for the 324 offerer to receive media after they have sent an offer and before 325 they have received an answer. To properly process incoming media in 326 this case, the offerer's media handler must be aware of the details 327 of the offer before the answer arrives. 329 Therefore, in order to handle session descriptions properly, the user 330 agent needs: 332 1. To know if a session description pertains to the local or remote 333 side. 335 2. To know if a session description is an offer or an answer. 337 3. To allow the offer to be specified independently of the answer. 339 JSEP addresses this by adding both setLocalDescription and 340 setRemoteDescription methods and having session description objects 341 contain a type field indicating the type of session description being 342 supplied. This satisfies the requirements listed above for both the 343 offerer, who first calls setLocalDescription(sdp [offer]) and then 344 later setRemoteDescription(sdp [answer]), as well as for the 345 answerer, who first calls setRemoteDescription(sdp [offer]) and then 346 later setLocalDescription(sdp [answer]). 348 JSEP also allows for an answer to be treated as provisional by the 349 application. Provisional answers provide a way for an answerer to 350 communicate initial session parameters back to the offerer, in order 351 to allow the session to begin, while allowing a final answer to be 352 specified later. This concept of a final answer is important to the 353 offer/answer model; when such an answer is received, any extra 354 resources allocated by the caller can be released, now that the exact 355 session configuration is known. These "resources" can include things 356 like extra ICE components, TURN candidates, or video decoders. 357 Provisional answers, on the other hand, do no such deallocation 358 results; as a result, multiple dissimilar provisional answers can be 359 received and applied during call setup. 361 In [RFC3264], the constraint at the signaling level is that only one 362 offer can be outstanding for a given session, but at the media stack 363 level, a new offer can be generated at any point. For example, when 364 using SIP for signaling, if one offer is sent, then cancelled using a 365 SIP CANCEL, another offer can be generated even though no answer was 366 received for the first offer. To support this, the JSEP media layer 367 can provide an offer via the createOffer() method whenever the 368 Javascript application needs one for the signaling. The answerer can 369 send back zero or more provisional answers, and finally end the 370 offer-answer exchange by sending a final answer. The state machine 371 for this is as follows: 373 setRemote(OFFER) setLocal(PRANSWER) 374 /-----\ /-----\ 375 | | | | 376 v | v | 377 +---------------+ | +---------------+ | 378 | |----/ | |----/ 379 | | setLocal(PRANSWER) | | 380 | Remote-Offer |------------------- >| Local-Pranswer| 381 | | | | 382 | | | | 383 +---------------+ +---------------+ 384 ^ | | 385 | | setLocal(ANSWER) | 386 setRemote(OFFER) | | 387 | V setLocal(ANSWER) | 388 +---------------+ | 389 | | | 390 | |<---------------------------+ 391 | Stable | 392 | |<---------------------------+ 393 | | | 394 +---------------+ setRemote(ANSWER) | 395 ^ | | 396 | | setLocal(OFFER) | 397 setRemote(ANSWER) | | 398 | V | 399 +---------------+ +---------------+ 400 | | | | 401 | | setRemote(PRANSWER) | | 402 | Local-Offer |------------------- >|Remote-Pranswer| 403 | | | | 404 | |----\ | |----\ 405 +---------------+ | +---------------+ | 406 ^ | ^ | 407 | | | | 408 \-----/ \-----/ 409 setLocal(OFFER) setRemote(PRANSWER) 411 Figure 2: JSEP State Machine 413 Aside from these state transitions there is no other difference 414 between the handling of provisional ("pranswer") and final ("answer") 415 answers. 417 3.3. Session Description Format 419 In the WebRTC specification, session descriptions are formatted as 420 SDP messages. While this format is not optimal for manipulation from 421 Javascript, it is widely accepted, and frequently updated with new 422 features. Any alternate encoding of session descriptions would have 423 to keep pace with the changes to SDP, at least until the time that 424 this new encoding eclipsed SDP in popularity. As a result, JSEP 425 currently uses SDP as the internal representation for its session 426 descriptions. 428 However, to simplify Javascript processing, and provide for future 429 flexibility, the SDP syntax is encapsulated within a 430 SessionDescription object, which can be constructed from SDP, and be 431 serialized out to SDP. If future specifications agree on a JSON 432 format for session descriptions, we could easily enable this object 433 to generate and consume that JSON. 435 Other methods may be added to SessionDescription in the future to 436 simplify handling of SessionDescriptions from Javascript. In the 437 meantime, Javascript libraries can be used to perform these 438 manipulations. 440 Note that most applications should be able to treat the 441 SessionDescriptions produced and consumed by these various API calls 442 as opaque blobs; that is, the application will not need to read or 443 change them. 445 3.4. Session Description Control 447 In order to give the application control over various common session 448 parameters, JSEP provides control surfaces which tell the browser how 449 to generate session descriptions. This avoids the need for 450 Javascript to modify session descriptions in most cases. 452 Changes to these objects result in changes to the session 453 descriptions generated by subsequent createOffer/Answer calls. 455 3.4.1. RtpTransceivers 457 RtpTransceivers allow the application to control the RTP media 458 associated with one m= section. Each RtpTransceiver has an RtpSender 459 and an RtpReceiver, which an application can use to control the 460 sending and receiving of RTP media. The application may also modify 461 the RtpTransceiver directly, for instance, by stopping it. 463 RtpTransceivers generally have a 1:1 mapping with m= sections, 464 although there may be more RtpTransceivers than m= sections when 465 RtpTransceivers are created but not yet associated with a m= section, 466 or if RtpTransceivers have been stopped and disassociated from m= 467 sections. An RtpTransceiver is never associated with more than one 468 m= section, and once a session description is applied, a m= section 469 is always associated with exactly one RtpTransceiver. 471 RtpTransceivers can be created explicitly by the application or 472 implicitly by calling setRemoteDescription with an offer that adds 473 new m= sections. 475 3.4.2. RtpSenders 477 RtpSenders allow the application to control how RTP media is sent. 478 In particular, the application can control whether an RtpSender is 479 active or not, which affects the directionality attribute of the 480 associated m= section. 482 3.4.3. RtpReceivers 484 RtpReceivers allows the application to control how RTP media is 485 received. In particular, the application can control whether an 486 RtpReceiver is active or not, which affects the directionality 487 attribute of the associated m= section. 489 3.5. ICE 491 3.5.1. ICE Gathering Overview 493 JSEP gathers ICE candidates as needed by the application. Collection 494 of ICE candidates is referred to as a gathering phase, and this is 495 triggered either by the addition of a new or recycled m= line to the 496 local session description, or new ICE credentials in the description, 497 indicating an ICE restart. Use of new ICE credentials can be 498 triggered explicitly by the application, or implicitly by the browser 499 in response to changes in the ICE configuration. 501 When the ICE configuration changes in a way that requires a new 502 gathering phase, a 'needs-ice-restart' bit is set. When this bit is 503 set, calls to the createOffer API will generate new ICE credentials. 504 This bit is cleared by a call to the setLocalDescription API with new 505 ICE credentials from either an offer or an answer, i.e., from either 506 a local- or remote-initiated ICE restart. 508 When a new gathering phase starts, the ICE Agent will notify the 509 application that gathering is occurring through an event. Then, when 510 each new ICE candidate becomes available, the ICE Agent will supply 511 it to the application via an additional event; these candidates will 512 also automatically be added to the current and/or pending local 513 session description. Finally, when all candidates have been 514 gathered, an event will be dispatched to signal that the gathering 515 process is complete. 517 Note that gathering phases only gather the candidates needed by 518 new/recycled/restarting m= lines; other m= lines continue to use 519 their existing candidates. Also, when bundling is active, candidates 520 are only gathered (and exchanged) for the m= lines referenced in 521 BUNDLE-tags, as described in 522 [I-D.ietf-mmusic-sdp-bundle-negotiation]. 524 3.5.2. ICE Candidate Trickling 526 Candidate trickling is a technique through which a caller may 527 incrementally provide candidates to the callee after the initial 528 offer has been dispatched; the semantics of "Trickle ICE" are defined 529 in [I-D.ietf-ice-trickle]. This process allows the callee to begin 530 acting upon the call and setting up the ICE (and perhaps DTLS) 531 connections immediately, without having to wait for the caller to 532 gather all possible candidates. This results in faster media setup 533 in cases where gathering is not performed prior to initiating the 534 call. 536 JSEP supports optional candidate trickling by providing APIs, as 537 described above, that provide control and feedback on the ICE 538 candidate gathering process. Applications that support candidate 539 trickling can send the initial offer immediately and send individual 540 candidates when they get the notified of a new candidate; 541 applications that do not support this feature can simply wait for the 542 indication that gathering is complete, and then create and send their 543 offer, with all the candidates, at this time. 545 Upon receipt of trickled candidates, the receiving application will 546 supply them to its ICE Agent. This triggers the ICE Agent to start 547 using the new remote candidates for connectivity checks. 549 3.5.2.1. ICE Candidate Format 551 As with session descriptions, the syntax of the IceCandidate object 552 provides some abstraction, but can be easily converted to and from 553 the SDP candidate lines. 555 The candidate lines are the only SDP information that is contained 556 within IceCandidate, as they represent the only information needed 557 that is not present in the initial offer (i.e., for trickle 558 candidates). This information is carried with the same syntax as the 559 "candidate-attribute" field defined for ICE. For example: 561 candidate:1 1 UDP 1694498815 192.0.2.33 10000 typ host 563 The IceCandidate object also contains fields to indicate which m= 564 line it should be associated with. The m= line can be identified in 565 one of two ways; either by a m= line index, or a MID. The m= line 566 index is a zero-based index, with index N referring to the N+1th m= 567 line in the SDP sent by the entity which sent the IceCandidate. The 568 MID uses the "media stream identification" attribute, as defined in 569 [RFC5888], Section 4, to identify the m= line. JSEP implementations 570 creating an ICE Candidate object MUST populate both of these fields. 571 Implementations receiving an ICE Candidate object MUST use the MID if 572 present, or the m= line index, if not (as it could have come from a 573 non-JSEP endpoint). 575 3.5.3. ICE Candidate Policy 577 Typically, when gathering ICE candidates, the browser will gather all 578 possible forms of initial candidates - host, server reflexive, and 579 relay. However, in certain cases, applications may want to have more 580 specific control over the gathering process, due to privacy or 581 related concerns. For example, one may want to suppress the use of 582 host candidates, to avoid exposing information about the local 583 network, or go as far as only using relay candidates, to leak as 584 little location information as possible (note that these choices come 585 with corresponding operational costs). To accomplish this, the 586 browser MUST allow the application to restrict which ICE candidates 587 are used in a session. Note that this filtering is applied on top of 588 any restrictions the browser chooses to enforce regarding which IP 589 addresses are permitted for the application, as discussed in 590 [I-D.ietf-rtcweb-ip-handling]. 592 There may also be cases where the application wants to change which 593 types of candidates are used while the session is active. A prime 594 example is where a callee may initially want to use only relay 595 candidates, to avoid leaking location information to an arbitrary 596 caller, but then change to use all candidates (for lower operational 597 cost) once the user has indicated they want to take the call. For 598 this scenario, the browser MUST allow the candidate policy to be 599 changed in mid-session, subject to the aforementioned interactions 600 with local policy. 602 To administer the ICE candidate policy, the browser will determine 603 the current setting at the start of each gathering phase. Then, 604 during the gathering phase, the browser MUST NOT expose candidates 605 disallowed by the current policy to the application, use them as the 606 source of connectivity checks, or indirectly expose them via other 607 fields, such as the raddr/rport attributes for other ICE candidates. 609 Later, if a different policy is specified by the application, the 610 application can apply it by kicking off a new gathering phase via an 611 ICE restart. 613 3.5.4. ICE Candidate Pool 615 JSEP applications typically inform the browser to begin ICE gathering 616 via the information supplied to setLocalDescription, as this is where 617 the app specifies the number of media streams, and thereby ICE 618 components, for which to gather candidates. However, to accelerate 619 cases where the application knows the number of ICE components to use 620 ahead of time, it may ask the browser to gather a pool of potential 621 ICE candidates to help ensure rapid media setup. 623 When setLocalDescription is eventually called, and the browser goes 624 to gather the needed ICE candidates, it SHOULD start by checking if 625 any candidates are available in the pool. If there are candidates in 626 the pool, they SHOULD be handed to the application immediately via 627 the ICE candidate event. If the pool becomes depleted, either 628 because a larger-than-expected number of ICE components is used, or 629 because the pool has not had enough time to gather candidates, the 630 remaining candidates are gathered as usual. 632 One example of where this concept is useful is an application that 633 expects an incoming call at some point in the future, and wants to 634 minimize the time it takes to establish connectivity, to avoid 635 clipping of initial media. By pre-gathering candidates into the 636 pool, it can exchange and start sending connectivity checks from 637 these candidates almost immediately upon receipt of a call. Note 638 though that by holding on to these pre-gathered candidates, which 639 will be kept alive as long as they may be needed, the application 640 will consume resources on the STUN/TURN servers it is using. 642 3.6. Video Size Negotiation 644 Video size negotiation is the process through which a receiver can 645 use the "a=imageattr" SDP attribute [RFC6236] to indicate what video 646 frame sizes it is capable of receiving. A receiver may have hard 647 limits on what its video decoder can process, or it may wish to 648 constrain what it receives due to application preferences, e.g. a 649 specific size for the window in which the video will be displayed. 651 3.6.1. Creating an imageattr Attribute 653 In order to determine the limits on what video resolution a receiver 654 wants to receive, it will intersect its decoder hard limits with any 655 mandatory constraints that have been applied to the associated 656 MediaStreamTrack. If the decoder limits are unknown, e.g. when using 657 a software decoder, the mandatory constraints are used directly. For 658 the answerer, these mandatory constraints can be applied to the 659 remote MediaStreamTracks that are created by a setRemoteDescription 660 call, and will affect the output of the ensuing createAnswer call. 661 Any constraints set after setLocalDescription is used to set the 662 answer will result in a new offer-answer exchange. For the offerer, 663 because it does not know about any remote MediaStreamTracks until it 664 receives the answer, the offer can only reflect decoder hard limits. 665 If the offerer wishes to set mandatory constraints on video 666 resolution, it must do so after receiving the answer, and the result 667 will be a new offer-answer to communicate them. 669 If there are no known decoder limits or mandatory constraints, the 670 "a=imageattr" attribute SHOULD be omitted. 672 Otherwise, an "a=imageattr" attribute is created with "recv" 673 direction, and the resulting resolution space formed by intersecting 674 the decoder limits and constraints is used to specify its minimum and 675 maximum x= and y= values. If the intersection is the null set, i.e., 676 there are no resolutions that are permitted by both the decoder and 677 the mandatory constraints, this SHOULD be represented by x=0 and y=0 678 values. 680 The rules here express a single set of preferences, and therefore, 681 the "a=imageattr" q= value is not important. It SHOULD be set to 682 1.0. 684 The "a=imageattr" field is payload type specific. When all video 685 codecs supported have the same capabilities, use of a single 686 attribute, with the wildcard payload type (*), is RECOMMENDED. 687 However, when the supported video codecs have differing capabilities, 688 specific "a=imageattr" attributes MUST be inserted for each payload 689 type. 691 As an example, consider a system with a HD-capable, multiformat video 692 decoder, where the application has constrained the received track to 693 at most 360p. In this case, the implementation would generate this 694 attribute: 696 a=imageattr:* recv [x=[16:640],y=[16:360],q=1.0] 698 This declaration indicates that the receiver is capable of decoding 699 any image resolution from 16x16 up to 640x360 pixels. 701 3.6.2. Interpreting an imageattr Attribute 703 [RFC6236] defines "a=imageattr" to be an advisory field. This means 704 that it does not absolutely constrain the video formats that the 705 sender can use, but gives an indication of the preferred values. 707 This specification prescribes more specific behavior. When a sender 708 of a given MediaStreamTrack, which is producing video of a certain 709 resolution, receives an "a=imageattr recv" attribute, it MUST check 710 to see if the original resolution meets the size criteria specified 711 in the attribute, and adapt the resolution accordingly by scaling (if 712 appropriate). Note that when considering a MediaStreamTrack that is 713 producing rotated video, the unrotated resolution MUST be used. This 714 is required regardless of whether the receiver supports performing 715 receive-side rotation (e.g., through CVO), as it significantly 716 simplifies the matching logic. 718 For an "a=imageattr recv" attribute, only size limits are considered. 719 Any other values, e.g. aspect ratio, MUST be ignored. 721 When communicating with a non-JSEP endpoint, multiple relevant 722 "a=imageattr recv" attributes may be received. If this occurs, 723 attributes other than the one with the highest "q=" value MUST be 724 ignored. 726 If an "a=imageattr recv" attribute references a different video codec 727 than what has been selected for the MediaStreamTrack, it MUST be 728 ignored. 730 If the original resolution matches the size limits in the attribute, 731 the track MUST be transmitted untouched. 733 If the original resolution exceeds the size limits in the attribute, 734 the sender SHOULD apply downscaling to the output of the 735 MediaStreamTrack in order to satisfy the limits. Downscaling MUST 736 NOT change the track aspect ratio. 738 If the original resolution is less than the size limits in the 739 attribute, upscaling is needed, but this may not be appropriate in 740 all cases. To address this concern, the application can set an 741 upscaling policy for each sent track. For this case, if upscaling is 742 permitted by policy, the sender SHOULD apply upscaling in order to 743 provide the desired resolution. Otherwise, the sender MUST NOT apply 744 upscaling. The sender SHOULD NOT upscale in other cases, even if the 745 policy permits it. Upscaling MUST NOT change the track aspect ratio. 747 If there is no appropriate and permitted scaling mechanism that 748 allows the received size limits to be satisfied, the sender MUST NOT 749 transmit the track. 751 In the special case of receiving a maximum resolution of [0, 0], as 752 described above, the sender MUST NOT transmit the track. 754 3.7. Interactions With Forking 756 Some call signaling systems allow various types of forking where an 757 SDP Offer may be provided to more than one device. For example, SIP 758 [RFC3261] defines both a "Parallel Search" and "Sequential Search". 759 Although these are primarily signaling level issues that are outside 760 the scope of JSEP, they do have some impact on the configuration of 761 the media plane that is relevant. When forking happens at the 762 signaling layer, the Javascript application responsible for the 763 signaling needs to make the decisions about what media should be sent 764 or received at any point of time, as well as which remote endpoint it 765 should communicate with; JSEP is used to make sure the media engine 766 can make the RTP and media perform as required by the application. 767 The basic operations that the applications can have the media engine 768 do are: 770 o Start exchanging media with a given remote peer, but keep all the 771 resources reserved in the offer. 773 o Start exchanging media with a given remote peer, and free any 774 resources in the offer that are not being used. 776 3.7.1. Sequential Forking 778 Sequential forking involves a call being dispatched to multiple 779 remote callees, where each callee can accept the call, but only one 780 active session ever exists at a time; no mixing of received media is 781 performed. 783 JSEP handles sequential forking well, allowing the application to 784 easily control the policy for selecting the desired remote endpoint. 785 When an answer arrives from one of the callees, the application can 786 choose to apply it either as a provisional answer, leaving open the 787 possibility of using a different answer in the future, or apply it as 788 a final answer, ending the setup flow. 790 In a "first-one-wins" situation, the first answer will be applied as 791 a final answer, and the application will reject any subsequent 792 answers. In SIP parlance, this would be ACK + BYE. 794 In a "last-one-wins" situation, all answers would be applied as 795 provisional answers, and any previous call leg will be terminated. 796 At some point, the application will end the setup process, perhaps 797 with a timer; at this point, the application could reapply the 798 pending remote description as a final answer. 800 3.7.2. Parallel Forking 802 Parallel forking involves a call being dispatched to multiple remote 803 callees, where each callee can accept the call, and multiple 804 simultaneous active signaling sessions can be established as a 805 result. If multiple callees send media at the same time, the 806 possibilities for handling this are described in Section 3.1 of 807 [RFC3960]. Most SIP devices today only support exchanging media with 808 a single device at a time, and do not try to mix multiple early media 809 audio sources, as that could result in a confusing situation. For 810 example, consider having a European ringback tone mixed together with 811 the North American ringback tone - the resulting sound would not be 812 like either tone, and would confuse the user. If the signaling 813 application wishes to only exchange media with one of the remote 814 endpoints at a time, then from a media engine point of view, this is 815 exactly like the sequential forking case. 817 In the parallel forking case where the Javascript application wishes 818 to simultaneously exchange media with multiple peers, the flow is 819 slightly more complex, but the Javascript application can follow the 820 strategy that [RFC3960] describes using UPDATE. The UPDATE approach 821 allows the signaling to set up a separate media flow for each peer 822 that it wishes to exchange media with. In JSEP, this offer used in 823 the UPDATE would be formed by simply creating a new PeerConnection 824 and making sure that the same local media streams have been added 825 into this new PeerConnection. Then the new PeerConnection object 826 would produce a SDP offer that could be used by the signaling to 827 perform the UPDATE strategy discussed in [RFC3960]. 829 As a result of sharing the media streams, the application will end up 830 with N parallel PeerConnection sessions, each with a local and remote 831 description and their own local and remote addresses. The media flow 832 from these sessions can be managed by specifying SDP direction 833 attributes in the descriptions, or the application can choose to play 834 out the media from all sessions mixed together. Of course, if the 835 application wants to only keep a single session, it can simply 836 terminate the sessions that it no longer needs. 838 4. Interface 840 This section details the basic operations that must be present to 841 implement JSEP functionality. The actual API exposed in the W3C API 842 may have somewhat different syntax, but should map easily to these 843 concepts. 845 4.1. Methods 847 4.1.1. Constructor 849 The PeerConnection constructor allows the application to specify 850 global parameters for the media session, such as the STUN/TURN 851 servers and credentials to use when gathering candidates, as well as 852 the initial ICE candidate policy and pool size, and also the bundle 853 policy to use. 855 If an ICE candidate policy is specified, it functions as described in 856 Section 3.5.3, causing the browser to only surface the permitted 857 candidates (including any internal browser filtering) to the 858 application, and only use those candidates for connectivity checks. 859 The set of available policies is as follows: 861 all: All candidates permitted by browser policy will be gathered and 862 used. 864 relay: All candidates except relay candidates will be filtered out. 865 This obfuscates the location information that might be ascertained 866 by the remote peer from the received candidates. Depending on how 867 the application deploys its relay servers, this could obfuscate 868 location to a metro or possibly even global level. 870 The default ICE candidate policy MUST be set to "all" as this is 871 generally the desired policy, and also typically reduces use of 872 application TURN server resources significantly. 874 If a size is specified for the ICE candidate pool, this indicates the 875 number of ICE components to pre-gather candidates for. Because pre- 876 gathering results in utilizing STUN/TURN server resources for 877 potentially long periods of time, this must only occur upon 878 application request, and therefore the default candidate pool size 879 MUST be zero. 881 The application can specify its preferred policy regarding use of 882 bundle, the multiplexing mechanism defined in 883 [I-D.ietf-mmusic-sdp-bundle-negotiation]. Regardless of policy, the 884 application will always try to negotiate bundle onto a single 885 transport, and will offer a single bundle group across all media 886 section; use of this single transport is contingent upon the answerer 887 accepting bundle. However, by specifying a policy from the list 888 below, the application can control exactly how aggressively it will 889 try to bundle media streams together, which affects how it will 890 interoperate with a non-bundle-aware endpoint. When negotiating with 891 a non-bundle-aware endpoint, only the streams not marked as bundle- 892 only streams will be established. 894 The set of available policies is as follows: 896 balanced: The first media section of each type (audio, video, or 897 application) will contain transport parameters, which will allow 898 an answerer to unbundle that section. The second and any 899 subsequent media section of each type will be marked bundle-only. 900 The result is that if there are N distinct media types, then 901 candidates will be gathered for for N media streams. This policy 902 balances desire to multiplex with the need to ensure basic audio 903 and video can still be negotiated in legacy cases. When acting as 904 answerer, if there is no bundle group in the offer, the 905 implementation will reject all but the first m= section of each 906 type. 908 max-compat: All media sections will contain transport parameters; 909 none will be marked as bundle-only. This policy will allow all 910 streams to be received by non-bundle-aware endpoints, but require 911 separate candidates to be gathered for each media stream. 913 max-bundle: Only the first media section will contain transport 914 parameters; all streams other than the first will be marked as 915 bundle-only. This policy aims to minimize candidate gathering and 916 maximize multiplexing, at the cost of less compatibility with 917 legacy endpoints. When acting as answerer, if there if no bundle 918 group in the offer, the implementation will reject all but the 919 first m= section. 921 As it provides the best tradeoff between performance and 922 compatibility with legacy endpoints, the default bundle policy MUST 923 be set to "balanced". 925 The application can specify its preferred policy regarding use of 926 RTP/RTCP multiplexing [RFC5761] using one of the following policies: 928 negotiate: The browser will gather both RTP and RTCP candidates but 929 also will offer "a=rtcp-mux", thus allowing for compatibility with 930 either multiplexing or non-multiplexing endpoints. 932 require: The browser will only gather RTP candidates. This halves 933 the number of candidates that the offerer needs to gather. When 934 acting as answerer, the implementation will reject any m= section 935 that does not contain an "a=rtcp-mux" attribute. 937 The default multiplexing policy MUST be set to "require". 938 Implementations MAY choose to reject attempts by the application to 939 set the multiplexing policy to "negotiate". 941 4.1.2. addTrack 943 The addTrack method adds a MediaStreamTrack to the PeerConnection, 944 using the MediaStream argument to associate the track with other 945 tracks in the same MediaStream, so that they can be added to the same 946 "LS" group when creating an offer or answer. addTrack attempts to 947 minimize the number of transceivers as follows: The track will be 948 attached to the first compatible transceiver (of the same media type) 949 which has never had a direction of "sendonly" or "sendrecv". If no 950 such transceiver exists, then one will be constructed as described in 951 Section 4.1.3. 953 4.1.3. addTransceiver 955 [TODO] 957 4.1.4. createDataChannel 959 [TODO] 961 4.1.5. createOffer 963 The createOffer method generates a blob of SDP that contains a 964 [RFC3264] offer with the supported configurations for the session, 965 including descriptions of the media added to this PeerConnection, the 966 codec/RTP/RTCP options supported by this implementation, and any 967 candidates that have been gathered by the ICE Agent. An options 968 parameter may be supplied to provide additional control over the 969 generated offer. This options parameter allows an application to 970 trigger an ICE restart, for the purpose of reestablishing 971 connectivity. 973 In the initial offer, the generated SDP will contain all desired 974 functionality for the session (functionality that is supported but 975 not desired by default may be omitted); for each SDP line, the 976 generation of the SDP will follow the process defined for generating 977 an initial offer from the document that specifies the given SDP line. 978 The exact handling of initial offer generation is detailed in 979 Section 5.2.1 below. 981 In the event createOffer is called after the session is established, 982 createOffer will generate an offer to modify the current session 983 based on any changes that have been made to the session, e.g., adding 984 or stopping RtpTransceivers, or requesting an ICE restart. For each 985 existing stream, the generation of each SDP line must follow the 986 process defined for generating an updated offer from the RFC that 987 specifies the given SDP line. For each new stream, the generation of 988 the SDP must follow the process of generating an initial offer, as 989 mentioned above. If no changes have been made, or for SDP lines that 990 are unaffected by the requested changes, the offer will only contain 991 the parameters negotiated by the last offer-answer exchange. The 992 exact handling of subsequent offer generation is detailed in 993 Section 5.2.2. below. 995 Session descriptions generated by createOffer must be immediately 996 usable by setLocalDescription; if a system has limited resources 997 (e.g. a finite number of decoders), createOffer should return an 998 offer that reflects the current state of the system, so that 999 setLocalDescription will succeed when it attempts to acquire those 1000 resources. Because this method may need to inspect the system state 1001 to determine the currently available resources, it may be implemented 1002 as an async operation. 1004 Calling this method may do things such as generate new ICE 1005 credentials, but does not result in candidate gathering, or cause 1006 media to start or stop flowing. 1008 4.1.6. createAnswer 1010 The createAnswer method generates a blob of SDP that contains a 1011 [RFC3264] SDP answer with the supported configuration for the session 1012 that is compatible with the parameters supplied in the most recent 1013 call to setRemoteDescription, which MUST have been called prior to 1014 calling createAnswer. Like createOffer, the returned blob contains 1015 descriptions of the media added to this PeerConnection, the 1016 codec/RTP/RTCP options negotiated for this session, and any 1017 candidates that have been gathered by the ICE Agent. An options 1018 parameter may be supplied to provide additional control over the 1019 generated answer. 1021 As an answer, the generated SDP will contain a specific configuration 1022 that specifies how the media plane should be established; for each 1023 SDP line, the generation of the SDP must follow the process defined 1024 for generating an answer from the document that specifies the given 1025 SDP line. The exact handling of answer generation is detailed in 1026 Section 5.3. below. 1028 Session descriptions generated by createAnswer must be immediately 1029 usable by setLocalDescription; like createOffer, the returned 1030 description should reflect the current state of the system. Because 1031 this method may need to inspect the system state to determine the 1032 currently available resources, it may need to be implemented as an 1033 async operation. 1035 Calling this method may do things such as generate new ICE 1036 credentials, but does not trigger candidate gathering or change media 1037 state. 1039 4.1.7. SessionDescriptionType 1041 Session description objects (RTCSessionDescription) may be of type 1042 "offer", "pranswer", "answer" or "rollback". These types provide 1043 information as to how the description parameter should be parsed, and 1044 how the media state should be changed. 1046 "offer" indicates that a description should be parsed as an offer; 1047 said description may include many possible media configurations. A 1048 description used as an "offer" may be applied anytime the 1049 PeerConnection is in a stable state, or as an update to a previously 1050 supplied but unanswered "offer". 1052 "pranswer" indicates that a description should be parsed as an 1053 answer, but not a final answer, and so should not result in the 1054 freeing of allocated resources. It may result in the start of media 1055 transmission, if the answer does not specify an inactive media 1056 direction. A description used as a "pranswer" may be applied as a 1057 response to an "offer", or an update to a previously sent "pranswer". 1059 "answer" indicates that a description should be parsed as an answer, 1060 the offer-answer exchange should be considered complete, and any 1061 resources (decoders, candidates) that are no longer needed can be 1062 released. A description used as an "answer" may be applied as a 1063 response to an "offer", or an update to a previously sent "pranswer". 1065 The only difference between a provisional and final answer is that 1066 the final answer results in the freeing of any unused resources that 1067 were allocated as a result of the offer. As such, the application 1068 can use some discretion on whether an answer should be applied as 1069 provisional or final, and can change the type of the session 1070 description as needed. For example, in a serial forking scenario, an 1071 application may receive multiple "final" answers, one from each 1072 remote endpoint. The application could choose to accept the initial 1073 answers as provisional answers, and only apply an answer as final 1074 when it receives one that meets its criteria (e.g. a live user 1075 instead of voicemail). 1077 "rollback" is a special session description type implying that the 1078 state machine should be rolled back to the previous state, as 1079 described in Section 4.1.7.2. The contents MUST be empty. 1081 4.1.7.1. Use of Provisional Answers 1083 Most web applications will not need to create answers using the 1084 "pranswer" type. While it is good practice to send an immediate 1085 response to an "offer", in order to warm up the session transport and 1086 prevent media clipping, the preferred handling for a web application 1087 would be to create and send an "inactive" final answer immediately 1088 after receiving the offer. Later, when the called user actually 1089 accepts the call, the application can create a new "sendrecv" offer 1090 to update the previous offer/answer pair and start the media flow. 1091 While this could also be done with an inactive "pranswer", followed 1092 by a sendrecv "answer", the initial "pranswer" leaves the offer- 1093 answer exchange open, which means that neither side can send an 1094 updated offer during this time. 1096 As an example, consider a typical web application that will set up a 1097 data channel, an audio channel, and a video channel. When an 1098 endpoint receives an offer with these channels, it could send an 1099 answer accepting the data channel for two-way data, and accepting the 1100 audio and video tracks as inactive or receive-only. It could then 1101 ask the user to accept the call, acquire the local media streams, and 1102 send a new offer to the remote side moving the audio and video to be 1103 two-way media. By the time the human has accepted the call and 1104 triggered the new offer, it is likely that the ICE and DTLS 1105 handshaking for all the channels will already have finished. 1107 Of course, some applications may not be able to perform this double 1108 offer-answer exchange, particularly ones that are attempting to 1109 gateway to legacy signaling protocols. In these cases, "pranswer" 1110 can still provide the application with a mechanism to warm up the 1111 transport. 1113 4.1.7.2. Rollback 1115 In certain situations it may be desirable to "undo" a change made to 1116 setLocalDescription or setRemoteDescription. Consider a case where a 1117 call is ongoing, and one side wants to change some of the session 1118 parameters; that side generates an updated offer and then calls 1119 setLocalDescription. However, the remote side, either before or 1120 after setRemoteDescription, decides it does not want to accept the 1121 new parameters, and sends a reject message back to the offerer. Now, 1122 the offerer, and possibly the answerer as well, need to return to a 1123 stable state and the previous local/remote description. To support 1124 this, we introduce the concept of "rollback". 1126 A rollback discards any proposed changes to the session, returning 1127 the state machine to the stable state, and setting the pending local 1128 and/or remote description back to null. Any resources or candidates 1129 that were allocated by the abandoned local description are discarded; 1130 any media that is received will be processed according to the 1131 previous local and remote descriptions. Rollback can only be used to 1132 cancel proposed changes; there is no support for rolling back from a 1133 stable state to a previous stable state. Note that this implies that 1134 once the answerer has performed setLocalDescription with his answer, 1135 this cannot be rolled back. 1137 A rollback will disassociate any RtpTransceivers that were associated 1138 with m= sections by the application of the rolled-back session 1139 description (see Section 5.8 and Section 5.7). This means that some 1140 RtpTransceivers that were previously associated will no longer be 1141 associated with any m= section; in such cases, the value of the 1142 RtpTransceiver's mid attribute MUST be set to null. RtpTransceivers 1143 that were created by applying a remote offer that was subsequently 1144 rolled back MUST be removed. However, a RtpTransceiver MUST NOT be 1145 removed if the RtpTransceiver's RtpSender was activated by the 1146 addTrack method. This is so that an application may call addTrack, 1147 then call setRemoteDescription with an offer, then roll back that 1148 offer, then call createOffer and have a m= section for the added 1149 track appear in the generated offer. 1151 A rollback is performed by supplying a session description of type 1152 "rollback" with empty contents to either setLocalDescription or 1153 setRemoteDescription, depending on which was most recently used (i.e. 1154 if the new offer was supplied to setLocalDescription, the rollback 1155 should be done using setLocalDescription as well). 1157 4.1.8. setLocalDescription 1159 The setLocalDescription method instructs the PeerConnection to apply 1160 the supplied session description as its local configuration. The 1161 type field indicates whether the description should be processed as 1162 an offer, provisional answer, or final answer; offers and answers are 1163 checked differently, using the various rules that exist for each SDP 1164 line. 1166 This API changes the local media state; among other things, it sets 1167 up local resources for receiving and decoding media. In order to 1168 successfully handle scenarios where the application wants to offer to 1169 change from one media format to a different, incompatible format, the 1170 PeerConnection must be able to simultaneously support use of both the 1171 current and pending local descriptions (e.g. support codecs that 1172 exist in both descriptions) until a final answer is received, at 1173 which point the PeerConnection can fully adopt the pending local 1174 description, or roll back to the current description if the remote 1175 side denied the change. 1177 This API indirectly controls the candidate gathering process. When a 1178 local description is supplied, and the number of transports currently 1179 in use does not match the number of transports needed by the local 1180 description, the PeerConnection will create transports as needed and 1181 begin gathering candidates for them. 1183 If setRemoteDescription was previously called with an offer, and 1184 setLocalDescription is called with an answer (provisional or final), 1185 and the media directions are compatible, and media are available to 1186 send, this will result in the starting of media transmission. 1188 4.1.9. setRemoteDescription 1190 The setRemoteDescription method instructs the PeerConnection to apply 1191 the supplied session description as the desired remote configuration. 1192 As in setLocalDescription, the type field of the description 1193 indicates how it should be processed. 1195 This API changes the local media state; among other things, it sets 1196 up local resources for sending and encoding media. 1198 If setLocalDescription was previously called with an offer, and 1199 setRemoteDescription is called with an answer (provisional or final), 1200 and the media directions are compatible, and media are available to 1201 send, this will result in the starting of media transmission. 1203 4.1.10. currentLocalDescription 1205 The currentLocalDescription method returns a copy of the current 1206 negotiated local description - i.e., the local description from the 1207 last successful offer/answer exchange - in addition to any local 1208 candidates that have been generated by the ICE Agent since the local 1209 description was set. 1211 A null object will be returned if an offer/answer exchange has not 1212 yet been completed. 1214 4.1.11. pendingLocalDescription 1216 The pendingLocalDescription method returns a copy of the local 1217 description currently in negotiation - i.e., a local offer set 1218 without any corresponding remote answer - in addition to any local 1219 candidates that have been generated by the ICE Agent since the local 1220 description was set. 1222 A null object will be returned if the state of the PeerConnection is 1223 "stable" or "have-remote-offer". 1225 4.1.12. currentRemoteDescription 1227 The currentRemoteDescription method returns a copy of the current 1228 negotiated remote description - i.e., the remote description from the 1229 last successful offer/answer exchange - in addition to any remote 1230 candidates that have been supplied via processIceMessage since the 1231 remote description was set. 1233 A null object will be returned if an offer/answer exchange has not 1234 yet been completed. 1236 4.1.13. pendingRemoteDescription 1238 The pendingRemoteDescription method returns a copy of the remote 1239 description currently in negotiation - i.e., a remote offer set 1240 without any corresponding local answer - in addition to any remote 1241 candidates that have been supplied via processIceMessage since the 1242 remote description was set. 1244 A null object will be returned if the state of the PeerConnection is 1245 "stable" or "have-local-offer". 1247 4.1.14. canTrickleIceCandidates 1249 The canTrickleIceCandidates property indicates whether the remote 1250 side supports receiving trickled candidates. There are three 1251 potential values: 1253 null: No SDP has been received from the other side, so it is not 1254 known if it can handle trickle. This is the initial value before 1255 setRemoteDescription() is called. 1257 true: SDP has been received from the other side indicating that it 1258 can support trickle. 1260 false: SDP has been received from the other side indicating that it 1261 cannot support trickle. 1263 As described in Section 3.5.2, JSEP implementations always provide 1264 candidates to the application individually, consistent with what is 1265 needed for Trickle ICE. However, applications can use the 1266 canTrickleIceCandidates property to determine whether their peer can 1267 actually do Trickle ICE, i.e., whether it is safe to send an initial 1268 offer or answer followed later by candidates as they are gathered. 1269 As "true" is the only value that definitively indicates remote 1270 Trickle ICE support, an application which compares 1271 canTrickleIceCandidates against "true" will by default attempt Half 1272 Trickle on initial offers and Full Trickle on subsequent interactions 1273 with a Trickle ICE-compatible agent. 1275 4.1.15. setConfiguration 1277 The setConfiguration method allows the global configuration of the 1278 PeerConnection, which was initially set by constructor parameters, to 1279 be changed during the session. The effects of this method call 1280 depend on when it is invoked, and differ depending on which specific 1281 parameters are changed: 1283 o Any changes to the STUN/TURN servers to use affect the next 1284 gathering phase. If an ICE gathering phase has already started or 1285 completed, the 'needs-ice-restart' bit mentioned in Section 3.5.1 1286 will be set. This will cause the next call to createOffer to 1287 generate new ICE credentials, for the purpose of forcing an ICE 1288 restart and kicking off a new gathering phase, in which the new 1289 servers will be used. If the ICE candidate pool has a nonzero 1290 size, any existing candidates will be discarded, and new 1291 candidates will be gathered from the new servers. 1293 o Any change to the ICE candidate policy affects the next gathering 1294 phase. If an ICE gathering phase has already started or 1295 completed, the 'needs-ice-restart' bit will be set. Either way, 1296 changes to the policy have no effect on the candidate pool, 1297 because pooled candidates are not surfaced to the application 1298 until a gathering phase occurs, and so any necessary filtering can 1299 still be done on any pooled candidates. 1301 o Any changes to the ICE candidate pool size take effect 1302 immediately; if increased, additional candidates are pre-gathered; 1303 if decreased, the now-superfluous candidates are discarded. 1305 o The bundle and RTCP-multiplexing policies MUST NOT be changed 1306 after the construction of the PeerConnection. 1308 This call may result in a change to the state of the ICE Agent, and 1309 may result in a change to media state if it results in connectivity 1310 being established. 1312 4.1.16. addIceCandidate 1314 The addIceCandidate method provides a remote candidate to the ICE 1315 Agent, which, if parsed successfully, will be added to the current 1316 and/or pending remote description according to the rules defined for 1317 Trickle ICE. If the MID, m-line index, or candidate string provided 1318 in the ICE candidate is invalid, an error is generated. Connectivity 1319 checks will be sent to the new candidate. 1321 This method can also be used to provide an end-of-candidates 1322 indication (as defined in [I-D.ietf-ice-trickle]) to the ICE Agent 1323 for all media descriptions in the last remote description. 1325 This call will result in a change to the state of the ICE Agent, and 1326 may result in a change to media state if it results in connectivity 1327 being established. 1329 5. SDP Interaction Procedures 1331 This section describes the specific procedures to be followed when 1332 creating and parsing SDP objects. 1334 5.1. Requirements Overview 1336 JSEP implementations must comply with the specifications listed below 1337 that govern the creation and processing of offers and answers. 1339 The first set of specifications is the "mandatory-to-implement" set. 1340 All implementations must support these behaviors, but may not use all 1341 of them if the remote side, which may not be a JSEP endpoint, does 1342 not support them. 1344 The second set of specifications is the "mandatory-to-use" set. The 1345 local JSEP endpoint and any remote endpoint must indicate support for 1346 these specifications in their session descriptions. 1348 5.1.1. Implementation Requirements 1350 This list of mandatory-to-implement specifications is derived from 1351 the requirements outlined in [I-D.ietf-rtcweb-rtp-usage]. 1353 R-1 [RFC4566] is the base SDP specification and MUST be 1354 implemented. 1356 R-2 [RFC5764] MUST be supported for signaling the UDP/TLS/RTP/SAVPF 1357 [RFC5764], TCP/DTLS/RTP/SAVPF 1358 [I-D.nandakumar-mmusic-proto-iana-registration], "UDP/DTLS/ 1359 SCTP" [I-D.ietf-mmusic-sctp-sdp], and "TCP/DTLS/SCTP" 1360 [I-D.ietf-mmusic-sctp-sdp] RTP profiles. 1362 R-3 [RFC5245] MUST be implemented for signaling the ICE credentials 1363 and candidate lines corresponding to each media stream. The 1364 ICE implementation MUST be a Full implementation, not a Lite 1365 implementation. 1367 R-4 [RFC5763] MUST be implemented to signal DTLS certificate 1368 fingerprints. 1370 R-5 [RFC4568] MUST NOT be implemented to signal SDES SRTP keying 1371 information. 1373 R-6 The [RFC5888] grouping framework MUST be implemented for 1374 signaling grouping information, and MUST be used to identify m= 1375 lines via the a=mid attribute. 1377 R-7 [I-D.ietf-mmusic-msid] MUST be supported, in order to signal 1378 associations between RTP objects and W3C MediaStreams and 1379 MediaStreamTracks in a standard way. 1381 R-8 The bundle mechanism in 1382 [I-D.ietf-mmusic-sdp-bundle-negotiation] MUST be supported to 1383 signal the ability to multiplex RTP streams on a single UDP 1384 port, in order to avoid excessive use of port number resources. 1386 R-9 The SDP attributes of "sendonly", "recvonly", "inactive", and 1387 "sendrecv" from [RFC4566] MUST be implemented to signal 1388 information about media direction. 1390 R-10 [RFC5576] MUST be implemented to signal RTP SSRC values and 1391 grouping semantics. 1393 R-11 [RFC4585] MUST be implemented to signal RTCP based feedback. 1395 R-12 [RFC5761] MUST be implemented to signal multiplexing of RTP and 1396 RTCP. 1398 R-13 [RFC5506] MUST be implemented to signal reduced-size RTCP 1399 messages. 1401 R-14 [RFC4588] MUST be implemented to signal RTX payload type 1402 associations. 1404 R-15 [RFC3556] with bandwidth modifiers MAY be supported for 1405 specifying RTCP bandwidth as a fraction of the media bandwidth, 1406 RTCP fraction allocated to the senders and setting maximum 1407 media bit-rate boundaries. 1409 R-16 TODO: any others? 1411 As required by [RFC4566], Section 5.13, JSEP implementations MUST 1412 ignore unknown attribute (a=) lines. 1414 5.1.2. Usage Requirements 1416 All session descriptions handled by JSEP endpoints, both local and 1417 remote, MUST indicate support for the following specifications. If 1418 any of these are absent, this omission MUST be treated as an error. 1420 R-1 ICE, as specified in [RFC5245], MUST be used. Note that the 1421 remote endpoint may use a Lite implementation; implementations 1422 MUST properly handle remote endpoints which do ICE-Lite. 1424 R-2 DTLS [RFC6347] or DTLS-SRTP [RFC5763], MUST be used, as 1425 appropriate for the media type, as specified in 1426 [I-D.ietf-rtcweb-security-arch] 1428 5.1.3. Profile Names and Interoperability 1430 For media m= sections, JSEP endpoints MUST support both the "UDP/TLS/ 1431 RTP/SAVPF" and "TCP/DTLS/RTP/SAVPF" profiles and MUST indicate one of 1432 these two profiles for each media m= line they produce in an offer. 1433 For data m= sections, JSEP endpoints must support both the "UDP/DTLS/ 1434 SCTP" and "TCP/DTLS/SCTP" profiles and MUST indicate one of these two 1435 profiles for each data m= line they produce in an offer. Because ICE 1436 can select either TCP or UDP transport depending on network 1437 conditions, both advertisements are consistent with ICE eventually 1438 selecting either either UDP or TCP. 1440 Unfortunately, in an attempt at compatibility, some endpoints 1441 generate other profile strings even when they mean to support one of 1442 these profiles. For instance, an endpoint might generate "RTP/AVP" 1443 but supply "a=fingerprint" and "a=rtcp-fb" attributes, indicating its 1444 willingness to support "(UDP,TCP)/TLS/RTP/SAVPF". In order to 1445 simplify compatibility with such endpoints, JSEP endpoints MUST 1446 follow the following rules when processing the media m= sections in 1447 an offer: 1449 o The profile in any "m=" line in any answer MUST exactly match the 1450 profile provided in the offer. 1452 o Any profile matching the following patterns MUST be accepted: 1453 "RTP/[S]AVP[F]" and "(UDP/TCP)/TLS/RTP/SAVP[F]" 1455 o Because DTLS-SRTP is REQUIRED, the choice of SAVP or AVP has no 1456 effect; support for DTLS-SRTP is determined by the presence of one 1457 or more "a=fingerprint" attribute. Note that lack of an 1458 "a=fingerprint" attribute will lead to negotiation failure. 1460 o The use of AVPF or AVP simply controls the timing rules used for 1461 RTCP feedback. If AVPF is provided, or an "a=rtcp-fb" attribute 1462 is present, assume AVPF timing, i.e. a default value of "trr- 1463 int=0". Otherwise, assume that AVPF is being used in an AVP 1464 compatible mode and use AVP timing, i.e., "trr-int=4". 1466 o For data m= sections, JSEP endpoints MUST support receiving the 1467 "UDP/ DTLS/SCTP", "TCP/DTLS/SCTP", or "DTLS/SCTP" (for backwards 1468 compatibility) profiles. 1470 Note that re-offers by JSEP endpoints MUST use the correct profile 1471 strings even if the initial offer/answer exchange used an (incorrect) 1472 older profile string. 1474 5.2. Constructing an Offer 1476 When createOffer is called, a new SDP description must be created 1477 that includes the functionality specified in 1478 [I-D.ietf-rtcweb-rtp-usage]. The exact details of this process are 1479 explained below. 1481 5.2.1. Initial Offers 1483 When createOffer is called for the first time, the result is known as 1484 the initial offer. 1486 The first step in generating an initial offer is to generate session- 1487 level attributes, as specified in [RFC4566], Section 5. 1488 Specifically: 1490 o The first SDP line MUST be "v=0", as specified in [RFC4566], 1491 Section 5.1 1493 o The second SDP line MUST be an "o=" line, as specified in 1494 [RFC4566], Section 5.2. The value of the field SHOULD 1495 be "-". The value of the field SHOULD be a 1496 cryptographically random number. To ensure uniqueness, this 1497 number SHOULD be at least 64 bits long. The value of the field SHOULD be zero. The value of the 1499 tuple SHOULD be set to a non- 1500 meaningful address, such as IN IP4 0.0.0.0, to prevent leaking the 1501 local address in this field. As mentioned in [RFC4566], the 1502 entire o= line needs to be unique, but selecting a random number 1503 for is sufficient to accomplish this. 1505 o The third SDP line MUST be a "s=" line, as specified in [RFC4566], 1506 Section 5.3; to match the "o=" line, a single dash SHOULD be used 1507 as the session name, e.g. "s=-". Note that this differs from the 1508 advice in [RFC4566] which proposes a single space, but as both 1509 "o=" and "s=" are meaningless, having the same meaningless value 1510 seems clearer. 1512 o Session Information ("i="), URI ("u="), Email Address ("e="), 1513 Phone Number ("p="), Bandwidth ("b="), Repeat Times ("r="), and 1514 Time Zones ("z=") lines are not useful in this context and SHOULD 1515 NOT be included. 1517 o Encryption Keys ("k=") lines do not provide sufficient security 1518 and MUST NOT be included. 1520 o A "t=" line MUST be added, as specified in [RFC4566], Section 5.9; 1521 both and SHOULD be set to zero, e.g. "t=0 1522 0". 1524 o An "a=ice-options" line with the "trickle" option MUST be added, 1525 as specified in [I-D.ietf-ice-trickle], Section 4. 1527 The next step is to generate m= sections, as specified in [RFC4566] 1528 Section 5.14. An m= section is generated for each RtpTransceiver 1529 that has been added to the PeerConnection via the addTrack, 1530 addTransceiver, and setRemoteDescription methods. [[OPEN ISSUE: move 1531 discussion of setRemoteDescription to the subsequent-offer section.]] 1532 This is done in the order that their associated RtpTransceivers were 1533 added to the PeerConnection and excludes RtpTranscievers that are 1534 stopped and not associated with an m= section (either due to an m= 1535 section being recycled or an RtpTransceiver having been stopped 1536 before being associated with an m= section) . 1538 Each m= section, provided it is not marked as bundle-only, MUST 1539 generate a unique set of ICE credentials and gather its own unique 1540 set of ICE candidates. Bundle-only m= sections MUST NOT contain any 1541 ICE credentials and MUST NOT gather any candidates. 1543 For DTLS, all m= sections MUST use the certificate for the identity 1544 that has been specified for the PeerConnection; as a result, they 1545 MUST all have the same [RFC4572] fingerprint value, or this value 1546 MUST be a session-level attribute. 1548 Each m= section should be generated as specified in [RFC4566], 1549 Section 5.14. For the m= line itself, the following rules MUST be 1550 followed: 1552 o The port value is set to the port of the default ICE candidate for 1553 this m= section, but given that no candidates have yet been 1554 gathered, the "dummy" port value of 9 (Discard) MUST be used, as 1555 indicated in [I-D.ietf-ice-trickle], Section 5.1. 1557 o To properly indicate use of DTLS, the field MUST be set to 1558 "UDP/TLS/RTP/SAVPF", as specified in [RFC5764], Section 8, if the 1559 default candidate uses UDP transport, or "TCP/DTLS/RTP/SAVPF", as 1560 specified in [I-D.nandakumar-mmusic-proto-iana-registration] if 1561 the default candidate uses TCP transport. 1563 The m= line MUST be followed immediately by a "c=" line, as specified 1564 in [RFC4566], Section 5.7. Again, as no candidates have yet been 1565 gathered, the "c=" line must contain the "dummy" value "IN IP4 1566 0.0.0.0", as defined in [I-D.ietf-ice-trickle], Section 5.1. 1568 Each m= section MUST include the following attribute lines: 1570 o An "a=mid" line, as specified in [RFC5888], Section 4. When 1571 generating mid values, it is RECOMMENDED that the values be 3 1572 bytes or less, to allow them to efficiently fit into the RTP 1573 header extension defined in 1574 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 11. 1576 o An "a=rtcp" line, as specified in [RFC3605], Section 2.1, 1577 containing the dummy value "9 IN IP4 0.0.0.0", because no 1578 candidates have yet been gathered. 1580 o A direction attribute for the associated RtpTransceiver as 1581 described by Section 5.2.4. 1583 o For each supported codec, "a=rtpmap" and "a=fmtp" lines, as 1584 specified in [RFC4566], Section 6. The audio and video codecs 1585 that MUST be supported are specified in 1586 [I-D.ietf-rtcweb-audio](see Section 3) and 1587 [I-D.ietf-rtcweb-video](see Section 5). 1589 o If this m= section is for media with configurable frame sizes, 1590 e.g. audio, an "a=maxptime" line, indicating the smallest of the 1591 maximum supported frame sizes out of all codecs included above, as 1592 specified in [RFC4566], Section 6. 1594 o If this m= section is for video media, and there are known 1595 limitations on the size of images which can be decoded, an 1596 "a=imageattr" line, as specified in Section 3.6. 1598 o For each primary codec where RTP retransmission should be used, a 1599 corresponding "a=rtpmap" line indicating "rtx" with the clock rate 1600 of the primary codec and an "a=fmtp" line that references the 1601 payload type of the primary codec, as specified in [RFC4588], 1602 Section 8.1. 1604 o For each supported FEC mechanism, "a=rtpmap" and "a=fmtp" lines, 1605 as specified in [RFC4566], Section 6. The FEC mechanisms that 1606 MUST be supported are specified in [I-D.ietf-rtcweb-fec], 1607 Section 6, and specific usage for each media type is outlined in 1608 Sections 4 and 5. 1610 o "a=ice-ufrag" and "a=ice-pwd" lines, as specified in [RFC5245], 1611 Section 15.4. 1613 o An "a=fingerprint" line for each of the endpoint's certificates, 1614 as specified in [RFC4572], Section 5; the digest algorithm used 1615 for the fingerprint MUST match that used in the certificate 1616 signature. 1618 o An "a=setup" line, as specified in [RFC4145], Section 4, and 1619 clarified for use in DTLS-SRTP scenarios in [RFC5763], Section 5. 1620 The role value in the offer MUST be "actpass". 1622 o An "a=rtcp-mux" line, as specified in [RFC5761], Section 5.1.1. 1624 o An "a=rtcp-rsize" line, as specified in [RFC5506], Section 5. 1626 o For each supported RTP header extension, an "a=extmap" line, as 1627 specified in [RFC5285], Section 5. The list of header extensions 1628 that SHOULD/MUST be supported is specified in 1629 [I-D.ietf-rtcweb-rtp-usage], Section 5.2. Any header extensions 1630 that require encryption MUST be specified as indicated in 1631 [RFC6904], Section 4. 1633 o For each supported RTCP feedback mechanism, an "a=rtcp-fb" 1634 mechanism, as specified in [RFC4585], Section 4.2. The list of 1635 RTCP feedback mechanisms that SHOULD/MUST be supported is 1636 specified in [I-D.ietf-rtcweb-rtp-usage], Section 5.1. 1638 o An "a=ssrc" line, as specified in [RFC5576], Section 4.1, 1639 indicating the SSRC to be used for sending media, along with the 1640 mandatory "cname" source attribute, as specified in Section 6.1, 1641 indicating the CNAME for the source. The CNAME MUST be generated 1642 in accordance with Section 4.9 of [I-D.ietf-rtcweb-rtp-usage]. 1644 o If RTX is supported for this media type, another "a=ssrc" line 1645 with the RTX SSRC, and an "a=ssrc-group" line, as specified in 1646 [RFC5576], section 4.2, with semantics set to "FID" and including 1647 the primary and RTX SSRCs. 1649 o If FEC is supported for this media type, another "a=ssrc" line 1650 with the FEC SSRC, and an "a=ssrc-group" line with semantics set 1651 to "FEC-FR" and including the primary and FEC SSRCs, as specified 1652 in [RFC5956], section 4.3. For simplicity, if both RTX and FEC 1653 are supported, the FEC SSRC MUST be the same as the RTX SSRC. 1655 o If the bundle policy for this PeerConnection is set to "max- 1656 bundle", and this is not the first m= section, or the bundle 1657 policy is set to "balanced", and this is not the first m= section 1658 for this media type, an "a=bundle-only" line. 1660 o If the RtpSender of the RtpTransceiver associated with this 1661 m=section is active: 1663 * An "a=msid" line, as specified in [I-D.ietf-mmusic-msid], 1664 Section 2. 1666 * An "a=ssrc" line, as specified in [RFC5576], Section 4.1, 1667 indicating the SSRC to be used for sending media, along with 1668 the mandatory "cname" source attribute, as specified in 1669 Section 6.1, indicating the CNAME for the source. The CNAME 1670 MUST be generated in accordance with Section 4.9 of 1671 [I-D.ietf-rtcweb-rtp-usage]. 1673 * If RTX is supported for this media type, another "a=ssrc" line 1674 with the RTX SSRC, and an "a=ssrc-group" line, as specified in 1675 [RFC5576], section 4.2, with semantics set to "FID" and 1676 including the primary and RTX SSRCs. 1678 * If FEC is supported for this media type, another "a=ssrc" line 1679 with the FEC SSRC, and an "a=ssrc-group" line with semantics 1680 set to "FEC-FR" and including the primary and FEC SSRCs, as 1681 specified in [RFC5956], section 4.3. For simplicity, if both 1682 RTX and FEC are supported, the FEC SSRC MUST be the same as the 1683 RTX SSRC. 1685 o If the RtpTransceiver's RtpSender is active, and the application 1686 has specified RID values or has specified more than one encoding 1687 in the RtpSenders's parameters, an "a=rid" line for each encoding 1688 specified. The "a=rid" line is specified in 1690 [I-D.ietf-mmusic-rid], and its direction MUST be "send". If the 1691 application has chosen a RID value, it MUST be used as the rid- 1692 identifier; otherwise a RID value MUST be generated by the 1693 implementation. When generating RID values, it is RECOMMENDED 1694 that the values be 3 bytes or less, to allow them to efficiently 1695 fit into the RTP header extension defined in 1696 [I-D.ietf-avtext-rid], Section 11. If no encodings have been 1697 specified, or only one encoding is specified but without a RID 1698 value, then no "a=rid" lines are generated. 1700 o If the RtpTransceiver's RtpSender is active and more than one 1701 "a=rid" line has been generated, an "a=simulcast" line, with 1702 direction "send", as defined in [I-D.ietf-mmusic-sdp-simulcast], 1703 Section 6.2. The list of RIDs MUST include all of the RID 1704 identifiers used in the "a=rid" lines for this m= section. 1706 Lastly, if a data channel has been created, a m= section MUST be 1707 generated for data. The field MUST be set to "application" 1708 and the field MUST be set to "UDP/DTLS/SCTP" if the default 1709 candidate uses UDP transport, or "TCP/DTLS/SCTP" if the default 1710 candidate uses TCP transport [I-D.ietf-mmusic-sctp-sdp]. The "fmt" 1711 value MUST be set to "webrtc-datachannel" as specified in 1712 [I-D.ietf-mmusic-sctp-sdp], Section 4.1. 1714 Within the data m= section, the "a=mid", "a=ice-ufrag", "a=ice-pwd", 1715 "a=fingerprint", and "a=setup" lines MUST be included as mentioned 1716 above, along with an "a=fmtp:webrtc-datachannel" line and an "a=sctp- 1717 port" line referencing the SCTP port number as defined in 1718 [I-D.ietf-mmusic-sctp-sdp], Section 4.1. 1720 Once all m= sections have been generated, a session-level "a=group" 1721 attribute MUST be added as specified in [RFC5888]. This attribute 1722 MUST have semantics "bundle", and MUST include the mid identifiers of 1723 each m= section. The effect of this is that the browser offers all 1724 m= sections as one bundle group. However, whether the m= sections 1725 are bundle-only or not depends on the bundle policy. 1727 The next step is to generate session-level lip sync groups as defined 1728 in [RFC5888], Section 7. For each MediaStream referenced by more 1729 than one RtpTransceiver (by passing those MediaStreams as arguments 1730 to the addTrack and addTransceiver methods), a group of type "LS" 1731 MUST be added that contains the mid values for each RtpTransceiver. 1733 Attributes which SDP permits to either be at the session level or the 1734 media level SHOULD generally be at the media level even if they are 1735 identical. This promotes readability, especially if one of a set of 1736 initially identical attributes is subsequently changed. 1738 Attributes other than the ones specified above MAY be included, 1739 except for the following attributes which are specifically 1740 incompatible with the requirements of [I-D.ietf-rtcweb-rtp-usage], 1741 and MUST NOT be included: 1743 o "a=crypto" 1745 o "a=key-mgmt" 1747 o "a=ice-lite" 1749 Note that when bundle is used, any additional attributes that are 1750 added MUST follow the advice in [I-D.ietf-mmusic-sdp-mux-attributes] 1751 on how those attributes interact with bundle. 1753 Note that these requirements are in some cases stricter than those of 1754 SDP. Implementations MUST be prepared to accept compliant SDP even 1755 if it would not conform to the requirements for generating SDP in 1756 this specification. 1758 5.2.2. Subsequent Offers 1760 When createOffer is called a second (or later) time, or is called 1761 after a local description has already been installed, the processing 1762 is somewhat different than for an initial offer. 1764 If the initial offer was not applied using setLocalDescription, 1765 meaning the PeerConnection is still in the "stable" state, the steps 1766 for generating an initial offer should be followed, subject to the 1767 following restriction: 1769 o The fields of the "o=" line MUST stay the same except for the 1770 field, which MUST increment if the session 1771 description changes in any way, including the addition of ICE 1772 candidates. 1774 If the initial offer was applied using setLocalDescription, but an 1775 answer from the remote side has not yet been applied, meaning the 1776 PeerConnection is still in the "local-offer" state, an offer is 1777 generated by following the steps in the "stable" state above, along 1778 with these exceptions: 1780 o The "s=" and "t=" lines MUST stay the same. 1782 o If any RtpTransceiver has been added, and there exists an m= 1783 section with a zero port in the current local description or the 1784 current remote description, that m= section MUST be recycled by 1785 generating an m= section for the added RtpTransceiver as if the m= 1786 section were being added to the session description, placed at the 1787 same index as the m= section with a zero port. 1789 o If an RtpTransceiver is stopped and is not associated with an m= 1790 section, an m= section MUST NOT be generated for it. This 1791 prevents adding back RtpTransceivers whose m= sections were 1792 recycled and used for a new RtpTransceiver in a previous offer/ 1793 answer exchange, as described above. 1795 o If an RtpTransceiver has been stopped and is associated with an m= 1796 section, and the m= section is not being recycled as described 1797 above, an m= section MUST be generated for it with the port set to 1798 zero and the "a=msid", "a=ssrc", and "a=ssrc-group" lines removed. 1800 o For RtpTransceivers that are not stopped, the "a=msid", "a=ssrc", 1801 and "a=ssrc-group" lines MUST stay the same if they are present in 1802 the current description. 1804 o Each "m=" and c=" line MUST be filled in with the port, protocol, 1805 and address of the default candidate for the m= section, as 1806 described in [RFC5245], Section 4.3. If ICE checking has already 1807 completed for one or more candidate pairs and a candidate pair is 1808 in active use, then that pair MUST be used, even if ICE has not 1809 yet completed. Note that this differs from the guidance in 1810 [RFC5245], Section 9.1.2.2, which only refers to offers created 1811 when ICE has completed. Each "a=rtcp" attribute line MUST also be 1812 filled in with the port and address of the appropriate default 1813 candidate, either the default RTP or RTCP candidate, depending on 1814 whether RTCP multiplexing is currently active or not. Note that 1815 if RTCP multiplexing is being offered, but not yet active, the 1816 default RTCP candidate MUST be used, as indicated in [RFC5761], 1817 section 5.1.3. In each case, if no candidates of the desired type 1818 have yet been gathered, dummy values MUST be used, as described 1819 above. 1821 o Each "a=mid" line MUST stay the same. 1823 o Each "a=ice-ufrag" and "a=ice-pwd" line MUST stay the same, unless 1824 the ICE configuration has changed (either changes to the supported 1825 STUN/TURN servers, or the ICE candidate policy), or the 1826 "IceRestart" option ( Section 5.2.3.1 was specified. If the m= 1827 section is bundled into another m= section, it still MUST NOT 1828 contain any ICE credentials. 1830 o If the m= section is not bundled into another m= section, for each 1831 candidate that has been gathered during the most recent gathering 1832 phase (see Section 3.5.1), an "a=candidate" line MUST be added, as 1833 defined in [RFC5245], Section 4.3., paragraph 3. If candidate 1834 gathering for the section has completed, an "a=end-of-candidates" 1835 attribute MUST be added, as described in [I-D.ietf-ice-trickle], 1836 Section 9.3. If the m= section is bundled into another m= 1837 section, both "a=candidate" and "a=end-of-candidates" MUST be 1838 omitted. 1840 o For RtpTransceivers that are still present, the "a=msid", 1841 "a=ssrc", and "a=ssrc-group" lines MUST stay the same. 1843 o For RtpTransceivers that are still present, the "a=rid" lines MUST 1844 stay the same. 1846 o For RtpTransceivers that are still present, any "a=simulcast" line 1847 MUST stay the same. 1849 o If any RtpTransceiver has been stopped, the port MUST be set to 1850 zero and the "a=msid", "a=ssrc", and "a=ssrc-group" lines MUST be 1851 removed. 1853 o If any RtpTransceiver has been added, and there exists a m= 1854 section with a zero port in the current local description or the 1855 current remote description, that m= section MUST be recycled by 1856 generating a m= section for the added RtpTransceiver as if the m= 1857 section were being added to session description, except that 1858 instead of adding it, the generated m= section replaces the m= 1859 section with a zero port. 1861 If the initial offer was applied using setLocalDescription, and an 1862 answer from the remote side has been applied using 1863 setRemoteDescription, meaning the PeerConnection is in the "remote- 1864 pranswer" or "stable" states, an offer is generated based on the 1865 negotiated session descriptions by following the steps mentioned for 1866 the "local-offer" state above. 1868 In addition, for each non-recycled, non-rejected m= section in the 1869 new offer, the following adjustments are made based on the contents 1870 of the corresponding m= section in the current remote description: 1872 o The m= line and corresponding "a=rtpmap" and "a=fmtp" lines MUST 1873 only include codecs present in the most recent answer. 1875 o The RTP header extensions MUST only include those that are present 1876 in the most recent answer. 1878 o The RTCP feedback extensions MUST only include those that are 1879 present in the most recent answer. 1881 o The "a=rtcp-mux" line MUST only be added if present in the most 1882 recent answer. 1884 o The "a=rtcp-rsize" line MUST only be added if present in the most 1885 recent answer. 1887 The "a=group:BUNDLE" attribute MUST include the mid identifiers 1888 specified in the bundle group in the most recent answer, minus any m= 1889 sections that have been marked as rejected, plus any newly added or 1890 re-enabled m= sections. In other words, the bundle attribute must 1891 contain all m= sections that were previously bundled, as long as they 1892 are still alive, as well as any new m= sections. 1894 The "LS" groups are generated in the same way as with initial offers. 1896 5.2.3. Options Handling 1898 The createOffer method takes as a parameter an RTCOfferOptions 1899 object. Special processing is performed when generating a SDP 1900 description if the following options are present. 1902 5.2.3.1. IceRestart 1904 If the "IceRestart" option is specified, with a value of "true", the 1905 offer MUST indicate an ICE restart by generating new ICE ufrag and 1906 pwd attributes, as specified in [RFC5245], Section 9.1.1.1. If this 1907 option is specified on an initial offer, it has no effect (since a 1908 new ICE ufrag and pwd are already generated). Similarly, if the ICE 1909 configuration has changed, this option has no effect, since new ufrag 1910 and pwd attributes will be generated automatically. This option is 1911 primarily useful for reestablishing connectivity in cases where 1912 failures are detected by the application. 1914 5.2.3.2. VoiceActivityDetection 1916 If the "VoiceActivityDetection" option is specified, with a value of 1917 "true", the offer MUST indicate support for silence suppression in 1918 the audio it receives by including comfort noise ("CN") codecs for 1919 each offered audio codec, as specified in [RFC3389], Section 5.1, 1920 except for codecs that have their own internal silence suppression 1921 support. For codecs that have their own internal silence suppression 1922 support, the appropriate fmtp parameters for that codec MUST be 1923 specified to indicate that silence suppression for received audio is 1924 desired. For example, when using the Opus codec, the "usedtx=1" 1925 parameter would be specified in the offer. This option allows the 1926 endpoint to significantly reduce the amount of audio bandwidth it 1927 receives, at the cost of some fidelity, depending on the quality of 1928 the remote VAD algorithm. 1930 If the "VoiceActivityDetection" option is specified, with a value of 1931 "false", the browser MUST NOT emit "CN" codecs. For codecs that have 1932 their own internal silence suppression support, the appropriate fmtp 1933 parameters for that codec MUST be specified to indicate that silence 1934 suppression for received audio is not desired. For example, when 1935 using the Opus codec, the "usedtx=0" parameter would be specified in 1936 the offer. 1938 Note that setting the "VoiceActivityDetection" parameter when 1939 generating an offer is a request to receive audio with silence 1940 suppression. It has no impact on whether the local endpoint does 1941 silence suppression for the audio it sends. 1943 The "VoiceActivityDetection" option does not have any impact on the 1944 setting of the "vad" value in the signaling of the client to mixer 1945 audio level header extension described in [RFC6464], Section 4. 1947 5.2.4. Direction Attribute in Offers 1949 [RFC3264] direction attributes (defined in Section 6.1) in offers are 1950 chosen according to the states of the RtpSender and RtpReceiver of a 1951 given RtpTransceiver, as follows: 1953 +-----------+-------------+-----------------+ 1954 | RtpSender | RtpReceiver | offer direction | 1955 +-----------+-------------+-----------------+ 1956 | active | active | sendrecv | 1957 | active | inactive | sendonly | 1958 | inactive | active | recvonly | 1959 | inactive | inactive | inactive | 1960 +-----------+-------------+-----------------+ 1962 5.3. Generating an Answer 1964 When createAnswer is called, a new SDP description must be created 1965 that is compatible with the supplied remote description as well as 1966 the requirements specified in [I-D.ietf-rtcweb-rtp-usage]. The exact 1967 details of this process are explained below. 1969 5.3.1. Initial Answers 1971 When createAnswer is called for the first time after a remote 1972 description has been provided, the result is known as the initial 1973 answer. If no remote description has been installed, an answer 1974 cannot be generated, and an error MUST be returned. 1976 Note that the remote description SDP may not have been created by a 1977 JSEP endpoint and may not conform to all the requirements listed in 1978 Section 5.2. For many cases, this is not a problem. However, if any 1979 mandatory SDP attributes are missing, or functionality listed as 1980 mandatory-to-use above is not present, this MUST be treated as an 1981 error, and MUST cause the affected m= sections to be marked as 1982 rejected. 1984 The first step in generating an initial answer is to generate 1985 session-level attributes. The process here is identical to that 1986 indicated in the Initial Offers section above, except that the 1987 "a=ice-options" line, with the "trickle" option as specified in 1988 [I-D.ietf-ice-trickle], Section 4, is only included if such an option 1989 was present in the offer. 1991 The next step is to generate session-level lip sync groups as defined 1992 in [RFC5888], Section 7. For each group of type "LS" present in the 1993 offer, determine which of the local RtpTransceivers identified by 1994 that group's mid values reference a common local MediaStream (as 1995 specified in the addTrack and addTransceiver methods). If at least 1996 two such RtpTransceivers exist, a group of type "LS" with the mid 1997 values of these RtpTransceivers MUST be added. Otherwise, this 1998 indicates a difference of opinion between the offerer and answerer 1999 regarding lip sync status, and as such, the offered group MUST be 2000 ignored and no corresponding "LS" group generated. 2002 The next step is to generate m= sections for each m= section that is 2003 present in the remote offer, as specified in [RFC3264], Section 6. 2004 For the purposes of this discussion, any session-level attributes in 2005 the offer that are also valid as media-level attributes SHALL be 2006 considered to be present in each m= section. 2008 The next step is to go through each offered m= section. Each offered 2009 m= section will have an associated RtpTransceiver, as described in 2010 Section 5.8. If there are more RtpTransceivers than there are m= 2011 sections, the unmatched RtpTransceivers will need to be associated in 2012 a subsequent offer. 2014 For each offered m= section, if any of the following conditions are 2015 true, the corresponding m= section in the answer MUST be marked as 2016 rejected by setting the port in the m= line to zero, as indicated in 2017 [RFC3264], Section 6., and further processing for this m= section can 2018 be skipped: 2020 o The associated RtpTransceiver has been stopped. 2022 o No supported codec is present in the offer. 2024 o The bundle policy is "max-bundle", the m= section is not in a 2025 bundle group, and this is not the first m= section. 2027 o The bundle policy is "balanced", the m= section is not in a bundle 2028 group, and this is not the first m= section for this media type. 2030 o The RTP/RTCP multiplexing policy is "require" and the m= section 2031 doesn't contain an "a=rtcp-mux" attribute. 2033 Otherwise, each m= section in the answer should then be generated as 2034 specified in [RFC3264], Section 6.1. For the m= line itself, the 2035 following rules must be followed: 2037 o The port value would normally be set to the port of the default 2038 ICE candidate for this m= section, but given that no candidates 2039 have yet been gathered, the "dummy" port value of 9 (Discard) MUST 2040 be used, as indicated in [I-D.ietf-ice-trickle], Section 5.1. 2042 o The field MUST be set to exactly match the field 2043 for the corresponding m= line in the offer. 2045 The m= line MUST be followed immediately by a "c=" line, as specified 2046 in [RFC4566], Section 5.7. Again, as no candidates have yet been 2047 gathered, the "c=" line must contain the "dummy" value "IN IP4 2048 0.0.0.0", as defined in [I-D.ietf-ice-trickle], Section 5.1. 2050 If the offer supports bundle, all m= sections to be bundled must use 2051 the same ICE credentials and candidates; all m= sections not being 2052 bundled must use unique ICE credentials and candidates. Each m= 2053 section MUST include the following: 2055 o If and only if present in the offer, an "a=mid" line, as specified 2056 in [RFC5888], Section 9.1. The "mid" value MUST match that 2057 specified in the offer. 2059 o An "a=rtcp" line, as specified in [RFC3605], Section 2.1, 2060 containing the dummy value "9 IN IP4 0.0.0.0", because no 2061 candidates have yet been gathered. 2063 o A direction attribute for the associated RtpTransceiver described 2064 by Section 5.3.4. 2066 o For each supported codec that is present in the offer, "a=rtpmap" 2067 and "a=fmtp" lines, as specified in [RFC4566], Section 6, and 2068 [RFC3264], Section 6.1. The audio and video codecs that MUST be 2069 supported are specified in [I-D.ietf-rtcweb-audio](see Section 3) 2070 and [I-D.ietf-rtcweb-video](see Section 5). 2072 o If this m= section is for media with configurable frame sizes, 2073 e.g. audio, an "a=maxptime" line, indicating the smallest of the 2074 maximum supported frame sizes out of all codecs included above, as 2075 specified in [RFC4566], Section 6. 2077 o If this m= section is for video media, and there are known 2078 limitations on the size of images which can be decoded, an 2079 "a=imageattr" line, as specified in Section 3.6. 2081 o If "rtx" is present in the offer, for each primary codec where RTP 2082 retransmission should be used, a corresponding "a=rtpmap" line 2083 indicating "rtx" with the clock rate of the primary codec and an 2084 "a=fmtp" line that references the payload type of the primary 2085 codec, as specified in [RFC4588], Section 8.1. 2087 o For each supported FEC mechanism, "a=rtpmap" and "a=fmtp" lines, 2088 as specified in [RFC4566], Section 6. The FEC mechanisms that 2089 MUST be supported are specified in [I-D.ietf-rtcweb-fec], 2090 Section 6, and specific usage for each media type is outlined in 2091 Sections 4 and 5. 2093 o "a=ice-ufrag" and "a=ice-pwd" lines, as specified in [RFC5245], 2094 Section 15.4. 2096 o An "a=fingerprint" line for each of the endpoint's certificates, 2097 as specified in [RFC4572], Section 5; the digest algorithm used 2098 for the fingerprint MUST match that used in the certificate 2099 signature. 2101 o An "a=setup" line, as specified in [RFC4145], Section 4, and 2102 clarified for use in DTLS-SRTP scenarios in [RFC5763], Section 5. 2103 The role value in the answer MUST be "active" or "passive"; the 2104 "active" role is RECOMMENDED. 2106 o If present in the offer, an "a=rtcp-mux" line, as specified in 2107 [RFC5761], Section 5.1.1. If the "require" RTCP multiplexing 2108 policy is set and no "a=rtcp-mux" line is present in the offer, 2109 then the m=line MUST be marked as rejected by setting the port in 2110 the m= line to zero, as indicated in [RFC3264], Section 6. 2112 o If present in the offer, an "a=rtcp-rsize" line, as specified in 2113 [RFC5506], Section 5. 2115 o For each supported RTP header extension that is present in the 2116 offer, an "a=extmap" line, as specified in [RFC5285], Section 5. 2117 The list of header extensions that SHOULD/MUST be supported is 2118 specified in [I-D.ietf-rtcweb-rtp-usage], Section 5.2. Any header 2119 extensions that require encryption MUST be specified as indicated 2120 in [RFC6904], Section 4. 2122 o For each supported RTCP feedback mechanism that is present in the 2123 offer, an "a=rtcp-fb" mechanism, as specified in [RFC4585], 2124 Section 4.2. The list of RTCP feedback mechanisms that SHOULD/ 2125 MUST be supported is specified in [I-D.ietf-rtcweb-rtp-usage], 2126 Section 5.1. 2128 o If the RtpSender of the RtpTransceiver associated with this 2129 m=section is active: 2131 * An "a=msid" line, as specified in [I-D.ietf-mmusic-msid], 2132 Section 2. 2134 * An "a=ssrc" line, as specified in [RFC5576], Section 4.1, 2135 indicating the SSRC to be used for sending media, along with 2136 the mandatory "cname" source attribute, as specified in 2137 Section 6.1, indicating the CNAME for the source. The CNAME 2138 MUST be generated in accordance with Section 4.9 of 2139 [I-D.ietf-rtcweb-rtp-usage]. 2141 * If RTX has been negotiated for this m= section, another 2142 "a=ssrc" line with the RTX SSRC, and an "a=ssrc-group" line, as 2143 specified in [RFC5576], section 4.2, with semantics set to 2144 "FID" and including the primary and RTX SSRCs. 2146 * If FEC has been negotiated for this m= section, another 2147 "a=ssrc" line with the FEC SSRC, and an "a=ssrc-group" line 2148 with semantics set to "FEC-FR" and including the primary and 2149 FEC SSRCs, as specified in [RFC5956], section 4.3. For 2150 simplicity, if both RTX and FEC are supported, the FEC SSRC 2151 MUST be the same as the RTX SSRC. 2153 If a data channel m= section has been offered, a m= section MUST also 2154 be generated for data. The field MUST be set to 2155 "application" and the and "fmt" fields MUST be set to exactly 2156 match the fields in the offer. 2158 Within the data m= section, the "a=mid", "a=ice-ufrag", "a=ice-pwd", 2159 "a=candidate", "a=fingerprint", and "a=setup" lines MUST be included 2160 as mentioned above, along with an "a=fmtp:webrtc-datachannel" line 2161 and an "a=sctp-port" line referencing the SCTP port number as defined 2162 in [I-D.ietf-mmusic-sctp-sdp], Section 4.1. 2164 If "a=group" attributes with semantics of "BUNDLE" are offered, 2165 corresponding session-level "a=group" attributes MUST be added as 2166 specified in [RFC5888]. These attributes MUST have semantics 2167 "BUNDLE", and MUST include the all mid identifiers from the offered 2168 bundle groups that have not been rejected. Note that regardless of 2169 the presence of "a=bundle-only" in the offer, no m= sections in the 2170 answer should have an "a=bundle-only" line. 2172 Attributes that are common between all m= sections MAY be moved to 2173 session-level, if explicitly defined to be valid at session-level. 2175 The attributes prohibited in the creation of offers are also 2176 prohibited in the creation of answers. 2178 5.3.2. Subsequent Answers 2180 When createAnswer is called a second (or later) time, or is called 2181 after a local description has already been installed, the processing 2182 is somewhat different than for an initial answer. 2184 If the initial answer was not applied using setLocalDescription, 2185 meaning the PeerConnection is still in the "have-remote-offer" state, 2186 the steps for generating an initial answer should be followed, 2187 subject to the following restriction: 2189 o The fields of the "o=" line MUST stay the same except for the 2190 field, which MUST increment if the session 2191 description changes in any way from the previously generated 2192 answer. 2194 If any session description was previously supplied to 2195 setLocalDescription, an answer is generated by following the steps in 2196 the "have-remote-offer" state above, along with these exceptions: 2198 o The "s=" and "t=" lines MUST stay the same. 2200 o Each "m=" and c=" line MUST be filled in with the port and address 2201 of the default candidate for the m= section, as described in 2202 [RFC5245], Section 4.3. Note, however, that the m= line protocol 2203 need not match the default candidate, because this protocol value 2204 must instead match what was supplied in the offer, as described 2205 above. Each "a=rtcp" attribute line MUST also be filled in with 2206 the port and address of the appropriate default candidate, either 2207 the default RTP or RTCP candidate, depending on whether RTCP 2208 multiplexing is enabled in the answer. In each case, if no 2209 candidates of the desired type have yet been gathered, dummy 2210 values MUST be used, as described in the initial answer section 2211 above. 2213 o Each "a=ice-ufrag" and "a=ice-pwd" line MUST stay the same, unless 2214 the m= section is restarting, in which case new ICE credentials 2215 must be created as specified in [RFC5245], Section 9.2.1.1. If 2216 the m= section is bundled into another m= section, it still MUST 2217 NOT contain any ICE credentials. 2219 o If the m= section is not bundled into another m= section, for each 2220 candidate that has been gathered during the most recent gathering 2221 phase (see Section 3.5.1), an "a=candidate" line MUST be added, as 2222 defined in [RFC5245], Section 4.3., paragraph 3. If candidate 2223 gathering for the section has completed, an "a=end-of-candidates" 2224 attribute MUST be added, as described in [I-D.ietf-ice-trickle], 2225 Section 9.3. If the m= section is bundled into another m= 2226 section, both "a=candidate" and "a=end-of-candidates" MUST be 2227 omitted. 2229 o For RtpTransceivers that are not stopped, the "a=msid", "a=ssrc", 2230 and "a=ssrc-group" lines MUST stay the same. 2232 5.3.3. Options Handling 2234 The createAnswer method takes as a parameter an RTCAnswerOptions 2235 object. The set of parameters for RTCAnswerOptions is different than 2236 those supported in RTCOfferOptions; the IceRestart option is 2237 unnecessary, as ICE credentials will automatically be changed for all 2238 m= lines where the offerer chose to perform ICE restart. 2240 The following options are supported in RTCAnswerOptions. 2242 5.3.3.1. VoiceActivityDetection 2244 Silence suppression in the answer is handled as described in 2245 Section 5.2.3.2, with one exception: if support for silence 2246 suppression was not indicated in the offer, the 2247 VoiceActivityDetection parameter has no effect, and the answer should 2248 be generated as if VoiceActivityDetection was set to false. This is 2249 done on a per-codec basis (e.g., if the offerer somehow offered 2250 support for CN but set "usedtx=0" for Opus, setting 2251 VoiceActivityDetection to true would result in an answer with CN 2252 codecs and "usedtx=0"). 2254 5.3.4. Direction Attribute in Answers 2256 [RFC3264] direction attributes (defined in Section 6.1) in answers 2257 are chosen according to the direction attribute in the remote offer 2258 and the states of the RtpSender and RtpReceiver of the corresponding 2259 RtpTransceiver, as follows: 2261 +-----------------+-----------+-------------+------------------+ 2262 | offer direction | RtpSender | RtpReceiver | answer direction | 2263 +-----------------+-----------+-------------+------------------+ 2264 | sendrecv | active | active | sendrecv | 2265 | sendrecv | active | inactive | sendonly | 2266 | sendrecv | inactive | active | recvonly | 2267 | sendrecv | inactive | inactive | inactive | 2268 | sendonly | * | active | recvonly | 2269 | sendonly | * | inactive | inactive | 2270 | recvonly | active | * | sendonly | 2271 | recvonly | inactive | * | inactive | 2272 | inactive | * | * | inactive | 2273 +-----------------+-----------+-------------+------------------+ 2275 5.4. Processing a Local Description 2277 When a SessionDescription is supplied to setLocalDescription, the 2278 following steps MUST be performed: 2280 o First, the type of the SessionDescription is checked against the 2281 current state of the PeerConnection: 2283 * If the type is "offer", the PeerConnection state MUST be either 2284 "stable" or "have-local-offer". 2286 * If the type is "pranswer" or "answer", the PeerConnection state 2287 MUST be either "have-remote-offer" or "have-local-pranswer". 2289 o If the type is not correct for the current state, processing MUST 2290 stop and an error MUST be returned. 2292 o Next, the SessionDescription is parsed into a data structure, as 2293 described in the Section 5.6 section below. If parsing fails for 2294 any reason, processing MUST stop and an error MUST be returned. 2296 o Finally, the parsed SessionDescription is applied as described in 2297 the Section 5.7 section below. 2299 5.5. Processing a Remote Description 2301 When a SessionDescription is supplied to setRemoteDescription, the 2302 following steps MUST be performed: 2304 o First, the type of the SessionDescription is checked against the 2305 current state of the PeerConnection: 2307 * If the type is "offer", the PeerConnection state MUST be either 2308 "stable" or "have-remote-offer". 2310 * If the type is "pranswer" or "answer", the PeerConnection state 2311 MUST be either "have-local-offer" or "have-remote-pranswer". 2313 o If the type is not correct for the current state, processing MUST 2314 stop and an error MUST be returned. 2316 o Next, the SessionDescription is parsed into a data structure, as 2317 described in the Section 5.6 section below. If parsing fails for 2318 any reason, processing MUST stop and an error MUST be returned. 2320 o Finally, the parsed SessionDescription is applied as described in 2321 the Section 5.8 section below. 2323 5.6. Parsing a Session Description 2325 When a SessionDescription of any type is supplied to setLocal/ 2326 RemoteDescription, the implementation must parse it and reject it if 2327 it is invalid. The exact details of this process are explained 2328 below. 2330 The SDP contained in the session description object consists of a 2331 sequence of text lines, each containing a key-value expression, as 2332 described in [RFC4566], Section 5. The SDP is read, line-by-line, 2333 and converted to a data structure that contains the deserialized 2334 information. However, SDP allows many types of lines, not all of 2335 which are relevant to JSEP applications. For each line, the 2336 implementation will first ensure it is syntactically correct 2337 according its defining ABNF, check that it conforms to [RFC4566] and 2338 [RFC3264] semantics, and then either parse and store or discard the 2339 provided value, as described below. A partial list of ABNF 2340 definitions for SDP attributes can found in: 2342 +-------------------------+----------------------------------+ 2343 | Attribute | Reference | 2344 +-------------------------+----------------------------------+ 2345 | ptime | [RFC4566] Section 9 | 2346 | maxptime | [RFC4566] Section 9 | 2347 | rtpmap | [RFC4566] Section 9 | 2348 | recvonly | [RFC4566] Section 9 | 2349 | sendrecv | [RFC4566] Section 9 | 2350 | sendonly | [RFC4566] Section 9 | 2351 | inactive | [RFC4566] Section 9 | 2352 | framerate | [RFC4566] Section 9 | 2353 | fmtp | [RFC4566] Section 9 | 2354 | quality | [RFC4566] Section 9 | 2355 | msid | [I-D.ietf-mmusic-msid] Section 2 | 2356 | rtcp | [RFC3605] Section 2.1 | 2357 | setup | [RFC4145] Section 3, 4, and 5 | 2358 | connection | [RFC4145] Section 3, 4, and 5 | 2359 | fingerprint | [RFC4572] Section 5 | 2360 | rtcp-fb | [RFC4585] Section 4.2 | 2361 | candidate | [RFC5245] Section 15 | 2362 | extmap | [RFC5285] Section 7 | 2363 | mid | [RFC5888] Section 4 and 5 | 2364 | group | [RFC5888] Section 4 and 5 | 2365 | imageattr | [RFC6236] Section 3.1 | 2366 | extmap (encrypt option) | [RFC6904] Section 4 | 2367 +-------------------------+----------------------------------+ 2369 Table 1: SDP ABNF References 2371 [TODO: ensure that every line is listed below.] 2373 If the line is not well-formed, or cannot be parsed as described, the 2374 parser MUST stop with an error and reject the session description. 2375 This ensures that implementations do not accidentally misinterpret 2376 ambiguous SDP. 2378 5.6.1. Session-Level Parsing 2380 First, the session-level lines are checked and parsed. These lines 2381 MUST occur in a specific order, and with a specific syntax, as 2382 defined in [RFC4566], Section 5. Note that while the specific line 2383 types (e.g. "v=", "c=") MUST occur in the defined order, lines of the 2384 same type (typically "a=") can occur in any order, and their ordering 2385 is not meaningful. 2387 For non-attribute (non-"a=") lines, their sequencing, syntax, and 2388 semantics, are checked, as mentioned above. The following lines are 2389 not meaningful in the JSEP context and MAY be discarded once they 2390 have been checked. 2392 The "c=" line MUST be checked for syntax but its value is not 2393 used. This supersedes the guidance in [RFC5245], Section 6.1, to 2394 use "ice-mismatch" to indicate mismatches between "c=" and the 2395 candidate lines; because JSEP always uses ICE, "ice-mismatch" is 2396 not useful in this context. 2398 The "i=", "u=", "e=", "p=", "t=", "r=", "z=", and "k=" lines are 2399 not used by this specification; they MUST be checked for syntax 2400 but their values are not used. 2402 The remaining lines are processed as follows: 2404 The "v=" line MUST have a version of 0, as specified in [RFC4566], 2405 Section 5.1. 2407 The "o=" line MUST be parsed as specified in [RFC4566], 2408 Section 5.2. 2410 The "b=" line, if present, MUST be parsed as specified in 2411 [RFC4566], Section 5.8, and the bwtype and bandwidth values 2412 stored. 2414 Specific processing MUST be applied for the following session-level 2415 attribute ("a=") lines: 2417 o Any "a=group" lines are parsed as specified in [RFC5888], 2418 Section 5, and the group's semantics and mids are stored. 2420 o If present, a single "a=ice-lite" line is parsed as specified in 2421 [RFC5245], Section 15.3, and a value indicating the presence of 2422 ice-lite is stored. 2424 o If present, a single "a=ice-ufrag" line is parsed as specified in 2425 [RFC5245], Section 15.4, and the ufrag value is stored. 2427 o If present, a single "a=ice-pwd" line is parsed as specified in 2428 [RFC5245], Section 15.4, and the password value is stored. 2430 o If present, a single "a=ice-options" line is parsed as specified 2431 in [RFC5245], Section 15.5, and the set of specified options is 2432 stored. 2434 o Any "a=fingerprint" lines are parsed as specified in [RFC4572], 2435 Section 5, and the set of fingerprint and algorithm values is 2436 stored. 2438 o If present, a single "a=setup" line is parsed as specified in 2439 [RFC4145], Section 4, and the setup value is stored. 2441 o Any "a=extmap" lines are parsed as specified in [RFC5285], 2442 Section 5, and their values are stored. 2444 o TODO: identity, rtcp-rsize, rtcp-mux, and any other attributes 2445 valid at session level. 2447 Once all the session-level lines have been parsed, processing 2448 continues with the lines in media sections. 2450 5.6.2. Media Section Parsing 2452 Like the session-level lines, the media session lines MUST occur in 2453 the specific order and with the specific syntax defined in [RFC4566], 2454 Section 5. 2456 The "m=" line itself MUST be parsed as described in [RFC4566], 2457 Section 5.14, and the media, port, proto, and fmt values stored. 2459 Following the "m=" line, specific processing MUST be applied for the 2460 following non-attribute lines: 2462 o As with the "c=" line at the session level, the "c=" line MUST be 2463 parsed according to [RFC4566], Section 5.7, but its value is not 2464 used. 2466 o The "b=" line, if present, MUST be parsed as specified in 2467 [RFC4566], Section 5.8, and the bwtype and bandwidth values 2468 stored. 2470 Specific processing MUST also be applied for the following attribute 2471 lines: 2473 o If present, a single "a=ice-ufrag" line is parsed as specified in 2474 [RFC5245], Section 15.4, and the ufrag value is stored. 2476 o If present, a single "a=ice-pwd" line is parsed as specified in 2477 [RFC5245], Section 15.4, and the password value is stored. 2479 o If present, a single "a=ice-options" line is parsed as specified 2480 in [RFC5245], Section 15.5, and the set of specified options is 2481 stored. 2483 o Any "a=fingerprint" lines are parsed as specified in [RFC4572], 2484 Section 5, and the set of fingerprint and algorithm values is 2485 stored. 2487 o If present, a single "a=setup" line is parsed as specified in 2488 [RFC4145], Section 4, and the setup value is stored. 2490 If the "m=" proto value indicates use of RTP, as described in the 2491 Section 5.1.3 section above, the following attribute lines MUST be 2492 processed: 2494 o The "m=" fmt value MUST be parsed as specified in [RFC4566], 2495 Section 5.14, and the individual values stored. 2497 o Any "a=rtpmap" or "a=fmtp" lines MUST be parsed as specified in 2498 [RFC4566], Section 6, and their values stored. 2500 o If present, a single "a=ptime" line MUST be parsed as described in 2501 [RFC4566], Section 6, and its value stored. 2503 o If present, a single "a=maxptime" line MUST be parsed as described 2504 in [RFC4566], Section 6, and its value stored. 2506 o If present, a single direction attribute line (e.g. "a=sendrecv") 2507 MUST be parsed as described in [RFC4566], Section 6, and its value 2508 stored. 2510 o Any "a=ssrc" or "a=ssrc-group" attributes MUST be parsed as 2511 specified in [RFC5576], Sections 4.1-4.2, and their values stored. 2513 o Any "a=extmap" attributes MUST be parsed as specified in 2514 [RFC5285], Section 5, and their values stored. 2516 o Any "a=rtcp-fb" attributes MUST be parsed as specified in 2517 [RFC4585], Section 4.2., and their values stored. 2519 o If present, a single "a=rtcp-mux" attribute MUST be parsed as 2520 specified in [RFC5761], Section 5.1.1, and its presence or absence 2521 flagged and stored. 2523 o If present, a single "a=rtcp-rsize" attribute MUST be parsed as 2524 specified in [RFC5506], Section 5, and its presence or absence 2525 flagged and stored. 2527 o If present, a single "a=rtcp" attribute MUST be parsed as 2528 specified in [RFC3605], Section 2.1, but its value is ignored. 2530 o If present, a single "a=msid" attribute MUST be parsed as 2531 specified in [I-D.ietf-mmusic-msid], Section 3.2, and its value 2532 stored. 2534 o Any "a=candidate" attributes MUST be parsed as specified in 2535 [RFC5245], Section 4.3, and their values stored. 2537 o Any "a=remote-candidates" attributes MUST be parsed as specified 2538 in [RFC5245], Section 4.3, but their values are ignored. 2540 o If present, a single "a=end-of-candidates" attribute MUST be 2541 parsed as specified in [I-D.ietf-ice-trickle], Section 8.2, and 2542 its presence or absence flagged and stored. 2544 o Any "a=imageattr" attributes MUST be parsed as specified in 2545 [RFC6236], Section 3, and their values stored. 2547 o Any "a=rid" lines MUST be parsed as specified in 2548 [I-D.ietf-mmusic-rid], Section 10, and their values stored. 2550 o If present, a single "a=simulcast" line MUST be parsed as 2551 specified in [I-D.ietf-mmusic-sdp-simulcast], and its values 2552 stored. 2554 Otherwise, if the "m=" proto value indicates use of SCTP, the 2555 following attribute lines MUST be processed: 2557 o The "m=" fmt value MUST be parsed as specified in 2558 [I-D.ietf-mmusic-sctp-sdp], Section 4.3, and the application 2559 protocol value stored. 2561 o An "a=sctp-port" attribute MUST be present, and it MUST be parsed 2562 as specified in [I-D.ietf-mmusic-sctp-sdp], Section 5.2, and the 2563 value stored. 2565 o If present, a single "a=max-message-size" attribute MUST be parsed 2566 as specified in [I-D.ietf-mmusic-sctp-sdp], Section 6, and the 2567 value stored. Otherwise, use the specified default. 2569 5.6.3. Semantics Verification 2571 Assuming parsing completes successfully, the parsed description is 2572 then evaluated to ensure internal consistency as well as proper 2573 support for mandatory features. Specifically, the following checks 2574 are performed: 2576 o For each m= section, valid values for each of the mandatory-to-use 2577 features enumerated in Section 5.1.2 MUST be present. These 2578 values MAY either be present at the media level, or inherited from 2579 the session level. 2581 * ICE ufrag and password values, which MUST comply with the size 2582 limits specified in [RFC5245], Section 15.4. 2584 * DTLS setup value, which MUST be set according to the rules 2585 specified in [RFC5763], Section 5, and MUST be consistent with 2586 the selected role of the current DTLS connection, if one 2587 exists.[TODO: may need revision, i.e., use of actpass 2589 * DTLS fingerprint values, where at least one fingerprint MUST be 2590 present. 2592 o All RID values referenced in an "a=simulcast" line MUST exist as 2593 "a=rid" lines. 2595 o Each m= section is also checked to ensure prohibited features are 2596 not used. If this is a local description, the "ice-lite" 2597 attribute MUST NOT be specified. 2599 If this session description is of type "pranswer" or "answer", the 2600 following additional checks are applied: 2602 o The session description must follow the rules defined in 2603 [RFC3264], Section 6, including the requirement that the number of 2604 m= sections MUST exactly match the number of m= sections in the 2605 associated offer. 2607 o For each m= section, the media type and protocol values MUST 2608 exactly match the media type and protocol values in the 2609 corresponding m= section in the associated offer. 2611 5.7. Applying a Local Description 2613 The following steps are performed at the media engine level to apply 2614 a local description. 2616 First, the parsed parameters are checked to ensure that any 2617 modifications performed fall within those explicitly permitted by 2618 Section 6; otherwise, processing MUST stop and an error MUST be 2619 returned. 2621 Next, media sections are processed. For each media section, the 2622 following steps MUST be performed; if any parameters are out of 2623 bounds, or cannot be applied, processing MUST stop and an error MUST 2624 be returned. 2626 o If this media section is new, begin gathering candidates for it, 2627 as defined in [RFC5245], Section 4.1.1, unless it has been marked 2628 as bundle-only. 2630 o Or, if the ICE ufrag and password values have changed, trigger the 2631 ICE Agent to start an ICE restart and begin gathering new 2632 candidates for the media section, as defined in [RFC5245], 2633 Section 9.1.1.1, unless it has been marked as bundle-only. 2635 o If the media section proto value indicates use of RTP: 2637 * If there is no RtpTransceiver associated with this m= section 2638 (which should only happen when applying an offer), find one and 2639 associate it with this m= section according to the following 2640 steps: 2642 + Find the RtpTransceiver that corresponds to the m= section 2643 with the same MID in the created offer. 2645 + Set the value of the RtpTransceiver's mid attribute to the 2646 MID of the m= section. 2648 * If RTCP mux is indicated, prepare to demux RTP and RTCP from 2649 the RTP ICE component, as specified in [RFC5761], 2650 Section 5.1.1. If RTCP mux is not indicated, but was indicated 2651 in a previous description, this MUST result in an error. 2653 * For each specified RTP header extension, establish a mapping 2654 between the extension ID and URI, as described in section 6 of 2655 [RFC5285]. If any indicated RTP header extension is unknown, 2656 this MUST result in an error. 2658 * If the MID header extension is supported, prepare to demux RTP 2659 data intended for this media section based on the MID header 2660 extension, as described in [I-D.ietf-mmusic-msid], Section 3.2. 2662 * For each specified payload type, establish a mapping between 2663 the payload type ID and the actual media format, as described 2664 in [RFC3264]. If any indicated payload type is unknown, this 2665 MUST result in an error. 2667 * For each specified "rtx" media format, establish a mapping 2668 between the RTX payload type and its associated primary payload 2669 type, as described in [RFC4588], Sections 8.6 and 8.7. If any 2670 referenced primary payload types are not present, this MUST 2671 result in an error. 2673 * If the directional attribute is of type "sendrecv" or 2674 "recvonly", enable receipt and decoding of media. 2676 Finally, if this description is of type "pranswer" or "answer", 2677 follow the processing defined in the Section 5.9 section below. 2679 5.8. Applying a Remote Description 2681 If the answer contains any "a=ice-options" attributes where "trickle" 2682 is listed as an attribute, update the PeerConnection canTrickle 2683 property to be true. Otherwise, set this property to false. 2685 The following steps are performed at the media engine level to apply 2686 a remote description. 2688 The following steps MUST be performed for attributes at the session 2689 level; if any parameters are out of bounds, or cannot be applied, 2690 processing MUST stop and an error MUST be returned. 2692 o For any specified "CT" bandwidth value, set this as the limit for 2693 the maximum total bitrate for all m= sections, as specified in 2694 Section 5.8 of [RFC4566]. The implementation can decide how to 2695 allocate the available bandwidth between m= sections to 2696 simultaneously meet any limits on individual m= sections, as well 2697 as this overall session limit. 2699 o For any specified "RR" or "RS" bandwidth values, handle as 2700 specified in [RFC3556], Section 2. 2702 o Any "AS" bandwidth value MUST be ignored, as the meaning of this 2703 construct at the session level is not well defined. 2705 For each media section, the following steps MUST be performed; if any 2706 parameters are out of bounds, or cannot be applied, processing MUST 2707 stop and an error MUST be returned. 2709 o If the description is of type "offer", and the ICE ufrag or 2710 password changed from the previous remote description, as 2711 described in Section 9.1.1.1 of [RFC5245], mark that an ICE 2712 restart is needed. 2714 o Configure the ICE components associated with this media section to 2715 use the supplied ICE remote ufrag and password for their 2716 connectivity checks. 2718 o Pair any supplied ICE candidates with any gathered local 2719 candidates, as described in Section 5.7 of [RFC5245] and start 2720 connectivity checks with the appropriate credentials. 2722 o If an "a=end-of-candidates" attribute is present, process the end- 2723 of-candidates indication as described in [I-D.ietf-ice-trickle] 2724 Section 11. 2726 o If the media section proto value indicates use of RTP: 2728 * [TODO: header extensions] 2730 * If the m= section is being recycled (see Section 5.2.2), 2731 dissociate the currently associated RtpTransceiver by setting 2732 its mid attribute to null. 2734 * If the m= section is not associated with any RtpTransceiver 2735 (possibly because it was dissociated in the previous step), 2736 either find an RtpTransceiver or create one according to the 2737 following steps: 2739 + If the m= section is sendrecv or recvonly, and there are 2740 RtpTransceivers of the same type that were added to the 2741 PeerConnection by addTrack and are not associated with any 2742 m= section and are not stopped, find the first (according to 2743 the canonical order described in Section 5.2.1) such 2744 RtpTransceiver. 2746 + If no RtpTransceiver was found in the previous step, create 2747 one with an inactive RtpSender and active RtpReceiver. 2749 + Associate the found or created RtpTransceiver with the m= 2750 section by setting the value of the RtpTransceiver's mid 2751 attribute to the MID of the m= section. 2753 * For each specified payload type that is also supported by the 2754 local implementation, establish a mapping between the payload 2755 type ID and the actual media format. [TODO - Justin to add 2756 more to explain mapping.] If any indicated payload type is 2757 unknown, it MUST be ignored. [TODO: should fail on answers] 2759 * For each specified "rtx" media format, establish a mapping 2760 between the RTX payload type and its associated primary payload 2761 type, as described in [RFC4588]. If any referenced primary 2762 payload types are not present, this MUST result in an error. 2764 * For each specified fmtp parameter that is supported by the 2765 local implementation, enable them on the associated payload 2766 types. 2768 * For each specified RTCP feedback mechanism that is supported by 2769 the local implementation, enable them on the associated payload 2770 types. 2772 * For any specified "TIAS" bandwidth value, set this value as a 2773 constraint on the maximum RTP bitrate to be used when sending 2774 media, as specified in [RFC3890]. If a "TIAS" value is not 2775 present, but an "AS" value is specified, generate a "TIAS" 2776 value using this formula: 2778 TIAS = AS * 1000 * 0.95 - 50 * 40 * 8 2780 The 50 is based on 50 packets per second, the 40 is based on an 2781 estimate of total header size, the 1000 changes the unit from 2782 kbps to bps (as required by TIAS), and the 0.95 is to allocate 2783 5% to RTCP. If more accurate control of bandwidth is needed, 2784 "TIAS" should be used instead of "AS". 2786 * For any "RR" or "RS" bandwidth values, handle as specified in 2787 [RFC3556], Section 2. 2789 * Any specified "CT" bandwidth value MUST be ignored, as the 2790 meaning of this construct at the media level is not well 2791 defined. 2793 * [TODO: handling of CN, telephone-event, "red"] 2795 * If the media section if of type audio: 2797 + For any specified "ptime" value, configure the available 2798 payload types to use the specified packet size. If the 2799 specified size is not supported for a payload type, use the 2800 next closest value instead. 2802 Finally, if this description is of type "pranswer" or "answer", 2803 follow the processing defined in the Section 5.9 section below. 2805 5.9. Applying an Answer 2807 In addition to the steps mentioned above for processing a local or 2808 remote description, the following steps are performed when processing 2809 a description of type "pranswer" or "answer". 2811 For each media section, the following steps MUST be performed: 2813 o If the media section has been rejected (i.e. port is set to zero 2814 in the answer), stop any reception or transmission of media for 2815 this section, and discard any associated ICE components, as 2816 described in Section 9.2.1.3 of [RFC5245]. 2818 o If the remote DTLS fingerprint has been changed, tear down the 2819 existing DTLS connection. 2821 o If no valid DTLS connection exists, prepare to start a DTLS 2822 connection, using the specified roles and fingerprints, on any 2823 underlying ICE components, once they are active. 2825 o If the media section proto value indicates use of RTP: 2827 * If the media section has RTCP mux enabled, discard any RTCP 2828 component, and begin or continue muxing RTCP over the RTP 2829 component, as specified in [RFC5761], Section 5.1.3. 2830 Otherwise, transmit RTCP over the RTCP component; if no RTCP 2831 component exists, because RTCP mux was previously enabled, this 2832 MUST result in an error. 2834 * If the media section has reduced-size RTCP enabled, configure 2835 the RTCP transmission for this media section to use reduced- 2836 size RTCP, as specified in [RFC5506]. 2838 * If the directional attribute in the answer is of type 2839 "sendrecv" or "sendonly", prepare to start transmitting media 2840 using the specified primary SSRC and one of the selected 2841 payload types, once the underlying transport layers have been 2842 established. If RID values are specified, include the RID 2843 header extension in the RTP streams, as indicated in 2844 [I-D.ietf-mmusic-rid], Section 4). If simulcast is negotiated, 2845 send the number of Source RTP Streams as specified in 2846 [I-D.ietf-mmusic-sdp-simulcast], Section 6.2.2. If the 2847 directional attribute is of type "recvonly" or "inactive", stop 2848 transmitting RTP media, although RTCP should still be sent, as 2849 described in [RFC3264], Section 5.1. 2851 o If the media section proto value indicates use of SCTP: 2853 * If no SCTP association yet exists, prepare to initiate a SCTP 2854 association over the associated ICE component and DTLS 2855 connection, using the local SCTP port value from the local 2856 description, and the remote SCTP port value from the remote 2857 description, as described in [I-D.ietf-mmusic-sctp-sdp], 2858 Section 10.2. 2860 If the answer contains valid bundle groups, discard any ICE 2861 components for the m= sections that will be bundled onto the primary 2862 ICE components in each bundle, and begin muxing these m= sections 2863 accordingly, as described in 2864 [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 8.2. 2866 6. Configurable SDP Parameters 2868 It is possible to change elements in the SDP returned from 2869 createOffer before passing it to setLocalDescription. When an 2870 implementation receives modified SDP it MUST either: 2872 o Accept the changes and adjust its behavior to match the SDP. 2874 o Reject the changes and return an error via the error callback. 2876 Changes MUST NOT be silently ignored. 2878 The following elements of the session description MUST NOT be changed 2879 between the createOffer and the setLocalDescription (or between the 2880 createAnswer and the setLocalDescription), since they reflect 2881 transport attributes that are solely under browser control, and the 2882 browser MUST NOT honor an attempt to change them: 2884 o The number, type and port number of m= lines. 2886 o The generated MID attributes (a=mid). 2888 o The generated ICE credentials (a=ice-ufrag and a=ice-pwd). 2890 o The set of ICE candidates and their parameters (a=candidate). 2892 o The DTLS fingerprint(s) (a=fingerprint). 2894 o The contents of bundle groups, bundle-only parameters, or "a=rtcp- 2895 mux" parameters. 2897 The following modifications, if done by the browser to a description 2898 between createOffer/createAnswer and the setLocalDescription, MUST be 2899 honored by the browser: 2901 o Remove or reorder codecs (m=) 2903 The following parameters may be controlled by options passed into 2904 createOffer/createAnswer. As an open issue, these changes may also 2905 be be performed by manipulating the SDP returned from createOffer/ 2906 createAnswer, as indicated above, as long as the capabilities of the 2907 endpoint are not exceeded (e.g. asking for a resolution greater than 2908 what the endpoint can encode): 2910 o [[OPEN ISSUE: This is a placeholder for other modifications, which 2911 we may continue adding as use cases appear.]] 2913 Implementations MAY choose to either honor or reject any elements not 2914 listed in the above two categories, but must do so explicitly as 2915 described at the beginning of this section. Note that future 2916 standards may add new SDP elements to the list of elements which must 2917 be accepted or rejected, but due to version skew, applications must 2918 be prepared for implementations to accept changes which must be 2919 rejected and vice versa. 2921 The application can also modify the SDP to reduce the capabilities in 2922 the offer it sends to the far side or the offer that it installs from 2923 the far side in any way the application sees fit, as long as it is a 2924 valid SDP offer and specifies a subset of what was in the original 2925 offer. This is safe because the answer is not permitted to expand 2926 capabilities and therefore will just respond to what is actually in 2927 the offer. 2929 As always, the application is solely responsible for what it sends to 2930 the other party, and all incoming SDP will be processed by the 2931 browser to the extent of its capabilities. It is an error to assume 2932 that all SDP is well-formed; however, one should be able to assume 2933 that any implementation of this specification will be able to 2934 process, as a remote offer or answer, unmodified SDP coming from any 2935 other implementation of this specification. 2937 7. Examples 2939 Note that this example section shows several SDP fragments. To 2940 format in 72 columns, some of the lines in SDP have been split into 2941 multiple lines, where leading whitespace indicates that a line is a 2942 continuation of the previous line. In addition, some blank lines 2943 have been added to improve readability but are not valid in SDP. 2945 More examples of SDP for WebRTC call flows can be found in 2946 [I-D.nandakumar-rtcweb-sdp]. 2948 7.1. Simple Example 2950 This section shows a very simple example that sets up a minimal audio 2951 / video call between two browsers and does not use trickle ICE. The 2952 example in the following section provides a more realistic example of 2953 what would happen in a normal browser to browser connection. 2955 The flow shows Alice's browser initiating the session to Bob's 2956 browser. The messages from Alice's JS to Bob's JS are assumed to 2957 flow over some signaling protocol via a web server. The JS on both 2958 Alice's side and Bob's side waits for all candidates before sending 2959 the offer or answer, so the offers and answers are complete. Trickle 2960 ICE is not used. Both Alice and Bob are using the default policy of 2961 balanced. 2963 // set up local media state 2964 AliceJS->AliceUA: create new PeerConnection 2965 AliceJS->AliceUA: addTrack with two tracks: audio and video 2966 AliceJS->AliceUA: createOffer to get offer 2967 AliceJS->AliceUA: setLocalDescription with offer 2968 AliceUA->AliceJS: multiple onicecandidate events with candidates 2970 // wait for ICE gathering to complete 2971 AliceUA->AliceJS: onicecandidate event with null candidate 2972 AliceJS->AliceUA: get |offer-A1| from pendingLocalDescription 2974 // |offer-A1| is sent over signaling protocol to Bob 2975 AliceJS->WebServer: signaling with |offer-A1| 2976 WebServer->BobJS: signaling with |offer-A1| 2978 // |offer-A1| arrives at Bob 2979 BobJS->BobUA: create a PeerConnection 2980 BobJS->BobUA: setRemoteDescription with |offer-A1| 2981 BobUA->BobJS: onaddstream event with remoteStream 2983 // Bob accepts call 2984 BobJS->BobUA: addTrack with local tracks 2985 BobJS->BobUA: createAnswer 2986 BobJS->BobUA: setLocalDescription with answer 2987 BobUA->BobJS: multiple onicecandidate events with candidates 2989 // wait for ICE gathering to complete 2990 BobUA->BobJS: onicecandidate event with null candidate 2991 BobJS->BobUA: get |answer-A1| from currentLocalDescription 2993 // |answer-A1| is sent over signaling protocol to Alice 2994 BobJS->WebServer: signaling with |answer-A1| 2995 WebServer->AliceJS: signaling with |answer-A1| 2997 // |answer-A1| arrives at Alice 2998 AliceJS->AliceUA: setRemoteDescription with |answer-A1| 2999 AliceUA->AliceJS: onaddstream event with remoteStream 3001 // media flows 3002 BobUA->AliceUA: media sent from Bob to Alice 3003 AliceUA->BobUA: media sent from Alice to Bob 3005 The SDP for |offer-A1| looks like: 3007 v=0 3008 o=- 4962303333179871722 1 IN IP4 0.0.0.0 3009 s=- 3010 t=0 0 3011 a=group:BUNDLE a1 v1 3012 a=ice-options:trickle 3013 m=audio 56500 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3014 c=IN IP4 192.0.2.1 3015 a=mid:a1 3016 a=rtcp:56501 IN IP4 192.0.2.1 3017 a=msid:47017fee-b6c1-4162-929c-a25110252400 3018 f83006c5-a0ff-4e0a-9ed9-d3e6747be7d9 3019 a=sendrecv 3020 a=rtpmap:96 opus/48000/2 3021 a=rtpmap:0 PCMU/8000 3022 a=rtpmap:8 PCMA/8000 3023 a=rtpmap:97 telephone-event/8000 3024 a=rtpmap:98 telephone-event/48000 3025 a=maxptime:120 3026 a=ice-ufrag:ETEn1v9DoTMB9J4r 3027 a=ice-pwd:OtSK0WpNtpUjkY4+86js7ZQl 3028 a=fingerprint:sha-256 3029 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3030 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3031 a=setup:actpass 3032 a=rtcp-mux 3033 a=rtcp-rsize 3034 a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3035 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3036 a=ssrc:1732846380 cname:EocUG1f0fcg/yvY7 3037 a=candidate:3348148302 1 udp 2113937151 192.0.2.1 56500 3038 typ host 3039 a=candidate:3348148302 2 udp 2113937151 192.0.2.1 56501 3040 typ host 3041 a=end-of-candidates 3043 m=video 56502 UDP/TLS/RTP/SAVPF 100 101 3044 c=IN IP4 192.0.2.1 3045 a=rtcp:56503 IN IP4 192.0.2.1 3046 a=mid:v1 3047 a=msid:61317484-2ed4-49d7-9eb7-1414322a7aae 3048 f30bdb4a-5db8-49b5-bcdc-e0c9a23172e0 3049 a=sendrecv 3050 a=rtpmap:100 VP8/90000 3051 a=rtpmap:101 rtx/90000 3052 a=fmtp:101 apt=100 3053 a=ice-ufrag:BGKkWnG5GmiUpdIV 3054 a=ice-pwd:mqyWsAjvtKwTGnvhPztQ9mIf 3055 a=fingerprint:sha-256 3056 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3057 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3058 a=setup:actpass 3059 a=rtcp-mux 3060 a=rtcp-rsize 3061 a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid 3062 a=rtcp-fb:100 ccm fir 3063 a=rtcp-fb:100 nack 3064 a=rtcp-fb:100 nack pli 3065 a=ssrc:1366781083 cname:EocUG1f0fcg/yvY7 3066 a=ssrc:1366781084 cname:EocUG1f0fcg/yvY7 3067 a=ssrc-group:FID 1366781083 1366781084 3068 a=candidate:3348148302 1 udp 2113937151 192.0.2.1 56502 3069 typ host 3070 a=candidate:3348148302 2 udp 2113937151 192.0.2.1 56503 3071 typ host 3072 a=end-of-candidates 3074 The SDP for |answer-A1| looks like: 3076 v=0 3077 o=- 6729291447651054566 1 IN IP4 0.0.0.0 3078 s=- 3079 t=0 0 3080 a=group:BUNDLE a1 v1 3081 m=audio 20000 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3082 c=IN IP4 192.0.2.2 3083 a=mid:a1 3084 a=rtcp:20000 IN IP4 192.0.2.2 3085 a=msid:PI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1 3086 PI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1a0 3087 a=sendrecv 3088 a=rtpmap:96 opus/48000/2 3089 a=rtpmap:0 PCMU/8000 3090 a=rtpmap:8 PCMA/8000 3091 a=rtpmap:97 telephone-event/8000 3092 a=rtpmap:98 telephone-event/48000 3093 a=maxptime:120 3094 a=ice-ufrag:6sFvz2gdLkEwjZEr 3095 a=ice-pwd:cOTZKZNVlO9RSGsEGM63JXT2 3096 a=fingerprint:sha-256 6B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35 3097 :DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3098 a=setup:active 3099 a=rtcp-mux 3100 a=rtcp-rsize 3101 a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3102 a=ssrc:3429951804 cname:Q/NWs1ao1HmN4Xa5 3103 a=candidate:2299743422 1 udp 2113937151 192.0.2.2 20000 3104 typ host 3105 a=end-of-candidates 3107 m=video 20000 UDP/TLS/RTP/SAVPF 100 101 3108 c=IN IP4 192.0.2.2 3109 a=rtcp 20001 IN IP4 192.0.2.2 3110 a=mid:v1 3111 a=msid:PI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1 3112 PI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1v0 3113 a=sendrecv 3114 a=rtpmap:100 VP8/90000 3115 a=rtpmap:101 rtx/90000 3116 a=fmtp:101 apt=100 3117 a=fingerprint:sha-256 6B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35 3118 :DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3119 a=setup:active 3120 a=rtcp-mux 3121 a=rtcp-rsize 3122 a=rtcp-fb:100 ccm fir 3123 a=rtcp-fb:100 nack 3124 a=rtcp-fb:100 nack pli 3125 a=ssrc:3229706345 cname:Q/NWs1ao1HmN4Xa5 3126 a=ssrc:3229706346 cname:Q/NWs1ao1HmN4Xa5 3127 a=ssrc-group:FID 3229706345 3229706346 3129 7.2. Normal Examples 3131 This section shows a typical example of a session between two 3132 browsers setting up an audio channel and a data channel. Trickle ICE 3133 is used in full trickle mode with a bundle policy of max-bundle, an 3134 RTCP mux policy of require, and a single TURN server. Later, two 3135 video flows, one for the presenter and one for screen sharing, are 3136 added to the session. This example shows Alice's browser initiating 3137 the session to Bob's browser. The messages from Alice's JS to Bob's 3138 JS are assumed to flow over some signaling protocol via a web server. 3140 // set up local media state 3141 AliceJS->AliceUA: create new PeerConnection 3142 AliceJS->AliceUA: addTrack with an audio track 3143 AliceJS->AliceUA: createDataChannel to get data channel 3144 AliceJS->AliceUA: createOffer to get |offer-B1| 3145 AliceJS->AliceUA: setLocalDescription with |offer-B1| 3146 // |offer-B1| is sent over signaling protocol to Bob 3147 AliceJS->WebServer: signaling with |offer-B1| 3148 WebServer->BobJS: signaling with |offer-B1| 3150 // |offer-B1| arrives at Bob 3151 BobJS->BobUA: create a PeerConnection 3152 BobJS->BobUA: setRemoteDescription with |offer-B1| 3153 BobUA->BobJS: onaddstream with audio track from Alice 3155 // candidates are sent to Bob 3156 AliceUA->AliceJS: onicecandidate event with |candidate-B1| (host) 3157 AliceJS->WebServer: signaling with |candidate-B1| 3158 AliceUA->AliceJS: onicecandidate event with |candidate-B2| (srflx) 3159 AliceJS->WebServer: signaling with |candidate-B2| 3161 WebServer->BobJS: signaling with |candidate-B1| 3162 BobJS->BobUA: addIceCandidate with |candidate-B1| 3163 WebServer->BobJS: signaling with |candidate-B2| 3164 BobJS->BobUA: addIceCandidate with |candidate-B2| 3166 // Bob accepts call 3167 BobJS->BobUA: addTrack with local audio 3168 BobJS->BobUA: createDataChannel to get data channel 3169 BobJS->BobUA: createAnswer to get |answer-B1| 3170 BobJS->BobUA: setLocalDescription with |answer-B1| 3172 // |answer-B1| is sent to Alice 3173 BobJS->WebServer: signaling with |answer-B1| 3174 WebServer->AliceJS: signaling with |answer-B1| 3175 AliceJS->AliceUA: setRemoteDescription with |answer-B1| 3176 AliceUA->AliceJS: onaddstream event with audio track from Bob 3178 // candidates are sent to Alice 3179 BobUA->BobJS: onicecandidate event with |candidate-B3| (host) 3180 BobJS->WebServer: signaling with |candidate-B3| 3181 BobUA->BobJS: onicecandidate event with |candidate-B4| (srflx) 3182 BobJS->WebServer: signaling with |candidate-B4| 3184 WebServer->AliceJS: signaling with |candidate-B3| 3185 AliceJS->AliceUA: addIceCandidate with |candidate-B3| 3186 WebServer->AliceJS: signaling with |candidate-B4| 3187 AliceJS->AliceUA: addIceCandidate with |candidate-B4| 3189 // data channel opens 3190 BobUA->BobJS: ondatachannel event 3191 AliceUA->AliceJS: ondatachannel event 3192 BobUA->BobJS: onopen 3193 AliceUA->AliceJS: onopen 3194 // media is flowing between browsers 3195 BobUA->AliceUA: audio+data sent from Bob to Alice 3196 AliceUA->BobUA: audio+data sent from Alice to Bob 3198 // some time later Bob adds two video streams 3199 // note, no candidates exchanged, because of bundle 3200 BobJS->BobUA: addTrack with first video stream 3201 BobJS->BobUA: addTrack with second video stream 3202 BobJS->BobUA: createOffer to get |offer-B2| 3203 BobJS->BobUA: setLocalDescription with |offer-B2| 3205 // |offer-B2| is sent to Alice 3206 BobJS->WebServer: signaling with |offer-B2| 3207 WebServer->AliceJS: signaling with |offer-B2| 3208 AliceJS->AliceUA: setRemoteDescription with |offer-B2| 3209 AliceUA->AliceJS: onaddstream event with first video stream 3210 AliceUA->AliceJS: onaddstream event with second video stream 3211 AliceJS->AliceUA: createAnswer to get |answer-B2| 3212 AliceJS->AliceUA: setLocalDescription with |answer-B2| 3214 // |answer-B2| is sent over signaling protocol to Bob 3215 AliceJS->WebServer: signaling with |answer-B2| 3216 WebServer->BobJS: signaling with |answer-B2| 3217 BobJS->BobUA: setRemoteDescription with |answer-B2| 3219 // media is flowing between browsers 3220 BobUA->AliceUA: audio+video+data sent from Bob to Alice 3221 AliceUA->BobUA: audio+video+data sent from Alice to Bob 3223 The SDP for |offer-B1| looks like: 3225 v=0 3226 o=- 4962303333179871723 1 IN IP4 0.0.0.0 3227 s=- 3228 t=0 0 3229 a=group:BUNDLE a1 d1 3230 a=ice-options:trickle 3231 m=audio 9 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3232 c=IN IP4 0.0.0.0 3233 a=rtcp:9 IN IP4 0.0.0.0 3234 a=mid:a1 3235 a=msid:57017fee-b6c1-4162-929c-a25110252400 3236 e83006c5-a0ff-4e0a-9ed9-d3e6747be7d9 3237 a=sendrecv 3238 a=rtpmap:96 opus/48000/2 3239 a=rtpmap:0 PCMU/8000 3240 a=rtpmap:8 PCMA/8000 3241 a=rtpmap:97 telephone-event/8000 3242 a=rtpmap:98 telephone-event/48000 3243 a=maxptime:120 3244 a=ice-ufrag:ATEn1v9DoTMB9J4r 3245 a=ice-pwd:AtSK0WpNtpUjkY4+86js7ZQl 3246 a=fingerprint:sha-256 3247 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3248 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3249 a=setup:actpass 3250 a=rtcp-mux 3251 a=rtcp-rsize 3252 a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3253 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3254 a=ssrc:1732846380 cname:FocUG1f0fcg/yvY7 3256 m=application 0 UDP/DTLS/SCTP webrtc-datachannel 3257 c=IN IP4 0.0.0.0 3258 a=bundle-only 3259 a=mid:d1 3260 a=fmtp:webrtc-datachannel max-message-size=65536 3261 a=sctp-port 5000 3262 a=fingerprint:sha-256 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3263 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3264 a=setup:actpass 3266 The SDP for |candidate-B1| looks like: 3268 candidate:109270923 1 udp 2122194687 192.168.1.2 51556 typ host 3269 The SDP for |candidate-B2| looks like: 3271 candidate:4036177503 1 udp 1685987071 11.22.33.44 52546 typ srflx 3272 raddr 192.168.1.2 rport 51556 3274 The SDP for |answer-B1| looks like: 3276 v=0 3277 o=- 7729291447651054566 1 IN IP4 0.0.0.0 3278 s=- 3279 t=0 0 3280 a=group:BUNDLE a1 d1 3281 a=ice-options:trickle 3282 m=audio 9 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3283 c=IN IP4 0.0.0.0 3284 a=rtcp:9 IN IP4 0.0.0.0 3285 a=mid:a1 3286 a=msid:QI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1 3287 QI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1a0 3288 a=sendrecv 3289 a=rtpmap:96 opus/48000/2 3290 a=rtpmap:0 PCMU/8000 3291 a=rtpmap:8 PCMA/8000 3292 a=rtpmap:97 telephone-event/8000 3293 a=rtpmap:98 telephone-event/48000 3294 a=maxptime:120 3295 a=ice-ufrag:7sFvz2gdLkEwjZEr 3296 a=ice-pwd:dOTZKZNVlO9RSGsEGM63JXT2 3297 a=fingerprint:sha-256 6B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35 3298 :DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3299 a=setup:active 3300 a=rtcp-mux 3301 a=rtcp-rsize 3302 a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3303 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3304 a=ssrc:4429951804 cname:Q/NWs1ao1HmN4Xa5 3306 m=application 9 UDP/DTLS/SCTP webrtc-datachannel 3307 c=IN IP4 0.0.0.0 3308 a=mid:d1 3309 a=fmtp:webrtc-datachannel max-message-size=65536 3310 a=sctp-port 5000 3311 a=fingerprint:sha-256 6B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35 3312 :DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3313 a=setup:active 3315 The SDP for |candidate-B3| looks like: 3317 candidate:109270924 1 udp 2122194687 192.168.2.3 61665 typ host 3319 The SDP for |candidate-B4| looks like: 3321 candidate:4036177504 1 udp 1685987071 55.66.77.88 64532 typ srflx 3322 raddr 192.168.2.3 rport 61665 3324 The SDP for |offer-B2| looks like: (note the increment of the version 3325 number in the o= line, and the c= and a=rtcp lines, which indicate 3326 the local candidate that was selected) 3328 v=0 3329 o=- 7729291447651054566 2 IN IP4 0.0.0.0 3330 s=- 3331 t=0 0 3332 a=group:BUNDLE a1 d1 v1 v2 3333 a=ice-options:trickle 3334 m=audio 64532 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3335 c=IN IP4 55.66.77.88 3336 a=rtcp:64532 IN IP4 55.66.77.88 3337 a=mid:a1 3338 a=msid:QI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1 3339 QI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1a0 3340 a=sendrecv 3341 a=rtpmap:96 opus/48000/2 3342 a=rtpmap:0 PCMU/8000 3343 a=rtpmap:8 PCMA/8000 3344 a=rtpmap:97 telephone-event/8000 3345 a=rtpmap:98 telephone-event/48000 3346 a=maxptime:120 3347 a=ice-ufrag:7sFvz2gdLkEwjZEr 3348 a=ice-pwd:dOTZKZNVlO9RSGsEGM63JXT2 3349 a=fingerprint:sha-256 6B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35 3350 :DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3351 a=setup:actpass 3352 a=rtcp-mux 3353 a=rtcp-rsize 3354 a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3355 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3356 a=ssrc:4429951804 cname:Q/NWs1ao1HmN4Xa5 3357 a=candidate:109270924 1 udp 2122194687 192.168.2.3 61665 typ host 3358 a=candidate:4036177504 1 udp 1685987071 55.66.77.88 64532 typ srflx 3359 raddr 192.168.2.3 rport 61665 3360 a=candidate:3671762467 1 udp 41819903 66.77.88.99 50416 typ relay 3361 raddr 55.66.77.88 rport 64532 3362 a=end-of-candidates 3364 m=application 64532 UDP/DTLS/SCTP webrtc-datachannel 3365 c=IN IP4 55.66.77.88 3366 a=mid:d1 3367 a=fmtp:webrtc-datachannel max-message-size=65536 3368 a=sctp-port 5000 3369 a=ice-ufrag:7sFvz2gdLkEwjZEr 3370 a=ice-pwd:dOTZKZNVlO9RSGsEGM63JXT2 3371 a=fingerprint:sha-256 6B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35 3372 :DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 3373 a=setup:actpass 3374 a=candidate:109270924 1 udp 2122194687 192.168.2.3 61665 typ host 3375 a=candidate:4036177504 1 udp 1685987071 55.66.77.88 64532 typ srflx 3376 raddr 192.168.2.3 rport 61665 3377 a=candidate:3671762467 1 udp 41819903 66.77.88.99 50416 typ relay 3378 raddr 55.66.77.88 rport 64532 3379 a=end-of-candidates 3381 m=video 0 UDP/TLS/RTP/SAVPF 100 101 3382 c=IN IP4 55.66.77.88 3383 a=bundle-only 3384 a=rtcp:64532 IN IP4 55.66.77.88 3385 a=mid:v1 3386 a=msid:61317484-2ed4-49d7-9eb7-1414322a7aae 3387 f30bdb4a-5db8-49b5-bcdc-e0c9a23172e0 3388 a=sendrecv 3389 a=rtpmap:100 VP8/90000 3390 a=rtpmap:101 rtx/90000 3391 a=fmtp:101 apt=100 3392 a=fingerprint:sha-256 3393 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3394 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3395 a=setup:actpass 3396 a=rtcp-mux 3397 a=rtcp-rsize 3398 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3399 a=rtcp-fb:100 ccm fir 3400 a=rtcp-fb:100 nack 3401 a=rtcp-fb:100 nack pli 3402 a=ssrc:1366781083 cname:Q/NWs1ao1HmN4Xa5 3403 a=ssrc:1366781084 cname:Q/NWs1ao1HmN4Xa5 3404 a=ssrc-group:FID 1366781083 1366781084 3406 m=video 0 UDP/TLS/RTP/SAVPF 100 101 3407 c=IN IP4 55.66.77.88 3408 a=bundle-only 3409 a=rtcp:64532 IN IP4 55.66.77.88 3410 a=mid:v1 3411 a=msid:71317484-2ed4-49d7-9eb7-1414322a7aae 3412 f30bdb4a-5db8-49b5-bcdc-e0c9a23172e0 3413 a=sendrecv 3414 a=rtpmap:100 VP8/90000 3415 a=rtpmap:101 rtx/90000 3416 a=fmtp:101 apt=100 3417 a=fingerprint:sha-256 3418 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3419 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3420 a=setup:actpass 3421 a=rtcp-mux 3422 a=rtcp-rsize 3423 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3424 a=rtcp-fb:100 ccm fir 3425 a=rtcp-fb:100 nack 3426 a=rtcp-fb:100 nack pli 3427 a=ssrc:2366781083 cname:Q/NWs1ao1HmN4Xa5 3428 a=ssrc:2366781084 cname:Q/NWs1ao1HmN4Xa5 3429 a=ssrc-group:FID 2366781083 2366781084 3431 The SDP for |answer-B2| looks like: (note the use of setup:passive to 3432 maintain the existing DTLS roles, and the use of a=recvonly to 3433 indicate that the video streams are one-way) 3435 v=0 3436 o=- 4962303333179871723 2 IN IP4 0.0.0.0 3437 s=- 3438 t=0 0 3439 a=group:BUNDLE a1 d1 v1 v2 3440 a=ice-options:trickle 3441 m=audio 52546 UDP/TLS/RTP/SAVPF 96 0 8 97 98 3442 c=IN IP4 11.22.33.44 3443 a=rtcp:52546 IN IP4 11.22.33.44 3444 a=mid:a1 3445 a=msid:57017fee-b6c1-4162-929c-a25110252400 3446 e83006c5-a0ff-4e0a-9ed9-d3e6747be7d9 3447 a=sendrecv 3448 a=rtpmap:96 opus/48000/2 3449 a=rtpmap:0 PCMU/8000 3450 a=rtpmap:8 PCMA/8000 3451 a=rtpmap:97 telephone-event/8000 3452 a=rtpmap:98 telephone-event/48000 3453 a=maxptime:120 3454 a=ice-ufrag:ATEn1v9DoTMB9J4r 3455 a=ice-pwd:AtSK0WpNtpUjkY4+86js7ZQl 3456 a=fingerprint:sha-256 3457 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3458 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3459 a=setup:passive 3460 a=rtcp-mux 3461 a=rtcp-rsize 3462 a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level 3463 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3464 a=ssrc:1732846380 cname:FocUG1f0fcg/yvY7 3465 a=candidate:109270923 1 udp 2122194687 192.168.1.2 51556 typ host 3466 a=candidate:4036177503 1 udp 1685987071 11.22.33.44 52546 typ srflx 3467 raddr 192.168.1.2 rport 51556 3468 a=candidate:3671762466 1 udp 41819903 22.33.44.55 61405 typ relay 3469 raddr 11.22.33.44 rport 52546 3470 a=end-of-candidates 3472 m=application 52546 UDP/DTLS/SCTP webrtc-datachannel 3473 c=IN IP4 11.22.33.44 3474 a=mid:d1 3475 a=fmtp:webrtc-datachannel max-message-size=65536 3476 a=sctp-port 5000 3477 a=fingerprint:sha-256 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3478 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3479 a=setup:passive 3481 m=video 52546 UDP/TLS/RTP/SAVPF 100 101 3482 c=IN IP4 11.22.33.44 3483 a=rtcp:52546 IN IP4 11.22.33.44 3484 a=mid:v1 3485 a=recvonly 3486 a=rtpmap:100 VP8/90000 3487 a=rtpmap:101 rtx/90000 3488 a=fmtp:101 apt=100 3489 a=fingerprint:sha-256 3490 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3491 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3492 a=setup:passive 3493 a=rtcp-mux 3494 a=rtcp-rsize 3495 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3496 a=rtcp-fb:100 ccm fir 3497 a=rtcp-fb:100 nack 3498 a=rtcp-fb:100 nack pli 3500 m=video 52546 UDP/TLS/RTP/SAVPF 100 101 3501 c=IN IP4 11.22.33.44 3502 a=rtcp:52546 IN IP4 11.22.33.44 3503 a=mid:v2 3504 a=recvonly 3505 a=rtpmap:100 VP8/90000 3506 a=rtpmap:101 rtx/90000 3507 a=fmtp:101 apt=100 3508 a=fingerprint:sha-256 3509 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 3510 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 3511 a=setup:passive 3512 a=rtcp-mux 3513 a=rtcp-rsize 3514 a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid 3515 a=rtcp-fb:100 ccm fir 3516 a=rtcp-fb:100 nack 3517 a=rtcp-fb:100 nack pli 3519 8. Security Considerations 3521 The IETF has published separate documents 3522 [I-D.ietf-rtcweb-security-arch] [I-D.ietf-rtcweb-security] describing 3523 the security architecture for WebRTC as a whole. The remainder of 3524 this section describes security considerations for this document. 3526 While formally the JSEP interface is an API, it is better to think of 3527 it is an Internet protocol, with the JS being untrustworthy from the 3528 perspective of the browser. Thus, the threat model of [RFC3552] 3529 applies. In particular, JS can call the API in any order and with 3530 any inputs, including malicious ones. This is particularly relevant 3531 when we consider the SDP which is passed to setLocalDescription(). 3532 While correct API usage requires that the application pass in SDP 3533 which was derived from createOffer() or createAnswer() (perhaps 3534 suitably modified as described in Section 6, there is no guarantee 3535 that applications do so. The browser MUST be prepared for the JS to 3536 pass in bogus data instead. 3538 Conversely, the application programmer MUST recognize that the JS 3539 does not have complete control of browser behavior. One case that 3540 bears particular mention is that editing ICE candidates out of the 3541 SDP or suppressing trickled candidates does not have the expected 3542 behavior: implementations will still perform checks from those 3543 candidates even if they are not sent to the other side. Thus, for 3544 instance, it is not possible to prevent the remote peer from learning 3545 your public IP address by removing server reflexive candidates. 3546 Applications which wish to conceal their public IP address should 3547 instead configure the ICE agent to use only relay candidates. 3549 9. IANA Considerations 3551 This document requires no actions from IANA. 3553 10. Acknowledgements 3555 Significant text incorporated in the draft as well and review was 3556 provided by Peter Thatcher, Taylor Brandstetter, Harald Alvestrand 3557 and Suhas Nandakumar. Dan Burnett, Neil Stratford, Anant Narayanan, 3558 Andrew Hutton, Richard Ejzak, Adam Bergkvist and Matthew Kaufman all 3559 provided valuable feedback on this proposal. 3561 11. References 3563 11.1. Normative References 3565 [I-D.ietf-avtext-rid] 3566 Roach, A., Nandakumar, S., and P. Thatcher, "RTP Stream 3567 Identifier (RID) Source Description (SDES)", draft-ietf- 3568 avtext-rid-00 (work in progress), February 2016. 3570 [I-D.ietf-ice-trickle] 3571 Ivov, E., Rescorla, E., Uberti, J., and P. Saint-Andre, 3572 "Trickle ICE: Incremental Provisioning of Candidates for 3573 the Interactive Connectivity Establishment (ICE) 3574 Protocol". 3576 [I-D.ietf-mmusic-msid] 3577 Alvestrand, H., "Cross Session Stream Identification in 3578 the Session Description Protocol", draft-ietf-mmusic- 3579 msid-01 (work in progress), August 2013. 3581 [I-D.ietf-mmusic-rid] 3582 Thatcher, P., Zanaty, M., Nandakumar, S., Burman, B., 3583 Roach, A., and B. Campen, "RTP Payload Format 3584 Constraints", draft-ietf-mmusic-rid-04 (work in progress), 3585 February 2016. 3587 [I-D.ietf-mmusic-sctp-sdp] 3588 Loreto, S. and G. Camarillo, "Stream Control Transmission 3589 Protocol (SCTP)-Based Media Transport in the Session 3590 Description Protocol (SDP)", draft-ietf-mmusic-sctp-sdp-04 3591 (work in progress), June 2013. 3593 [I-D.ietf-mmusic-sdp-bundle-negotiation] 3594 Holmberg, C., Alvestrand, H., and C. Jennings, 3595 "Multiplexing Negotiation Using Session Description 3596 Protocol (SDP) Port Numbers", draft-ietf-mmusic-sdp- 3597 bundle-negotiation-04 (work in progress), June 2013. 3599 [I-D.ietf-mmusic-sdp-mux-attributes] 3600 Nandakumar, S., "A Framework for SDP Attributes when 3601 Multiplexing", draft-ietf-mmusic-sdp-mux-attributes-01 3602 (work in progress), February 2014. 3604 [I-D.ietf-mmusic-sdp-simulcast] 3605 Burman, B., Westerlund, M., Nandakumar, S., and M. Zanaty, 3606 "Using Simulcast in SDP and RTP Sessions", draft-ietf- 3607 mmusic-sdp-simulcast-04 (work in progress), February 2016. 3609 [I-D.ietf-rtcweb-audio] 3610 Valin, J. and C. Bran, "WebRTC Audio Codec and Processing 3611 Requirements", draft-ietf-rtcweb-audio-02 (work in 3612 progress), August 2013. 3614 [I-D.ietf-rtcweb-fec] 3615 Uberti, J., "WebRTC Forward Error Correction 3616 Requirements", draft-ietf-rtcweb-fec-00 (work in 3617 progress), February 2015. 3619 [I-D.ietf-rtcweb-rtp-usage] 3620 Perkins, C., Westerlund, M., and J. Ott, "Web Real-Time 3621 Communication (WebRTC): Media Transport and Use of RTP", 3622 draft-ietf-rtcweb-rtp-usage-09 (work in progress), 3623 September 2013. 3625 [I-D.ietf-rtcweb-security] 3626 Rescorla, E., "Security Considerations for WebRTC", draft- 3627 ietf-rtcweb-security-06 (work in progress), January 2014. 3629 [I-D.ietf-rtcweb-security-arch] 3630 Rescorla, E., "WebRTC Security Architecture", draft-ietf- 3631 rtcweb-security-arch-09 (work in progress), February 2014. 3633 [I-D.ietf-rtcweb-video] 3634 Roach, A., "WebRTC Video Processing and Codec 3635 Requirements", draft-ietf-rtcweb-video-00 (work in 3636 progress), July 2014. 3638 [I-D.nandakumar-mmusic-proto-iana-registration] 3639 Nandakumar, S., "IANA registration of SDP 'proto' 3640 attribute for transporting RTP Media over TCP under 3641 various RTP profiles.", September 2014. 3643 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 3644 Requirement Levels", BCP 14, RFC 2119, March 1997. 3646 [RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, 3647 A., Peterson, J., Sparks, R., Handley, M., and E. 3648 Schooler, "SIP: Session Initiation Protocol", RFC 3261, 3649 June 2002. 3651 [RFC3264] Rosenberg, J. and H. Schulzrinne, "An Offer/Answer Model 3652 with Session Description Protocol (SDP)", RFC 3264, June 3653 2002. 3655 [RFC3552] Rescorla, E. and B. Korver, "Guidelines for Writing RFC 3656 Text on Security Considerations", BCP 72, RFC 3552, July 3657 2003. 3659 [RFC3605] Huitema, C., "Real Time Control Protocol (RTCP) attribute 3660 in Session Description Protocol (SDP)", RFC 3605, October 3661 2003. 3663 [RFC3890] Westerlund, M., "A Transport Independent Bandwidth 3664 Modifier for the Session Description Protocol (SDP)", 3665 RFC 3890, DOI 10.17487/RFC3890, September 2004, 3666 . 3668 [RFC4145] Yon, D. and G. Camarillo, "TCP-Based Media Transport in 3669 the Session Description Protocol (SDP)", RFC 4145, 3670 September 2005. 3672 [RFC4566] Handley, M., Jacobson, V., and C. Perkins, "SDP: Session 3673 Description Protocol", RFC 4566, July 2006. 3675 [RFC4572] Lennox, J., "Connection-Oriented Media Transport over the 3676 Transport Layer Security (TLS) Protocol in the Session 3677 Description Protocol (SDP)", RFC 4572, July 2006. 3679 [RFC4585] Ott, J., Wenger, S., Sato, N., Burmeister, C., and J. Rey, 3680 "Extended RTP Profile for Real-time Transport Control 3681 Protocol (RTCP)-Based Feedback (RTP/AVPF)", RFC 4585, July 3682 2006. 3684 [RFC5245] Rosenberg, J., "Interactive Connectivity Establishment 3685 (ICE): A Protocol for Network Address Translator (NAT) 3686 Traversal for Offer/Answer Protocols", RFC 5245, April 3687 2010. 3689 [RFC5285] Singer, D. and H. Desineni, "A General Mechanism for RTP 3690 Header Extensions", RFC 5285, July 2008. 3692 [RFC5761] Perkins, C. and M. Westerlund, "Multiplexing RTP Data and 3693 Control Packets on a Single Port", RFC 5761, April 2010. 3695 [RFC5888] Camarillo, G. and H. Schulzrinne, "The Session Description 3696 Protocol (SDP) Grouping Framework", RFC 5888, June 2010. 3698 [RFC6236] Johansson, I. and K. Jung, "Negotiation of Generic Image 3699 Attributes in the Session Description Protocol (SDP)", 3700 RFC 6236, May 2011. 3702 [RFC6347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 3703 Security Version 1.2", RFC 6347, January 2012. 3705 [RFC6904] Lennox, J., "Encryption of Header Extensions in the Secure 3706 Real-time Transport Protocol (SRTP)", RFC 6904, April 3707 2013. 3709 11.2. Informative References 3711 [I-D.ietf-rtcweb-ip-handling] 3712 Uberti, J. and G. Shieh, "WebRTC IP Address Handling 3713 Recommendations", draft-ietf-rtcweb-ip-handling-01 (work 3714 in progress), March 2016. 3716 [I-D.nandakumar-rtcweb-sdp] 3717 Nandakumar, S. and C. Jennings, "SDP for the WebRTC", 3718 draft-nandakumar-rtcweb-sdp-02 (work in progress), July 3719 2013. 3721 [RFC3389] Zopf, R., "Real-time Transport Protocol (RTP) Payload for 3722 Comfort Noise (CN)", RFC 3389, September 2002. 3724 [RFC3556] Casner, S., "Session Description Protocol (SDP) Bandwidth 3725 Modifiers for RTP Control Protocol (RTCP) Bandwidth", 3726 RFC 3556, July 2003. 3728 [RFC3960] Camarillo, G. and H. Schulzrinne, "Early Media and Ringing 3729 Tone Generation in the Session Initiation Protocol (SIP)", 3730 RFC 3960, December 2004. 3732 [RFC4568] Andreasen, F., Baugher, M., and D. Wing, "Session 3733 Description Protocol (SDP) Security Descriptions for Media 3734 Streams", RFC 4568, July 2006. 3736 [RFC4588] Rey, J., Leon, D., Miyazaki, A., Varsa, V., and R. 3737 Hakenberg, "RTP Retransmission Payload Format", RFC 4588, 3738 July 2006. 3740 [RFC5506] Johansson, I. and M. Westerlund, "Support for Reduced-Size 3741 Real-Time Transport Control Protocol (RTCP): Opportunities 3742 and Consequences", RFC 5506, April 2009. 3744 [RFC5576] Lennox, J., Ott, J., and T. Schierl, "Source-Specific 3745 Media Attributes in the Session Description Protocol 3746 (SDP)", RFC 5576, June 2009. 3748 [RFC5763] Fischl, J., Tschofenig, H., and E. Rescorla, "Framework 3749 for Establishing a Secure Real-time Transport Protocol 3750 (SRTP) Security Context Using Datagram Transport Layer 3751 Security (DTLS)", RFC 5763, May 2010. 3753 [RFC5764] McGrew, D. and E. Rescorla, "Datagram Transport Layer 3754 Security (DTLS) Extension to Establish Keys for the Secure 3755 Real-time Transport Protocol (SRTP)", RFC 5764, May 2010. 3757 [RFC5956] Begen, A., "Forward Error Correction Grouping Semantics in 3758 the Session Description Protocol", RFC 5956, September 3759 2010. 3761 [RFC6464] Lennox, J., Ed., Ivov, E., and E. Marocco, "A Real-time 3762 Transport Protocol (RTP) Header Extension for Client-to- 3763 Mixer Audio Level Indication", RFC 6464, 3764 DOI 10.17487/RFC6464, December 2011, 3765 . 3767 [W3C.WD-webrtc-20140617] 3768 Bergkvist, A., Burnett, D., Narayanan, A., and C. 3769 Jennings, "WebRTC 1.0: Real-time Communication Between 3770 Browsers", World Wide Web Consortium WD WD-webrtc- 3771 20140617, June 2014, 3772 . 3774 Appendix A. Change log 3776 Note: This section will be removed by RFC Editor before publication. 3778 Changes in draft-15: 3780 o Clarify text around codecs offered in subsequent transactions to 3781 refer to what's been negotiated. 3783 o Rewrite LS handling text to indicate edge cases and that we're 3784 living with them. 3786 o Require that answerer reject m= lines when there are no codecs in 3787 common. 3789 o Enforce max-bundle on offer processing. 3791 o Fix TIAS formula to handle bits vs. kilobits. 3793 o Describe addTrack algorithm. 3795 o Clean up references. 3797 Changes in draft-14: 3799 o Added discussion of RtpTransceivers + RtpSenders + RtpReceivers, 3800 and how they interact with createOffer/createAnswer. 3802 o Removed obsolete OfferToReceiveX options. 3804 o Explained how addIceCandidate can be used for end-of-candidates. 3806 Changes in draft-13: 3808 o Clarified which SDP lines can be ignored. 3810 o Clarified how to handle various received attributes. 3812 o Revised how attributes should be generated for bundled m= lines. 3814 o Remove unused references. 3816 o Remove text advocating use of unilateral PTs. 3818 o Trigger an ICE restart even if the ICE candidate policy is being 3819 made more strict. 3821 o Remove the 'public' ICE candidate policy. 3823 o Move open issues/TODOs into GitHub issues. 3825 o Split local/remote description accessors into current/pending. 3827 o Clarify a=imageattr handling. 3829 o Add more detail on VoiceActivityDetection handling. 3831 o Reference draft-shieh-rtcweb-ip-handling. 3833 o Make it clear when an ICE restart should occur. 3835 o Resolve reference TODOs. 3837 o Remove MSID semantics. 3839 o ice-options are now at session level. 3841 o Default RTCP mux policy is now 'require'. 3843 Changes in draft-12: 3845 o Filled in sections on applying local and remote descriptions. 3847 o Discussed downscaling and upscaling to fulfill imageattr 3848 requirements. 3850 o Updated what SDP can be modified by the application. 3852 o Updated to latest datachannel SDP. 3854 o Allowed multiple fingerprint lines. 3856 o Switched back to IPv4 for dummy candidates. 3858 o Added additional clarity on ICE default candidates. 3860 Changes in draft-11: 3862 o Clarified handling of RTP CNAMEs. 3864 o Updated what SDP lines should be processed or ignored. 3866 o Specified how a=imageattr should be used. 3868 Changes in draft-10: 3870 o TODO 3872 Changes in draft-09: 3874 o Don't return null for {local,remote}Description after close(). 3876 o Changed TCP/TLS to UDP/DTLS in RTP profile names. 3878 o Separate out bundle and mux policy. 3880 o Added specific references to FEC mechanisms. 3882 o Added canTrickle mechanism. 3884 o Added section on subsequent answers and, answer options. 3886 o Added text defining set{Local,Remote}Description behavior. 3888 Changes in draft-08: 3890 o Added new example section and removed old examples in appendix. 3892 o Fixed field handling. 3894 o Added text describing a=rtcp attribute. 3896 o Reworked handling of OfferToReceiveAudio and OfferToReceiveVideo 3897 per discussion at IETF 90. 3899 o Reworked trickle ICE handling and its impact on m= and c= lines 3900 per discussion at interim. 3902 o Added max-bundle-and-rtcp-mux policy. 3904 o Added description of maxptime handling. 3906 o Updated ICE candidate pool default to 0. 3908 o Resolved open issues around AppID/receiver-ID. 3910 o Reworked and expanded how changes to the ICE configuration are 3911 handled. 3913 o Some reference updates. 3915 o Editorial clarification. 3917 Changes in draft-07: 3919 o Expanded discussion of VAD and Opus DTX. 3921 o Added a security considerations section. 3923 o Rewrote the section on modifying SDP to require implementations to 3924 clearly indicate whether any given modification is allowed. 3926 o Clarified impact of IceRestart on CreateOffer in local-offer 3927 state. 3929 o Guidance on whether attributes should be defined at the media 3930 level or the session level. 3932 o Renamed "default" bundle policy to "balanced". 3934 o Removed default ICE candidate pool size and clarify how it works. 3936 o Defined a canonical order for assignment of MSTs to m= lines. 3938 o Removed discussion of rehydration. 3940 o Added Eric Rescorla as a draft editor. 3942 o Cleaned up references. 3944 o Editorial cleanup 3946 Changes in draft-06: 3948 o Reworked handling of m= line recycling. 3950 o Added handling of BUNDLE and bundle-only. 3952 o Clarified handling of rollback. 3954 o Added text describing the ICE Candidate Pool and its behavior. 3956 o Allowed OfferToReceiveX to create multiple recvonly m= sections. 3958 Changes in draft-05: 3960 o Fixed several issues identified in the createOffer/Answer sections 3961 during document review. 3963 o Updated references. 3965 Changes in draft-04: 3967 o Filled in sections on createOffer and createAnswer. 3969 o Added SDP examples. 3971 o Fixed references. 3973 Changes in draft-03: 3975 o Added text describing relationship to W3C specification 3977 Changes in draft-02: 3979 o Converted from nroff 3981 o Removed comparisons to old approaches abandoned by the working 3982 group 3984 o Removed stuff that has moved to W3C specification 3985 o Align SDP handling with W3C draft 3987 o Clarified section on forking. 3989 Changes in draft-01: 3991 o Added diagrams for architecture and state machine. 3993 o Added sections on forking and rehydration. 3995 o Clarified meaning of "pranswer" and "answer". 3997 o Reworked how ICE restarts and media directions are controlled. 3999 o Added list of parameters that can be changed in a description. 4001 o Updated suggested API and examples to match latest thinking. 4003 o Suggested API and examples have been moved to an appendix. 4005 Changes in draft -00: 4007 o Migrated from draft-uberti-rtcweb-jsep-02. 4009 Authors' Addresses 4011 Justin Uberti 4012 Google 4013 747 6th St S 4014 Kirkland, WA 98033 4015 USA 4017 Email: justin@uberti.name 4019 Cullen Jennings 4020 Cisco 4021 170 West Tasman Drive 4022 San Jose, CA 95134 4023 USA 4025 Email: fluffy@iii.ca 4026 Eric Rescorla (editor) 4027 Mozilla 4028 331 Evelyn Ave 4029 Mountain View, CA 94041 4030 USA 4032 Email: ekr@rtfm.com