--- 1/draft-ietf-rtcweb-jsep-15.txt 2016-09-20 12:15:56.385097269 -0700 +++ 2/draft-ietf-rtcweb-jsep-16.txt 2016-09-20 12:15:56.553101524 -0700 @@ -1,21 +1,21 @@ Network Working Group J. Uberti Internet-Draft Google Intended status: Standards Track C. Jennings -Expires: January 8, 2017 Cisco +Expires: March 24, 2017 Cisco E. Rescorla, Ed. Mozilla - July 7, 2016 + September 20, 2016 Javascript Session Establishment Protocol - draft-ietf-rtcweb-jsep-15 + draft-ietf-rtcweb-jsep-16 Abstract This document describes the mechanisms for allowing a Javascript application to control the signaling plane of a multimedia session via the interface specified in the W3C RTCPeerConnection API, and discusses how this relates to existing signaling protocols. Status of This Memo @@ -25,21 +25,21 @@ Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at http://datatracker.ietf.org/drafts/current/. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." - This Internet-Draft will expire on January 8, 2017. + This Internet-Draft will expire on March 24, 2017. Copyright Notice Copyright (c) 2016 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents @@ -63,84 +63,85 @@ 3.4.1. RtpTransceivers . . . . . . . . . . . . . . . . . . . 10 3.4.2. RtpSenders . . . . . . . . . . . . . . . . . . . . . 11 3.4.3. RtpReceivers . . . . . . . . . . . . . . . . . . . . 11 3.5. ICE . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3.5.1. ICE Gathering Overview . . . . . . . . . . . . . . . 11 3.5.2. ICE Candidate Trickling . . . . . . . . . . . . . . . 12 3.5.2.1. ICE Candidate Format . . . . . . . . . . . . . . 12 3.5.3. ICE Candidate Policy . . . . . . . . . . . . . . . . 13 3.5.4. ICE Candidate Pool . . . . . . . . . . . . . . . . . 14 3.6. Video Size Negotiation . . . . . . . . . . . . . . . . . 14 - 3.6.1. Creating an imageattr Attribute . . . . . . . . . . . 14 + 3.6.1. Creating an imageattr Attribute . . . . . . . . . . . 15 3.6.2. Interpreting an imageattr Attribute . . . . . . . . . 16 - 3.7. Interactions With Forking . . . . . . . . . . . . . . . . 17 - 3.7.1. Sequential Forking . . . . . . . . . . . . . . . . . 17 - 3.7.2. Parallel Forking . . . . . . . . . . . . . . . . . . 18 - 4. Interface . . . . . . . . . . . . . . . . . . . . . . . . . . 19 - 4.1. Methods . . . . . . . . . . . . . . . . . . . . . . . . . 19 - 4.1.1. Constructor . . . . . . . . . . . . . . . . . . . . . 19 - 4.1.2. addTrack . . . . . . . . . . . . . . . . . . . . . . 21 - 4.1.3. addTransceiver . . . . . . . . . . . . . . . . . . . 21 - 4.1.4. createDataChannel . . . . . . . . . . . . . . . . . . 21 - 4.1.5. createOffer . . . . . . . . . . . . . . . . . . . . . 21 - 4.1.6. createAnswer . . . . . . . . . . . . . . . . . . . . 22 - 4.1.7. SessionDescriptionType . . . . . . . . . . . . . . . 23 - 4.1.7.1. Use of Provisional Answers . . . . . . . . . . . 24 - 4.1.7.2. Rollback . . . . . . . . . . . . . . . . . . . . 24 - 4.1.8. setLocalDescription . . . . . . . . . . . . . . . . . 25 - 4.1.9. setRemoteDescription . . . . . . . . . . . . . . . . 26 - 4.1.10. currentLocalDescription . . . . . . . . . . . . . . . 26 - 4.1.11. pendingLocalDescription . . . . . . . . . . . . . . . 27 - 4.1.12. currentRemoteDescription . . . . . . . . . . . . . . 27 - 4.1.13. pendingRemoteDescription . . . . . . . . . . . . . . 27 - 4.1.14. canTrickleIceCandidates . . . . . . . . . . . . . . . 27 - 4.1.15. setConfiguration . . . . . . . . . . . . . . . . . . 28 - 4.1.16. addIceCandidate . . . . . . . . . . . . . . . . . . . 29 - 5. SDP Interaction Procedures . . . . . . . . . . . . . . . . . 29 - 5.1. Requirements Overview . . . . . . . . . . . . . . . . . . 29 - 5.1.1. Implementation Requirements . . . . . . . . . . . . . 29 - 5.1.2. Usage Requirements . . . . . . . . . . . . . . . . . 31 - 5.1.3. Profile Names and Interoperability . . . . . . . . . 31 - 5.2. Constructing an Offer . . . . . . . . . . . . . . . . . . 32 - 5.2.1. Initial Offers . . . . . . . . . . . . . . . . . . . 32 - 5.2.2. Subsequent Offers . . . . . . . . . . . . . . . . . . 38 - 5.2.3. Options Handling . . . . . . . . . . . . . . . . . . 41 - 5.2.3.1. IceRestart . . . . . . . . . . . . . . . . . . . 41 - 5.2.3.2. VoiceActivityDetection . . . . . . . . . . . . . 41 - 5.2.4. Direction Attribute in Offers . . . . . . . . . . . . 42 - 5.3. Generating an Answer . . . . . . . . . . . . . . . . . . 42 - 5.3.1. Initial Answers . . . . . . . . . . . . . . . . . . . 42 - 5.3.2. Subsequent Answers . . . . . . . . . . . . . . . . . 47 - 5.3.3. Options Handling . . . . . . . . . . . . . . . . . . 48 - 5.3.3.1. VoiceActivityDetection . . . . . . . . . . . . . 48 - 5.3.4. Direction Attribute in Answers . . . . . . . . . . . 48 - 5.4. Processing a Local Description . . . . . . . . . . . . . 49 - 5.5. Processing a Remote Description . . . . . . . . . . . . . 49 - 5.6. Parsing a Session Description . . . . . . . . . . . . . . 50 - 5.6.1. Session-Level Parsing . . . . . . . . . . . . . . . . 51 - 5.6.2. Media Section Parsing . . . . . . . . . . . . . . . . 53 - 5.6.3. Semantics Verification . . . . . . . . . . . . . . . 55 - 5.7. Applying a Local Description . . . . . . . . . . . . . . 56 - 5.8. Applying a Remote Description . . . . . . . . . . . . . . 58 - 5.9. Applying an Answer . . . . . . . . . . . . . . . . . . . 60 - 6. Configurable SDP Parameters . . . . . . . . . . . . . . . . . 62 - 7. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 63 - 7.1. Simple Example . . . . . . . . . . . . . . . . . . . . . 63 - 7.2. Normal Examples . . . . . . . . . . . . . . . . . . . . . 67 - 8. Security Considerations . . . . . . . . . . . . . . . . . . . 77 - 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 77 - 10. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 78 - 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 78 - 11.1. Normative References . . . . . . . . . . . . . . . . . . 78 - 11.2. Informative References . . . . . . . . . . . . . . . . . 81 - Appendix A. Change log . . . . . . . . . . . . . . . . . . . . . 82 - Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 87 + 3.7. Simulcast . . . . . . . . . . . . . . . . . . . . . . . . 17 + 3.8. Interactions With Forking . . . . . . . . . . . . . . . . 18 + 3.8.1. Sequential Forking . . . . . . . . . . . . . . . . . 18 + 3.8.2. Parallel Forking . . . . . . . . . . . . . . . . . . 19 + 4. Interface . . . . . . . . . . . . . . . . . . . . . . . . . . 20 + 4.1. Methods . . . . . . . . . . . . . . . . . . . . . . . . . 20 + 4.1.1. Constructor . . . . . . . . . . . . . . . . . . . . . 20 + 4.1.2. addTrack . . . . . . . . . . . . . . . . . . . . . . 22 + 4.1.3. addTransceiver . . . . . . . . . . . . . . . . . . . 22 + 4.1.4. createDataChannel . . . . . . . . . . . . . . . . . . 22 + 4.1.5. createOffer . . . . . . . . . . . . . . . . . . . . . 23 + 4.1.6. createAnswer . . . . . . . . . . . . . . . . . . . . 24 + 4.1.7. SessionDescriptionType . . . . . . . . . . . . . . . 24 + 4.1.7.1. Use of Provisional Answers . . . . . . . . . . . 25 + 4.1.7.2. Rollback . . . . . . . . . . . . . . . . . . . . 26 + 4.1.8. setLocalDescription . . . . . . . . . . . . . . . . . 27 + 4.1.9. setRemoteDescription . . . . . . . . . . . . . . . . 28 + 4.1.10. currentLocalDescription . . . . . . . . . . . . . . . 28 + 4.1.11. pendingLocalDescription . . . . . . . . . . . . . . . 28 + 4.1.12. currentRemoteDescription . . . . . . . . . . . . . . 28 + 4.1.13. pendingRemoteDescription . . . . . . . . . . . . . . 29 + 4.1.14. canTrickleIceCandidates . . . . . . . . . . . . . . . 29 + 4.1.15. setConfiguration . . . . . . . . . . . . . . . . . . 29 + 4.1.16. addIceCandidate . . . . . . . . . . . . . . . . . . . 30 + 5. SDP Interaction Procedures . . . . . . . . . . . . . . . . . 31 + 5.1. Requirements Overview . . . . . . . . . . . . . . . . . . 31 + 5.1.1. Implementation Requirements . . . . . . . . . . . . . 31 + 5.1.2. Usage Requirements . . . . . . . . . . . . . . . . . 33 + 5.1.3. Profile Names and Interoperability . . . . . . . . . 33 + 5.2. Constructing an Offer . . . . . . . . . . . . . . . . . . 34 + 5.2.1. Initial Offers . . . . . . . . . . . . . . . . . . . 34 + 5.2.2. Subsequent Offers . . . . . . . . . . . . . . . . . . 40 + 5.2.3. Options Handling . . . . . . . . . . . . . . . . . . 43 + 5.2.3.1. IceRestart . . . . . . . . . . . . . . . . . . . 43 + 5.2.3.2. VoiceActivityDetection . . . . . . . . . . . . . 44 + 5.3. Generating an Answer . . . . . . . . . . . . . . . . . . 44 + 5.3.1. Initial Answers . . . . . . . . . . . . . . . . . . . 44 + 5.3.2. Subsequent Answers . . . . . . . . . . . . . . . . . 49 + 5.3.3. Options Handling . . . . . . . . . . . . . . . . . . 50 + 5.3.3.1. VoiceActivityDetection . . . . . . . . . . . . . 50 + 5.4. Modifying an Offer or Answer . . . . . . . . . . . . . . 50 + 5.5. Processing a Local Description . . . . . . . . . . . . . 51 + 5.6. Processing a Remote Description . . . . . . . . . . . . . 51 + 5.7. Parsing a Session Description . . . . . . . . . . . . . . 52 + 5.7.1. Session-Level Parsing . . . . . . . . . . . . . . . . 53 + 5.7.2. Media Section Parsing . . . . . . . . . . . . . . . . 55 + 5.7.3. Semantics Verification . . . . . . . . . . . . . . . 57 + 5.8. Applying a Local Description . . . . . . . . . . . . . . 58 + 5.9. Applying a Remote Description . . . . . . . . . . . . . . 60 + 5.10. Applying an Answer . . . . . . . . . . . . . . . . . . . 63 + 6. Demux placeholder . . . . . . . . . . . . . . . . . . . . . . 64 + 7. Processing RTP packets . . . . . . . . . . . . . . . . . . . 64 + 8. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 66 + 8.1. Simple Example . . . . . . . . . . . . . . . . . . . . . 66 + 8.2. Normal Examples . . . . . . . . . . . . . . . . . . . . . 70 + 9. Security Considerations . . . . . . . . . . . . . . . . . . . 80 + 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 80 + 11. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 81 + 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 81 + 12.1. Normative References . . . . . . . . . . . . . . . . . . 81 + 12.2. Informative References . . . . . . . . . . . . . . . . . 84 + Appendix A. Change log . . . . . . . . . . . . . . . . . . . . . 85 + Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 91 1. Introduction This document describes how the W3C WEBRTC RTCPeerConnection interface [W3C.WD-webrtc-20140617] is used to control the setup, management and teardown of a multimedia session. 1.1. General Design of JSEP The thinking behind WebRTC call setup has been to fully specify and @@ -560,24 +561,27 @@ candidate:1 1 UDP 1694498815 192.0.2.33 10000 typ host The IceCandidate object also contains fields to indicate which m= line it should be associated with. The m= line can be identified in one of two ways; either by a m= line index, or a MID. The m= line index is a zero-based index, with index N referring to the N+1th m= line in the SDP sent by the entity which sent the IceCandidate. The MID uses the "media stream identification" attribute, as defined in [RFC5888], Section 4, to identify the m= line. JSEP implementations - creating an ICE Candidate object MUST populate both of these fields. - Implementations receiving an ICE Candidate object MUST use the MID if - present, or the m= line index, if not (as it could have come from a - non-JSEP endpoint). + creating an ICE Candidate object MUST populate both of these fields, + using the MID of the associated RtpTransceiver object (which may be + locally generated by the answerer when interacting with a non-JSEP + remote endpoint that does not support the MID attribute, as discussed + in Section 5.9 below). Implementations receiving an ICE Candidate + object MUST use the MID if present, or the m= line index, if not (the + non-JSEP remote endpoint case). 3.5.3. ICE Candidate Policy Typically, when gathering ICE candidates, the browser will gather all possible forms of initial candidates - host, server reflexive, and relay. However, in certain cases, applications may want to have more specific control over the gathering process, due to privacy or related concerns. For example, one may want to suppress the use of host candidates, to avoid exposing information about the local network, or go as far as only using relay candidates, to leak as @@ -744,21 +746,74 @@ upscaling. The sender SHOULD NOT upscale in other cases, even if the policy permits it. Upscaling MUST NOT change the track aspect ratio. If there is no appropriate and permitted scaling mechanism that allows the received size limits to be satisfied, the sender MUST NOT transmit the track. In the special case of receiving a maximum resolution of [0, 0], as described above, the sender MUST NOT transmit the track. -3.7. Interactions With Forking +3.7. Simulcast + + JSEP supports simulcast of a MediaStreamTrack, where multiple + encodings of the source media can be transmitted within the context + of a single m= section. The current JSEP API is designed to allow + applications to send simulcasted media but only to receive a single + encoding. This allows for multi-user scenarios where each sending + client sends multiple encodings to a server, which then, for each + receiving client, chooses the appropriate encoding to forward. + + Applications request support for simulcast by configuring multiple + encodings on an RTPSender, which, upon generation of an offer or + answer, are indicated in SDP markings on the corresponding m= + section, as described below. Receivers that understand simulcast and + are willing to receive it will also include SDP markings to indicate + their support, and JSEP endpoints will use these markings to + determine whether simulcast is permitted for a given RTPSender. If + simulcast support is not negotiated, the RTPSender will only use the + first configured encoding. + + Note that the exact simulcast parameters are up to the sending + application. While the aforementioned SDP markings are provided to + ensure the remote side can receive and demux multiple simulcast + encodings, the specific resolutions and bitrates to be used for each + encoding are purely a send-side decision in JSEP. + + JSEP currently does not provide an API to configure receipt of + simulcast. This means that if simulcast is offered by the remote + endpoint, the answer generated by a JSEP endpoint will not indicate + support for receipt of simulcast, and as such the remote endpoint + will only send a single encoding per m= section. In addition, when + the JSEP endpoint is the answerer, the permitted encodings for the + RTPSender must be consistent with the offer, but this information is + currently not surfaced through any API. This means that established + simulcast streams will continue to work through a received re-offer, + but setting up initial simulcast by way of a received offer requires + out-of-band signaling or SDP inspection. Future versions of this + specification may add additional APIs to provide this control. + + When using JSEP to transmit multiple encodings from a RTPSender, the + techniques from [I-D.ietf-mmusic-sdp-simulcast] and + + [I-D.ietf-mmusic-rid] are used. Specifically, when multiple + encodings have been configured for a RTPSender, the m= section for + the RTPSender will include an "a=simulcast" attribute, as defined in + [I-D.ietf-mmusic-sdp-simulcast], Section 6.2, with a "send" simulcast + stream description that lists each desired encoding, and no "recv" + simulcast stream description. The m= section will also include an + "a=rid" attribute for each encoding, as specfied in + [I-D.ietf-mmusic-rid], Section 4; the use of RID identifiers allows + the individual encodings to be disambiguated even though they are all + part of the same m= section. + +3.8. Interactions With Forking Some call signaling systems allow various types of forking where an SDP Offer may be provided to more than one device. For example, SIP [RFC3261] defines both a "Parallel Search" and "Sequential Search". Although these are primarily signaling level issues that are outside the scope of JSEP, they do have some impact on the configuration of the media plane that is relevant. When forking happens at the signaling layer, the Javascript application responsible for the signaling needs to make the decisions about what media should be sent or received at any point of time, as well as which remote endpoint it @@ -766,21 +821,21 @@ can make the RTP and media perform as required by the application. The basic operations that the applications can have the media engine do are: o Start exchanging media with a given remote peer, but keep all the resources reserved in the offer. o Start exchanging media with a given remote peer, and free any resources in the offer that are not being used. -3.7.1. Sequential Forking +3.8.1. Sequential Forking Sequential forking involves a call being dispatched to multiple remote callees, where each callee can accept the call, but only one active session ever exists at a time; no mixing of received media is performed. JSEP handles sequential forking well, allowing the application to easily control the policy for selecting the desired remote endpoint. When an answer arrives from one of the callees, the application can choose to apply it either as a provisional answer, leaving open the @@ -790,21 +845,21 @@ In a "first-one-wins" situation, the first answer will be applied as a final answer, and the application will reject any subsequent answers. In SIP parlance, this would be ACK + BYE. In a "last-one-wins" situation, all answers would be applied as provisional answers, and any previous call leg will be terminated. At some point, the application will end the setup process, perhaps with a timer; at this point, the application could reapply the pending remote description as a final answer. -3.7.2. Parallel Forking +3.8.2. Parallel Forking Parallel forking involves a call being dispatched to multiple remote callees, where each callee can accept the call, and multiple simultaneous active signaling sessions can be established as a result. If multiple callees send media at the same time, the possibilities for handling this are described in Section 3.1 of [RFC3960]. Most SIP devices today only support exchanging media with a single device at a time, and do not try to mix multiple early media audio sources, as that could result in a confusing situation. For example, consider having a European ringback tone mixed together with @@ -907,23 +962,23 @@ max-compat: All media sections will contain transport parameters; none will be marked as bundle-only. This policy will allow all streams to be received by non-bundle-aware endpoints, but require separate candidates to be gathered for each media stream. max-bundle: Only the first media section will contain transport parameters; all streams other than the first will be marked as bundle-only. This policy aims to minimize candidate gathering and maximize multiplexing, at the cost of less compatibility with - legacy endpoints. When acting as answerer, if there if no bundle - group in the offer, the implementation will reject all but the - first m= section. + legacy endpoints. When acting as answerer, the implementation + will reject any m= sections other than the first m= section, + unless they are in the same bundle group as that m= section. As it provides the best tradeoff between performance and compatibility with legacy endpoints, the default bundle policy MUST be set to "balanced". The application can specify its preferred policy regarding use of RTP/RTCP multiplexing [RFC5761] using one of the following policies: negotiate: The browser will gather both RTP and RTCP candidates but also will offer "a=rtcp-mux", thus allowing for compatibility with @@ -945,25 +1000,46 @@ tracks in the same MediaStream, so that they can be added to the same "LS" group when creating an offer or answer. addTrack attempts to minimize the number of transceivers as follows: The track will be attached to the first compatible transceiver (of the same media type) which has never had a direction of "sendonly" or "sendrecv". If no such transceiver exists, then one will be constructed as described in Section 4.1.3. 4.1.3. addTransceiver - [TODO] + The addTransceiver method adds a new RTPTransceiver to the + PeerConnection. If a MediaStreamTrack argument is provided, then the + transceiver will be configured with that media type and the track + will be attached to the transceiver. Otherwise, the application MUST + explicitly specify the type; this mode is useful for creating + recvonly transceivers as well as for creating transceivers to which a + track can be attached at some later point. + + At the time of creation, the application can also specify a + transceiver direction attribute, a set of MediaStreams which the + transceiver is associated with (allowing LS group assignments), and a + set of encodings for the media (used for simulcast as described in + Section 3.7). 4.1.4. createDataChannel - [TODO] + The createDataChannel method creates a new data channel and attaches + it to the PeerConnection. If no data channel currently exists for + this PeerConnection, then a new offer/answer exchange is required. + All data channels on a given PeerConnection share the same SCTP/DTLS + association and therefore the same m= section, so subsequent creation + of data channels does not have any impact on the JSEP state. + + The createDataChannel method also includes a number of arguments + which are used by the PeerConnection (e.g., maxPacketLifetime) but + are not reflected in the SDP and do not affect the JSEP state. 4.1.5. createOffer The createOffer method generates a blob of SDP that contains a [RFC3264] offer with the supported configurations for the session, including descriptions of the media added to this PeerConnection, the codec/RTP/RTCP options supported by this implementation, and any candidates that have been gathered by the ICE Agent. An options parameter may be supplied to provide additional control over the generated offer. This options parameter allows an application to @@ -1068,21 +1144,21 @@ can use some discretion on whether an answer should be applied as provisional or final, and can change the type of the session description as needed. For example, in a serial forking scenario, an application may receive multiple "final" answers, one from each remote endpoint. The application could choose to accept the initial answers as provisional answers, and only apply an answer as final when it receives one that meets its criteria (e.g. a live user instead of voicemail). "rollback" is a special session description type implying that the - state machine should be rolled back to the previous state, as + state machine should be rolled back to the previous stable state, as described in Section 4.1.7.2. The contents MUST be empty. 4.1.7.1. Use of Provisional Answers Most web applications will not need to create answers using the "pranswer" type. While it is good practice to send an immediate response to an "offer", in order to warm up the session transport and prevent media clipping, the preferred handling for a web application would be to create and send an "inactive" final answer immediately after receiving the offer. Later, when the called user actually @@ -1129,21 +1205,21 @@ that were allocated by the abandoned local description are discarded; any media that is received will be processed according to the previous local and remote descriptions. Rollback can only be used to cancel proposed changes; there is no support for rolling back from a stable state to a previous stable state. Note that this implies that once the answerer has performed setLocalDescription with his answer, this cannot be rolled back. A rollback will disassociate any RtpTransceivers that were associated with m= sections by the application of the rolled-back session - description (see Section 5.8 and Section 5.7). This means that some + description (see Section 5.9 and Section 5.8). This means that some RtpTransceivers that were previously associated will no longer be associated with any m= section; in such cases, the value of the RtpTransceiver's mid attribute MUST be set to null. RtpTransceivers that were created by applying a remote offer that was subsequently rolled back MUST be removed. However, a RtpTransceiver MUST NOT be removed if the RtpTransceiver's RtpSender was activated by the addTrack method. This is so that an application may call addTrack, then call setRemoteDescription with an offer, then roll back that offer, then call createOffer and have a m= section for the added track appear in the generated offer. @@ -1307,27 +1383,42 @@ This call may result in a change to the state of the ICE Agent, and may result in a change to media state if it results in connectivity being established. 4.1.16. addIceCandidate The addIceCandidate method provides a remote candidate to the ICE Agent, which, if parsed successfully, will be added to the current and/or pending remote description according to the rules defined for - Trickle ICE. If the MID, m-line index, or candidate string provided - in the ICE candidate is invalid, an error is generated. Connectivity - checks will be sent to the new candidate. + Trickle ICE. The pair of MID and ufrag is used to determine the m= + section and ICE candidate generation to which the candidate belongs. + If the MID is not present, the m= line index is used to look up the + locally generated MID (see Section 5.9), which is used in place of a + supplied MID. If these values or the candidate string are invalid, + an error is generated. + + The purpose of the ufrag is to resolve ambiguities when trickle ICE + is in progress during an ICE restart. If the ufrag is absent, the + candidate MUST be assumed to belong to the most recently applied + remote description. Connectivity checks will be sent to the new + candidate. This method can also be used to provide an end-of-candidates - indication (as defined in [I-D.ietf-ice-trickle]) to the ICE Agent - for all media descriptions in the last remote description. + indication to the ICE Agent, as defined in [I-D.ietf-ice-trickle]). + The MID and ufrag are used as described above to determine the m= + section and ICE generation for which candidate gathering is complete. + If the ufrag is not present, then the end-of-candidates indication + MUST be assumed to apply to the relevant m= section in the most + recently applied remote description. If neither the MID nor the m= + index is present, then the indication MUST be assumed to apply to all + m= sections in the most recently applied remote description. This call will result in a change to the state of the ICE Agent, and may result in a change to media state if it results in connectivity being established. 5. SDP Interaction Procedures This section describes the specific procedures to be followed when creating and parsing SDP objects. @@ -1485,29 +1575,29 @@ The first step in generating an initial offer is to generate session- level attributes, as specified in [RFC4566], Section 5. Specifically: o The first SDP line MUST be "v=0", as specified in [RFC4566], Section 5.1 o The second SDP line MUST be an "o=" line, as specified in [RFC4566], Section 5.2. The value of the field SHOULD - be "-". The value of the field SHOULD be a - cryptographically random number. To ensure uniqueness, this - number SHOULD be at least 64 bits long. The value of the field SHOULD be zero. The value of the - tuple SHOULD be set to a non- - meaningful address, such as IN IP4 0.0.0.0, to prevent leaking the - local address in this field. As mentioned in [RFC4566], the - entire o= line needs to be unique, but selecting a random number - for is sufficient to accomplish this. + be "-". [RFC3264] requires that the be representable as + a 64-bit signed integer. It is RECOMMENDED that the be + generated as a 64-bit quantity with the high bit being sent to + zero and the remaining 63 bits being cryptographically random. + The value of the tuple + SHOULD be set to a non-meaningful address, such as IN IP4 0.0.0.0, + to prevent leaking the local address in this field. As mentioned + in [RFC4566], the entire o= line needs to be unique, but selecting + a random number for is sufficient to accomplish this. o The third SDP line MUST be a "s=" line, as specified in [RFC4566], Section 5.3; to match the "o=" line, a single dash SHOULD be used as the session name, e.g. "s=-". Note that this differs from the advice in [RFC4566] which proposes a single space, but as both "o=" and "s=" are meaningless, having the same meaningless value seems clearer. o Session Information ("i="), URI ("u="), Email Address ("e="), Phone Number ("p="), Bandwidth ("b="), Repeat Times ("r="), and @@ -1519,38 +1609,36 @@ o A "t=" line MUST be added, as specified in [RFC4566], Section 5.9; both and SHOULD be set to zero, e.g. "t=0 0". o An "a=ice-options" line with the "trickle" option MUST be added, as specified in [I-D.ietf-ice-trickle], Section 4. The next step is to generate m= sections, as specified in [RFC4566] Section 5.14. An m= section is generated for each RtpTransceiver - that has been added to the PeerConnection via the addTrack, - addTransceiver, and setRemoteDescription methods. [[OPEN ISSUE: move - discussion of setRemoteDescription to the subsequent-offer section.]] - This is done in the order that their associated RtpTransceivers were - added to the PeerConnection and excludes RtpTranscievers that are - stopped and not associated with an m= section (either due to an m= - section being recycled or an RtpTransceiver having been stopped - before being associated with an m= section) . + that has been added to the PeerConnection. This is done in the order + that their associated RtpTransceivers were added to the + PeerConnection and excludes RtpTransceivers that are stopped and not + associated with an m= section (either due to an m= section being + recycled or an RtpTransceiver having been stopped before being + associated with an m= section) . Each m= section, provided it is not marked as bundle-only, MUST generate a unique set of ICE credentials and gather its own unique set of ICE candidates. Bundle-only m= sections MUST NOT contain any ICE credentials and MUST NOT gather any candidates. - For DTLS, all m= sections MUST use the certificate for the identity - that has been specified for the PeerConnection; as a result, they - MUST all have the same [RFC4572] fingerprint value, or this value - MUST be a session-level attribute. + For DTLS, all m= sections MUST use all the certificate(s) that have + been specified for the PeerConnection; as a result, they MUST all + have the same [I-D.ietf-mmusic-4572-update] fingerprint value(s), or + these value(s) MUST be session-level attributes. Each m= section should be generated as specified in [RFC4566], Section 5.14. For the m= line itself, the following rules MUST be followed: o The port value is set to the port of the default ICE candidate for this m= section, but given that no candidates have yet been gathered, the "dummy" port value of 9 (Discard) MUST be used, as indicated in [I-D.ietf-ice-trickle], Section 5.1. @@ -1570,22 +1658,22 @@ o An "a=mid" line, as specified in [RFC5888], Section 4. When generating mid values, it is RECOMMENDED that the values be 3 bytes or less, to allow them to efficiently fit into the RTP header extension defined in [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 11. o An "a=rtcp" line, as specified in [RFC3605], Section 2.1, containing the dummy value "9 IN IP4 0.0.0.0", because no candidates have yet been gathered. - o A direction attribute for the associated RtpTransceiver as - described by Section 5.2.4. + o A direction attribute which is the same as that of the associated + transceiver. o For each supported codec, "a=rtpmap" and "a=fmtp" lines, as specified in [RFC4566], Section 6. The audio and video codecs that MUST be supported are specified in [I-D.ietf-rtcweb-audio](see Section 3) and [I-D.ietf-rtcweb-video](see Section 5). o If this m= section is for media with configurable frame sizes, e.g. audio, an "a=maxptime" line, indicating the smallest of the maximum supported frame sizes out of all codecs included above, as @@ -1603,31 +1691,33 @@ o For each supported FEC mechanism, "a=rtpmap" and "a=fmtp" lines, as specified in [RFC4566], Section 6. The FEC mechanisms that MUST be supported are specified in [I-D.ietf-rtcweb-fec], Section 6, and specific usage for each media type is outlined in Sections 4 and 5. o "a=ice-ufrag" and "a=ice-pwd" lines, as specified in [RFC5245], Section 15.4. - o An "a=fingerprint" line for each of the endpoint's certificates, - as specified in [RFC4572], Section 5; the digest algorithm used - for the fingerprint MUST match that used in the certificate - signature. + o One or more "a=fingerprint" line(s) for each of the endpoint's + certificates, as specified in [I-D.ietf-mmusic-4572-update]. o An "a=setup" line, as specified in [RFC4145], Section 4, and clarified for use in DTLS-SRTP scenarios in [RFC5763], Section 5. The role value in the offer MUST be "actpass". o An "a=rtcp-mux" line, as specified in [RFC5761], Section 5.1.1. + o An "a=rtcp-mux-only" line, as specified in + [I-D.ietf-mmusic-mux-exclusive] Section 4, if and only if the RTP/ + RTCP multiplexing policy is "require". + o An "a=rtcp-rsize" line, as specified in [RFC5506], Section 5. o For each supported RTP header extension, an "a=extmap" line, as specified in [RFC5285], Section 5. The list of header extensions that SHOULD/MUST be supported is specified in [I-D.ietf-rtcweb-rtp-usage], Section 5.2. Any header extensions that require encryption MUST be specified as indicated in [RFC6904], Section 4. o For each supported RTCP feedback mechanism, an "a=rtcp-fb" @@ -1760,23 +1848,38 @@ When createOffer is called a second (or later) time, or is called after a local description has already been installed, the processing is somewhat different than for an initial offer. If the initial offer was not applied using setLocalDescription, meaning the PeerConnection is still in the "stable" state, the steps for generating an initial offer should be followed, subject to the following restriction: o The fields of the "o=" line MUST stay the same except for the - field, which MUST increment if the session - description changes in any way, including the addition of ICE - candidates. + field, which MUST increment by one on each call + to createOffer if the offer might differ from the output of the + previous call to createOffer; implementations MAY opt to increment + on every call. The value of the generated + is independent of the of the + current local description; in particular, in the case where the + current version is N, an offer is created with version N+1, and + then that offer is rolled back so that the current version is + again N, the next generated offer will still have version N+2. + + Note that if the application creates an offer by reading + currentLocalDescription instead of calling createOffer, the returned + SDP may be different than when setLocalDescription was originally + called, due to the addition of gathered ICE candidates, but the + will not have changed. There are no known + scenarios in which this causes problems, but if this is a concern, + the solution is simply to use createOffer to ensure a unique + . If the initial offer was applied using setLocalDescription, but an answer from the remote side has not yet been applied, meaning the PeerConnection is still in the "local-offer" state, an offer is generated by following the steps in the "stable" state above, along with these exceptions: o The "s=" and "t=" lines MUST stay the same. o If any RtpTransceiver has been added, and there exists an m= @@ -1874,20 +1977,23 @@ o The RTP header extensions MUST only include those that are present in the most recent answer. o The RTCP feedback extensions MUST only include those that are present in the most recent answer. o The "a=rtcp-mux" line MUST only be added if present in the most recent answer. + o The "a=rtcp-mux-only" line MUST only be added if present in the + most recent answer. + o The "a=rtcp-rsize" line MUST only be added if present in the most recent answer. The "a=group:BUNDLE" attribute MUST include the mid identifiers specified in the bundle group in the most recent answer, minus any m= sections that have been marked as rejected, plus any newly added or re-enabled m= sections. In other words, the bundle attribute must contain all m= sections that were previously bundled, as long as they are still alive, as well as any new m= sections. @@ -1937,35 +2043,20 @@ Note that setting the "VoiceActivityDetection" parameter when generating an offer is a request to receive audio with silence suppression. It has no impact on whether the local endpoint does silence suppression for the audio it sends. The "VoiceActivityDetection" option does not have any impact on the setting of the "vad" value in the signaling of the client to mixer audio level header extension described in [RFC6464], Section 4. -5.2.4. Direction Attribute in Offers - - [RFC3264] direction attributes (defined in Section 6.1) in offers are - chosen according to the states of the RtpSender and RtpReceiver of a - given RtpTransceiver, as follows: - - +-----------+-------------+-----------------+ - | RtpSender | RtpReceiver | offer direction | - +-----------+-------------+-----------------+ - | active | active | sendrecv | - | active | inactive | sendonly | - | inactive | active | recvonly | - | inactive | inactive | inactive | - +-----------+-------------+-----------------+ - 5.3. Generating an Answer When createAnswer is called, a new SDP description must be created that is compatible with the supplied remote description as well as the requirements specified in [I-D.ietf-rtcweb-rtp-usage]. The exact details of this process are explained below. 5.3.1. Initial Answers When createAnswer is called for the first time after a remote @@ -2000,39 +2091,40 @@ ignored and no corresponding "LS" group generated. The next step is to generate m= sections for each m= section that is present in the remote offer, as specified in [RFC3264], Section 6. For the purposes of this discussion, any session-level attributes in the offer that are also valid as media-level attributes SHALL be considered to be present in each m= section. The next step is to go through each offered m= section. Each offered m= section will have an associated RtpTransceiver, as described in - Section 5.8. If there are more RtpTransceivers than there are m= + Section 5.9. If there are more RtpTransceivers than there are m= sections, the unmatched RtpTransceivers will need to be associated in a subsequent offer. For each offered m= section, if any of the following conditions are true, the corresponding m= section in the answer MUST be marked as rejected by setting the port in the m= line to zero, as indicated in [RFC3264], Section 6., and further processing for this m= section can be skipped: o The associated RtpTransceiver has been stopped. o No supported codec is present in the offer. - o The bundle policy is "max-bundle", the m= section is not in a - bundle group, and this is not the first m= section. + o The bundle policy is "max-bundle", and this is not the first m= + section or in the same bundle group as the first m= section. - o The bundle policy is "balanced", the m= section is not in a bundle - group, and this is not the first m= section for this media type. + o The bundle policy is "balanced", and this is not the first m= + section for this media type or in the same bundle group as the + first m= section for this media type. o The RTP/RTCP multiplexing policy is "require" and the m= section doesn't contain an "a=rtcp-mux" attribute. Otherwise, each m= section in the answer should then be generated as specified in [RFC3264], Section 6.1. For the m= line itself, the following rules must be followed: o The port value would normally be set to the port of the default ICE candidate for this m= section, but given that no candidates @@ -2053,22 +2145,22 @@ section MUST include the following: o If and only if present in the offer, an "a=mid" line, as specified in [RFC5888], Section 9.1. The "mid" value MUST match that specified in the offer. o An "a=rtcp" line, as specified in [RFC3605], Section 2.1, containing the dummy value "9 IN IP4 0.0.0.0", because no candidates have yet been gathered. - o A direction attribute for the associated RtpTransceiver described - by Section 5.3.4. + o A direction attribute which is the same as that of the associated + transceiver. o For each supported codec that is present in the offer, "a=rtpmap" and "a=fmtp" lines, as specified in [RFC4566], Section 6, and [RFC3264], Section 6.1. The audio and video codecs that MUST be supported are specified in [I-D.ietf-rtcweb-audio](see Section 3) and [I-D.ietf-rtcweb-video](see Section 5). o If this m= section is for media with configurable frame sizes, e.g. audio, an "a=maxptime" line, indicating the smallest of the maximum supported frame sizes out of all codecs included above, as @@ -2086,36 +2178,37 @@ o For each supported FEC mechanism, "a=rtpmap" and "a=fmtp" lines, as specified in [RFC4566], Section 6. The FEC mechanisms that MUST be supported are specified in [I-D.ietf-rtcweb-fec], Section 6, and specific usage for each media type is outlined in Sections 4 and 5. o "a=ice-ufrag" and "a=ice-pwd" lines, as specified in [RFC5245], Section 15.4. - o An "a=fingerprint" line for each of the endpoint's certificates, - as specified in [RFC4572], Section 5; the digest algorithm used - for the fingerprint MUST match that used in the certificate - signature. + o One or more "a=fingerprint" line(s) for each of the endpoint's + certificates, as specified in [I-D.ietf-mmusic-4572-update]. o An "a=setup" line, as specified in [RFC4145], Section 4, and clarified for use in DTLS-SRTP scenarios in [RFC5763], Section 5. The role value in the answer MUST be "active" or "passive"; the "active" role is RECOMMENDED. o If present in the offer, an "a=rtcp-mux" line, as specified in [RFC5761], Section 5.1.1. If the "require" RTCP multiplexing policy is set and no "a=rtcp-mux" line is present in the offer, then the m=line MUST be marked as rejected by setting the port in the m= line to zero, as indicated in [RFC3264], Section 6. + o If present in the offer, an "a=rtcp-mux-only" line, as specified + in [I-D.ietf-mmusic-mux-exclusive], Section 4.3. + o If present in the offer, an "a=rtcp-rsize" line, as specified in [RFC5506], Section 5. o For each supported RTP header extension that is present in the offer, an "a=extmap" line, as specified in [RFC5285], Section 5. The list of header extensions that SHOULD/MUST be supported is specified in [I-D.ietf-rtcweb-rtp-usage], Section 5.2. Any header extensions that require encryption MUST be specified as indicated in [RFC6904], Section 4. @@ -2244,90 +2337,97 @@ Silence suppression in the answer is handled as described in Section 5.2.3.2, with one exception: if support for silence suppression was not indicated in the offer, the VoiceActivityDetection parameter has no effect, and the answer should be generated as if VoiceActivityDetection was set to false. This is done on a per-codec basis (e.g., if the offerer somehow offered support for CN but set "usedtx=0" for Opus, setting VoiceActivityDetection to true would result in an answer with CN codecs and "usedtx=0"). -5.3.4. Direction Attribute in Answers +5.4. Modifying an Offer or Answer - [RFC3264] direction attributes (defined in Section 6.1) in answers - are chosen according to the direction attribute in the remote offer - and the states of the RtpSender and RtpReceiver of the corresponding - RtpTransceiver, as follows: + The SDP returned from createOffer or createAnswer MUST NOT be changed + before passing it to setLocalDescription. If precise control over + the SDP is needed, the aformentioned createOffer/createAnswer options + or RTPSender APIs MUST be used. - +-----------------+-----------+-------------+------------------+ - | offer direction | RtpSender | RtpReceiver | answer direction | - +-----------------+-----------+-------------+------------------+ - | sendrecv | active | active | sendrecv | - | sendrecv | active | inactive | sendonly | - | sendrecv | inactive | active | recvonly | - | sendrecv | inactive | inactive | inactive | - | sendonly | * | active | recvonly | - | sendonly | * | inactive | inactive | - | recvonly | active | * | sendonly | - | recvonly | inactive | * | inactive | - | inactive | * | * | inactive | - +-----------------+-----------+-------------+------------------+ + Note that the application MAY modify the SDP to reduce the + capabilities in the offer it sends to the far side (post- + setLocalDescription) or the offer that it installs from the far side + (pre-setRemoteDescription), as long as it remains a valid SDP offer + and specifies a subset of what was in the original offer. This is + safe because the answer is not permitted to expand capabilities, and + therefore will just respond to what is present in the offer. -5.4. Processing a Local Description + The application SHOULD NOT modify the SDP in the answer it transmits, + as the answer contains the negotiated capabilities, and this can + cause the two sides to have different ideas about what exactly was + negotiated. + + As always, the application is solely responsible for what it sends to + the other party, and all incoming SDP will be processed by the + browser to the extent of its capabilities. It is an error to assume + that all SDP is well-formed; however, one should be able to assume + that any implementation of this specification will be able to + process, as a remote offer or answer, unmodified SDP coming from any + other implementation of this specification. + +5.5. Processing a Local Description When a SessionDescription is supplied to setLocalDescription, the following steps MUST be performed: o First, the type of the SessionDescription is checked against the current state of the PeerConnection: * If the type is "offer", the PeerConnection state MUST be either "stable" or "have-local-offer". * If the type is "pranswer" or "answer", the PeerConnection state MUST be either "have-remote-offer" or "have-local-pranswer". o If the type is not correct for the current state, processing MUST stop and an error MUST be returned. o Next, the SessionDescription is parsed into a data structure, as - described in the Section 5.6 section below. If parsing fails for + described in the Section 5.7 section below. If parsing fails for any reason, processing MUST stop and an error MUST be returned. o Finally, the parsed SessionDescription is applied as described in - the Section 5.7 section below. + the Section 5.8 section below. -5.5. Processing a Remote Description +5.6. Processing a Remote Description When a SessionDescription is supplied to setRemoteDescription, the following steps MUST be performed: o First, the type of the SessionDescription is checked against the current state of the PeerConnection: * If the type is "offer", the PeerConnection state MUST be either "stable" or "have-remote-offer". * If the type is "pranswer" or "answer", the PeerConnection state MUST be either "have-local-offer" or "have-remote-pranswer". o If the type is not correct for the current state, processing MUST stop and an error MUST be returned. o Next, the SessionDescription is parsed into a data structure, as - described in the Section 5.6 section below. If parsing fails for + described in the Section 5.7 section below. If parsing fails for any reason, processing MUST stop and an error MUST be returned. o Finally, the parsed SessionDescription is applied as described in - the Section 5.8 section below. + the Section 5.9 section below. -5.6. Parsing a Session Description +5.7. Parsing a Session Description When a SessionDescription of any type is supplied to setLocal/ RemoteDescription, the implementation must parse it and reject it if it is invalid. The exact details of this process are explained below. The SDP contained in the session description object consists of a sequence of text lines, each containing a key-value expression, as described in [RFC4566], Section 5. The SDP is read, line-by-line, and converted to a data structure that contains the deserialized @@ -2368,21 +2468,21 @@ Table 1: SDP ABNF References [TODO: ensure that every line is listed below.] If the line is not well-formed, or cannot be parsed as described, the parser MUST stop with an error and reject the session description. This ensures that implementations do not accidentally misinterpret ambiguous SDP. -5.6.1. Session-Level Parsing +5.7.1. Session-Level Parsing First, the session-level lines are checked and parsed. These lines MUST occur in a specific order, and with a specific syntax, as defined in [RFC4566], Section 5. Note that while the specific line types (e.g. "v=", "c=") MUST occur in the defined order, lines of the same type (typically "a=") can occur in any order, and their ordering is not meaningful. For non-attribute (non-"a=") lines, their sequencing, syntax, and semantics, are checked, as mentioned above. The following lines are @@ -2434,27 +2534,24 @@ o Any "a=fingerprint" lines are parsed as specified in [RFC4572], Section 5, and the set of fingerprint and algorithm values is stored. o If present, a single "a=setup" line is parsed as specified in [RFC4145], Section 4, and the setup value is stored. o Any "a=extmap" lines are parsed as specified in [RFC5285], Section 5, and their values are stored. - o TODO: identity, rtcp-rsize, rtcp-mux, and any other attributes - valid at session level. - Once all the session-level lines have been parsed, processing continues with the lines in media sections. -5.6.2. Media Section Parsing +5.7.2. Media Section Parsing Like the session-level lines, the media session lines MUST occur in the specific order and with the specific syntax defined in [RFC4566], Section 5. The "m=" line itself MUST be parsed as described in [RFC4566], Section 5.14, and the media, port, proto, and fmt values stored. Following the "m=" line, specific processing MUST be applied for the following non-attribute lines: @@ -2513,26 +2610,31 @@ o Any "a=extmap" attributes MUST be parsed as specified in [RFC5285], Section 5, and their values stored. o Any "a=rtcp-fb" attributes MUST be parsed as specified in [RFC4585], Section 4.2., and their values stored. o If present, a single "a=rtcp-mux" attribute MUST be parsed as specified in [RFC5761], Section 5.1.1, and its presence or absence flagged and stored. + o If present, a single "a=rtcp-mux-only" attribute MUST be parsed as + specified in [I-D.ietf-mmusic-mux-exclusive], Section 3, and its + presence or absence flagged and stored. + o If present, a single "a=rtcp-rsize" attribute MUST be parsed as specified in [RFC5506], Section 5, and its presence or absence flagged and stored. o If present, a single "a=rtcp" attribute MUST be parsed as - specified in [RFC3605], Section 2.1, but its value is ignored. + specified in [RFC3605], Section 2.1, but its value is ignored, as + this information is superfluous when using ICE. o If present, a single "a=msid" attribute MUST be parsed as specified in [I-D.ietf-mmusic-msid], Section 3.2, and its value stored. o Any "a=candidate" attributes MUST be parsed as specified in [RFC5245], Section 4.3, and their values stored. o Any "a=remote-candidates" attributes MUST be parsed as specified in [RFC5245], Section 4.3, but their values are ignored. @@ -2559,21 +2661,21 @@ protocol value stored. o An "a=sctp-port" attribute MUST be present, and it MUST be parsed as specified in [I-D.ietf-mmusic-sctp-sdp], Section 5.2, and the value stored. o If present, a single "a=max-message-size" attribute MUST be parsed as specified in [I-D.ietf-mmusic-sctp-sdp], Section 6, and the value stored. Otherwise, use the specified default. -5.6.3. Semantics Verification +5.7.3. Semantics Verification Assuming parsing completes successfully, the parsed description is then evaluated to ensure internal consistency as well as proper support for mandatory features. Specifically, the following checks are performed: o For each m= section, valid values for each of the mandatory-to-use features enumerated in Section 5.1.2 MUST be present. These values MAY either be present at the media level, or inherited from the session level. @@ -2601,43 +2703,45 @@ o The session description must follow the rules defined in [RFC3264], Section 6, including the requirement that the number of m= sections MUST exactly match the number of m= sections in the associated offer. o For each m= section, the media type and protocol values MUST exactly match the media type and protocol values in the corresponding m= section in the associated offer. -5.7. Applying a Local Description +5.8. Applying a Local Description The following steps are performed at the media engine level to apply a local description. - First, the parsed parameters are checked to ensure that any - modifications performed fall within those explicitly permitted by - Section 6; otherwise, processing MUST stop and an error MUST be - returned. + First, the parsed parameters are checked to ensure that they have not + been altered after their generation in createOffer/createAnswer, as + discussed in Section 5.4; otherwise, processing MUST stop and an + error MUST be returned. Next, media sections are processed. For each media section, the following steps MUST be performed; if any parameters are out of bounds, or cannot be applied, processing MUST stop and an error MUST be returned. o If this media section is new, begin gathering candidates for it, as defined in [RFC5245], Section 4.1.1, unless it has been marked as bundle-only. - o Or, if the ICE ufrag and password values have changed, trigger the - ICE Agent to start an ICE restart and begin gathering new - candidates for the media section, as defined in [RFC5245], - Section 9.1.1.1, unless it has been marked as bundle-only. + o Or, if the ICE ufrag and password values have changed, and it has + not been marked as bundle-only, trigger the ICE Agent to start an + ICE restart, and begin gathering new candidates for the media + section as described in [RFC5245], Section 9.1.1.1. If this + description is an answer, also start checks on that media section + as defined in [RFC5245], Section 9.3.1.1. o If the media section proto value indicates use of RTP: * If there is no RtpTransceiver associated with this m= section (which should only happen when applying an offer), find one and associate it with this m= section according to the following steps: + Find the RtpTransceiver that corresponds to the m= section with the same MID in the created offer. @@ -2645,45 +2749,45 @@ + Set the value of the RtpTransceiver's mid attribute to the MID of the m= section. * If RTCP mux is indicated, prepare to demux RTP and RTCP from the RTP ICE component, as specified in [RFC5761], Section 5.1.1. If RTCP mux is not indicated, but was indicated in a previous description, this MUST result in an error. * For each specified RTP header extension, establish a mapping between the extension ID and URI, as described in section 6 of - [RFC5285]. If any indicated RTP header extension is unknown, - this MUST result in an error. + [RFC5285]. If any indicated RTP header extension is not + supported, this MUST result in an error. * If the MID header extension is supported, prepare to demux RTP data intended for this media section based on the MID header extension, as described in [I-D.ietf-mmusic-msid], Section 3.2. - * For each specified payload type, establish a mapping between - the payload type ID and the actual media format, as described - in [RFC3264]. If any indicated payload type is unknown, this - MUST result in an error. + * For each specified media format, establish a mapping between + the payload type and the actual media format, as described in + [RFC3264], Section 6.1. If any indicated media format is not + supported, this MUST result in an error. * For each specified "rtx" media format, establish a mapping between the RTX payload type and its associated primary payload type, as described in [RFC4588], Sections 8.6 and 8.7. If any referenced primary payload types are not present, this MUST result in an error. * If the directional attribute is of type "sendrecv" or "recvonly", enable receipt and decoding of media. Finally, if this description is of type "pranswer" or "answer", - follow the processing defined in the Section 5.9 section below. + follow the processing defined in the Section 5.10 section below. -5.8. Applying a Remote Description +5.9. Applying a Remote Description If the answer contains any "a=ice-options" attributes where "trickle" is listed as an attribute, update the PeerConnection canTrickle property to be true. Otherwise, set this property to false. The following steps are performed at the media engine level to apply a remote description. The following steps MUST be performed for attributes at the session level; if any parameters are out of bounds, or cannot be applied, @@ -2699,41 +2803,44 @@ o For any specified "RR" or "RS" bandwidth values, handle as specified in [RFC3556], Section 2. o Any "AS" bandwidth value MUST be ignored, as the meaning of this construct at the session level is not well defined. For each media section, the following steps MUST be performed; if any parameters are out of bounds, or cannot be applied, processing MUST stop and an error MUST be returned. - o If the description is of type "offer", and the ICE ufrag or - password changed from the previous remote description, as - described in Section 9.1.1.1 of [RFC5245], mark that an ICE - restart is needed. + o If the ICE ufrag or password changed from the previous remote + description, then an ICE restart is needed, as described in + Section 9.1.1.1 of [RFC5245] If the description is of type + "offer", mark that an ICE restart is needed. If the description + is of type "answer" and the current local description is also an + ICE restart, then signal the ICE agent to begin checks as + described in Section 9.3.1.1 of [RFC5245]. An answer MUST change + the ufrag and password in an answer if and only if ICE is + restarting, as described in Section 9.2.1.1 of [RFC5245]. o Configure the ICE components associated with this media section to use the supplied ICE remote ufrag and password for their connectivity checks. o Pair any supplied ICE candidates with any gathered local candidates, as described in Section 5.7 of [RFC5245] and start connectivity checks with the appropriate credentials. o If an "a=end-of-candidates" attribute is present, process the end- of-candidates indication as described in [I-D.ietf-ice-trickle] Section 11. o If the media section proto value indicates use of RTP: - * [TODO: header extensions] - * If the m= section is being recycled (see Section 5.2.2), dissociate the currently associated RtpTransceiver by setting its mid attribute to null. * If the m= section is not associated with any RtpTransceiver (possibly because it was dissociated in the previous step), either find an RtpTransceiver or create one according to the following steps: + If the m= section is sendrecv or recvonly, and there are @@ -2741,40 +2848,58 @@ PeerConnection by addTrack and are not associated with any m= section and are not stopped, find the first (according to the canonical order described in Section 5.2.1) such RtpTransceiver. + If no RtpTransceiver was found in the previous step, create one with an inactive RtpSender and active RtpReceiver. + Associate the found or created RtpTransceiver with the m= section by setting the value of the RtpTransceiver's mid - attribute to the MID of the m= section. + attribute to the MID of the m= section. If the m= section + does not include a MID (i.e., the remote side does not + support the MID extension), generate a value for the + RtpTransceiver mid attribute, following the guidance for + "a=mid" mentioned in Section 5.2.1. - * For each specified payload type that is also supported by the - local implementation, establish a mapping between the payload - type ID and the actual media format. [TODO - Justin to add - more to explain mapping.] If any indicated payload type is - unknown, it MUST be ignored. [TODO: should fail on answers] + * For each specified media format that is also supported by the + local implementation, establish a mapping between the specified + payload type and the media format, as described in [RFC3264], + Section 6.1. Specifically, this means that the implementation + records the payload type to be used in outgoing RTP packets + when sending each specified media format, as well as the + relative preference for each format that is indicated in their + ordering. If any indicated media format is not supported by + the local implementation, it MUST be ignored. * For each specified "rtx" media format, establish a mapping between the RTX payload type and its associated primary payload - type, as described in [RFC4588]. If any referenced primary - payload types are not present, this MUST result in an error. + type, as described in [RFC4588], Section 4. If any referenced + primary payload types are not present, this MUST result in an + error. * For each specified fmtp parameter that is supported by the - local implementation, enable them on the associated payload - types. + local implementation, enable them on the associated media + formats. + + * For each specified RTP header extension that is also supported + by the local implementation, establish a mapping between the + extension ID and URI, as described in [RFC5285], Section 5. + Specifically, this means that the implementation records the + extension ID to be used in outgoing RTP packets when sending + each specified header extension. If any indicated RTP header + extension is not supported by the local implementation, it MUST + be ignored. * For each specified RTCP feedback mechanism that is supported by - the local implementation, enable them on the associated payload - types. + the local implementation, enable them on the associated media + formats. * For any specified "TIAS" bandwidth value, set this value as a constraint on the maximum RTP bitrate to be used when sending media, as specified in [RFC3890]. If a "TIAS" value is not present, but an "AS" value is specified, generate a "TIAS" value using this formula: TIAS = AS * 1000 * 0.95 - 50 * 40 * 8 The 50 is based on 50 packets per second, the 40 is based on an @@ -2785,31 +2910,31 @@ * For any "RR" or "RS" bandwidth values, handle as specified in [RFC3556], Section 2. * Any specified "CT" bandwidth value MUST be ignored, as the meaning of this construct at the media level is not well defined. * [TODO: handling of CN, telephone-event, "red"] - * If the media section if of type audio: + * If the media section is of type audio: + For any specified "ptime" value, configure the available - payload types to use the specified packet size. If the - specified size is not supported for a payload type, use the + media formats to use the specified packet size. If the + specified size is not supported for a media format, use the next closest value instead. Finally, if this description is of type "pranswer" or "answer", - follow the processing defined in the Section 5.9 section below. + follow the processing defined in the Section 5.10 section below. -5.9. Applying an Answer +5.10. Applying an Answer In addition to the steps mentioned above for processing a local or remote description, the following steps are performed when processing a description of type "pranswer" or "answer". For each media section, the following steps MUST be performed: o If the media section has been rejected (i.e. port is set to zero in the answer), stop any reception or transmission of media for this section, and discard any associated ICE components, as @@ -2817,142 +2942,145 @@ o If the remote DTLS fingerprint has been changed, tear down the existing DTLS connection. o If no valid DTLS connection exists, prepare to start a DTLS connection, using the specified roles and fingerprints, on any underlying ICE components, once they are active. o If the media section proto value indicates use of RTP: + * If the media section references any media formats, RTP header + extensions, or RTCP feedback mechanisms that were not present + in the corresponding media section in the offer, this indicates + a negotiation problem and MUST result in an error. + * If the media section has RTCP mux enabled, discard any RTCP component, and begin or continue muxing RTCP over the RTP component, as specified in [RFC5761], Section 5.1.3. Otherwise, transmit RTCP over the RTCP component; if no RTCP component exists, because RTCP mux was previously enabled, this MUST result in an error. * If the media section has reduced-size RTCP enabled, configure the RTCP transmission for this media section to use reduced- size RTCP, as specified in [RFC5506]. + * [TODO: enable appropriate rtcp-fb mechanisms] * If the directional attribute in the answer is of type "sendrecv" or "sendonly", prepare to start transmitting media - using the specified primary SSRC and one of the selected - payload types, once the underlying transport layers have been - established. If RID values are specified, include the RID - header extension in the RTP streams, as indicated in - [I-D.ietf-mmusic-rid], Section 4). If simulcast is negotiated, - send the number of Source RTP Streams as specified in - [I-D.ietf-mmusic-sdp-simulcast], Section 6.2.2. If the - directional attribute is of type "recvonly" or "inactive", stop - transmitting RTP media, although RTCP should still be sent, as - described in [RFC3264], Section 5.1. + using the most preferred media format from the remote + description that is also present in the answer, as described in + [RFC3264], Sections 6.1 and 7, once the underlying transport + layers have been established. [TODO: add discusssion of + RED/FEC/RTX/CN] The payload type mapping from the remote + description is used to determine payload types for the outgoing + RTP streams. Any RTP header extensions that were negotiated + should be included in the outgoing RTP streams, using the + extension mapping from the remote description; if the RID + header extension has been negotiated, and RID values are + specified, include the RID header extension in the outgoing RTP + streams, as indicated in [I-D.ietf-mmusic-rid], Section 4). If + simulcast is negotiated, send the number of Source RTP Streams + as specified in [I-D.ietf-mmusic-sdp-simulcast], Section 6.2.2. + + * If the directional attribute is of type "recvonly" or + "inactive", stop transmitting RTP media, although RTCP should + still be sent, as described in [RFC3264], Section 5.1. o If the media section proto value indicates use of SCTP: * If no SCTP association yet exists, prepare to initiate a SCTP association over the associated ICE component and DTLS connection, using the local SCTP port value from the local description, and the remote SCTP port value from the remote description, as described in [I-D.ietf-mmusic-sctp-sdp], Section 10.2. If the answer contains valid bundle groups, discard any ICE components for the m= sections that will be bundled onto the primary ICE components in each bundle, and begin muxing these m= sections accordingly, as described in [I-D.ietf-mmusic-sdp-bundle-negotiation], Section 8.2. -6. Configurable SDP Parameters - - It is possible to change elements in the SDP returned from - createOffer before passing it to setLocalDescription. When an - implementation receives modified SDP it MUST either: - - o Accept the changes and adjust its behavior to match the SDP. - - o Reject the changes and return an error via the error callback. +6. Demux placeholder - Changes MUST NOT be silently ignored. + RTP demux algo goes here - The following elements of the session description MUST NOT be changed - between the createOffer and the setLocalDescription (or between the - createAnswer and the setLocalDescription), since they reflect - transport attributes that are solely under browser control, and the - browser MUST NOT honor an attempt to change them: +7. Processing RTP packets - o The number, type and port number of m= lines. + Note: The following algorithm does not yet have WG consensus but is + included here as something concrete for the working group to discuss. - o The generated MID attributes (a=mid). + When an RTP packet is received by a transport and passes SRTP + authentication, that packet needs to be routed to the correct + RtpReceiver. For each transport, the following steps MUST be + followed to prepare to route packets: - o The generated ICE credentials (a=ice-ufrag and a=ice-pwd). + Construct a table mapping MID to RtpReceiver for each RtpReceiver + configured to receive from this transport. - o The set of ICE candidates and their parameters (a=candidate). + Construct a table mapping SSRC to RtpReceiver for each RtpReceiver + configured to receive from this transport and for each SSRC that + RtpReceiver is configured to receive. Some of the SSRCs may be + presesnt in the m= section corresponding to that RtpReceiver in + the remote description. - o The DTLS fingerprint(s) (a=fingerprint). + Construct a table mapping payload type to RtpReceiver for each + RtpReceiver configured to receive from this transport and for each + payload type that RtpReceiver is configured to receive. The + payload types of a given RtpReceiver are found in the m= section + corresponding to that RtpReceiver in the local description. If + any payload type could map to more than one RtpReceiver, map to + the RtpReceiver whose m= section appears earliest in the local + description. - o The contents of bundle groups, bundle-only parameters, or "a=rtcp- - mux" parameters. + For each RTP packet received, the following steps MUST be followed to + route the packet: - The following modifications, if done by the browser to a description - between createOffer/createAnswer and the setLocalDescription, MUST be - honored by the browser: + If the packet has a MID and that MID is not in the table mapping + MID to RtpReceiver, drop the packet and stop. - o Remove or reorder codecs (m=) + If the packet has a MID and that MID is in the table mapping MID + to RtpReceiver, update the SSRC mapping table to include an entry + mapping the packet's SSRC to the RtpReceiver. - The following parameters may be controlled by options passed into - createOffer/createAnswer. As an open issue, these changes may also - be be performed by manipulating the SDP returned from createOffer/ - createAnswer, as indicated above, as long as the capabilities of the - endpoint are not exceeded (e.g. asking for a resolution greater than - what the endpoint can encode): + If the packet's SSRC is in the SSRC mapping table, route the + packet to the mapped RtpReceiver and stop. - o [[OPEN ISSUE: This is a placeholder for other modifications, which - we may continue adding as use cases appear.]] + If the packet's payload type is in the payload type table, update + the the SSRC mapping table to include an entry mapping the + packet's SSRC to the RtpReceiver. Deliver the packet to the + RtpReceiver and stop. - Implementations MAY choose to either honor or reject any elements not - listed in the above two categories, but must do so explicitly as - described at the beginning of this section. Note that future - standards may add new SDP elements to the list of elements which must - be accepted or rejected, but due to version skew, applications must - be prepared for implementations to accept changes which must be - rejected and vice versa. + Otherwise, drop the packet. - The application can also modify the SDP to reduce the capabilities in - the offer it sends to the far side or the offer that it installs from - the far side in any way the application sees fit, as long as it is a - valid SDP offer and specifies a subset of what was in the original - offer. This is safe because the answer is not permitted to expand - capabilities and therefore will just respond to what is actually in - the offer. + After packets are routed to the RtpReceiver, further processing of + the RTP packets is done at the RtpReceiver level. This includes + using [I-D.ietf-mmusic-rid] to determine which RTP streams depend on + or repair other RTP streams. - As always, the application is solely responsible for what it sends to - the other party, and all incoming SDP will be processed by the - browser to the extent of its capabilities. It is an error to assume - that all SDP is well-formed; however, one should be able to assume - that any implementation of this specification will be able to - process, as a remote offer or answer, unmodified SDP coming from any - other implementation of this specification. + As RtpTransceivers (and, thus, RtpReceivers) are added, removed, + stopped, or reconfigured, the tables above must also be updated. -7. Examples +8. Examples Note that this example section shows several SDP fragments. To format in 72 columns, some of the lines in SDP have been split into multiple lines, where leading whitespace indicates that a line is a continuation of the previous line. In addition, some blank lines have been added to improve readability but are not valid in SDP. More examples of SDP for WebRTC call flows can be found in [I-D.nandakumar-rtcweb-sdp]. -7.1. Simple Example +8.1. Simple Example This section shows a very simple example that sets up a minimal audio / video call between two browsers and does not use trickle ICE. The example in the following section provides a more realistic example of what would happen in a normal browser to browser connection. The flow shows Alice's browser initiating the session to Bob's browser. The messages from Alice's JS to Bob's JS are assumed to flow over some signaling protocol via a web server. The JS on both Alice's side and Bob's side waits for all candidates before sending @@ -3119,21 +3248,21 @@ a=setup:active a=rtcp-mux a=rtcp-rsize a=rtcp-fb:100 ccm fir a=rtcp-fb:100 nack a=rtcp-fb:100 nack pli a=ssrc:3229706345 cname:Q/NWs1ao1HmN4Xa5 a=ssrc:3229706346 cname:Q/NWs1ao1HmN4Xa5 a=ssrc-group:FID 3229706345 3229706346 -7.2. Normal Examples +8.2. Normal Examples This section shows a typical example of a session between two browsers setting up an audio channel and a data channel. Trickle ICE is used in full trickle mode with a bundle policy of max-bundle, an RTCP mux policy of require, and a single TURN server. Later, two video flows, one for the presenter and one for screen sharing, are added to the session. This example shows Alice's browser initiating the session to Bob's browser. The messages from Alice's JS to Bob's JS are assumed to flow over some signaling protocol via a web server. @@ -3509,82 +3640,90 @@ 19:E2:1C:3B:4B:9F:81:E6:B8:5C:F4:A5:A8:D8:73:04 :BB:05:2F:70:9F:04:A9:0E:05:E9:26:33:E8:70:88:A2 a=setup:passive a=rtcp-mux a=rtcp-rsize a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid a=rtcp-fb:100 ccm fir a=rtcp-fb:100 nack a=rtcp-fb:100 nack pli -8. Security Considerations +9. Security Considerations The IETF has published separate documents [I-D.ietf-rtcweb-security-arch] [I-D.ietf-rtcweb-security] describing the security architecture for WebRTC as a whole. The remainder of this section describes security considerations for this document. While formally the JSEP interface is an API, it is better to think of it is an Internet protocol, with the JS being untrustworthy from the perspective of the browser. Thus, the threat model of [RFC3552] applies. In particular, JS can call the API in any order and with any inputs, including malicious ones. This is particularly relevant when we consider the SDP which is passed to setLocalDescription(). While correct API usage requires that the application pass in SDP - which was derived from createOffer() or createAnswer() (perhaps - suitably modified as described in Section 6, there is no guarantee - that applications do so. The browser MUST be prepared for the JS to - pass in bogus data instead. + which was derived from createOffer() or createAnswer(), there is no + guarantee that applications do so. The browser MUST be prepared for + the JS to pass in bogus data instead. Conversely, the application programmer MUST recognize that the JS does not have complete control of browser behavior. One case that bears particular mention is that editing ICE candidates out of the SDP or suppressing trickled candidates does not have the expected behavior: implementations will still perform checks from those candidates even if they are not sent to the other side. Thus, for instance, it is not possible to prevent the remote peer from learning your public IP address by removing server reflexive candidates. Applications which wish to conceal their public IP address should instead configure the ICE agent to use only relay candidates. -9. IANA Considerations +10. IANA Considerations This document requires no actions from IANA. -10. Acknowledgements +11. Acknowledgements Significant text incorporated in the draft as well and review was provided by Peter Thatcher, Taylor Brandstetter, Harald Alvestrand and Suhas Nandakumar. Dan Burnett, Neil Stratford, Anant Narayanan, Andrew Hutton, Richard Ejzak, Adam Bergkvist and Matthew Kaufman all provided valuable feedback on this proposal. -11. References +12. References -11.1. Normative References +12.1. Normative References [I-D.ietf-avtext-rid] Roach, A., Nandakumar, S., and P. Thatcher, "RTP Stream Identifier (RID) Source Description (SDES)", draft-ietf- avtext-rid-00 (work in progress), February 2016. [I-D.ietf-ice-trickle] Ivov, E., Rescorla, E., Uberti, J., and P. Saint-Andre, "Trickle ICE: Incremental Provisioning of Candidates for the Interactive Connectivity Establishment (ICE) Protocol". + [I-D.ietf-mmusic-4572-update] + Holmberg, C., "Updates to RFC 4572", draft-ietf-mmusic- + 4572-update-05 (work in progress), June 2016. + [I-D.ietf-mmusic-msid] Alvestrand, H., "Cross Session Stream Identification in the Session Description Protocol", draft-ietf-mmusic- msid-01 (work in progress), August 2013. + [I-D.ietf-mmusic-mux-exclusive] + Holmberg, C., "Indicating Exclusive Support of RTP/RTCP + Multiplexing using SDP", draft-ietf-mmusic-mux- + exclusive-08 (work in progress), June 2016. + [I-D.ietf-mmusic-rid] Thatcher, P., Zanaty, M., Nandakumar, S., Burman, B., Roach, A., and B. Campen, "RTP Payload Format Constraints", draft-ietf-mmusic-rid-04 (work in progress), February 2016. [I-D.ietf-mmusic-sctp-sdp] Loreto, S. and G. Camarillo, "Stream Control Transmission Protocol (SCTP)-Based Media Transport in the Session Description Protocol (SDP)", draft-ietf-mmusic-sctp-sdp-04 @@ -3699,21 +3838,21 @@ Attributes in the Session Description Protocol (SDP)", RFC 6236, May 2011. [RFC6347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer Security Version 1.2", RFC 6347, January 2012. [RFC6904] Lennox, J., "Encryption of Header Extensions in the Secure Real-time Transport Protocol (SRTP)", RFC 6904, April 2013. -11.2. Informative References +12.2. Informative References [I-D.ietf-rtcweb-ip-handling] Uberti, J. and G. Shieh, "WebRTC IP Address Handling Recommendations", draft-ietf-rtcweb-ip-handling-01 (work in progress), March 2016. [I-D.nandakumar-rtcweb-sdp] Nandakumar, S. and C. Jennings, "SDP for the WebRTC", draft-nandakumar-rtcweb-sdp-02 (work in progress), July 2013. @@ -3768,20 +3907,55 @@ Bergkvist, A., Burnett, D., Narayanan, A., and C. Jennings, "WebRTC 1.0: Real-time Communication Between Browsers", World Wide Web Consortium WD WD-webrtc- 20140617, June 2014, . Appendix A. Change log Note: This section will be removed by RFC Editor before publication. + Changes in draft-16: + + o Update addIceCandidate to indicate ICE generation and allow per-m= + section end-of-candidates. + + o Update fingerprint handling to use draft-ietf-mmusic-4572-update. + + o Update text around SDP processing of RTP header extensions and + payload formats. + + o Add sections on simulcast, addTransceiver, and createDataChannel. + + o Clarify text to ensure that the session ID is a positive 63 bit + integer. + + o Clarify SDP processing for direction indication. + + o Describe SDP processing for rtcp-mux-only. + + o Specify how SDP session version in o= line. + + o Require that when doing an re-offer, the capabilities of the new + session are mostly required to be a subset of the previously + negotiated session. + + o Clarified ICE restart interaction with bundle-only. + + o Remove support for changing SDP before calling + setLocalDescription. + + o Specify algorithm for demuxing RTP based on MID, PT, and SSRC. + + o Clarify rules for rejecting m= lines when bundle policy is + balanced or max-bundle. + Changes in draft-15: o Clarify text around codecs offered in subsequent transactions to refer to what's been negotiated. o Rewrite LS handling text to indicate edge cases and that we're living with them. o Require that answerer reject m= lines when there are no codecs in common. @@ -4011,22 +4185,22 @@ Justin Uberti Google 747 6th St S Kirkland, WA 98033 USA Email: justin@uberti.name Cullen Jennings Cisco - 170 West Tasman Drive - San Jose, CA 95134 - USA + 400 3rd Avenue SW + Calgary, AB T2P 4H2 + Canada Email: fluffy@iii.ca Eric Rescorla (editor) Mozilla 331 Evelyn Ave Mountain View, CA 94041 USA Email: ekr@rtfm.com