--- 1/draft-ietf-rtcweb-jsep-08.txt 2015-03-09 17:14:47.591285489 -0700 +++ 2/draft-ietf-rtcweb-jsep-09.txt 2015-03-09 17:14:47.723288739 -0700 @@ -1,21 +1,21 @@ Network Working Group J. Uberti Internet-Draft Google Intended status: Standards Track C. Jennings -Expires: April 30, 2015 Cisco +Expires: September 10, 2015 Cisco E. Rescorla, Ed. Mozilla - October 27, 2014 + March 9, 2015 Javascript Session Establishment Protocol - draft-ietf-rtcweb-jsep-08 + draft-ietf-rtcweb-jsep-09 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,25 +25,25 @@ 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 April 30, 2015. + This Internet-Draft will expire on September 10, 2015. Copyright Notice - Copyright (c) 2014 IETF Trust and the persons identified as the + Copyright (c) 2015 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 carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as @@ -73,57 +73,62 @@ 4.1.1. Constructor . . . . . . . . . . . . . . . . . . . . . 15 4.1.2. createOffer . . . . . . . . . . . . . . . . . . . . . 17 4.1.3. createAnswer . . . . . . . . . . . . . . . . . . . . 18 4.1.4. SessionDescriptionType . . . . . . . . . . . . . . . 19 4.1.4.1. Use of Provisional Answers . . . . . . . . . . . 20 4.1.4.2. Rollback . . . . . . . . . . . . . . . . . . . . 20 4.1.5. setLocalDescription . . . . . . . . . . . . . . . . . 21 4.1.6. setRemoteDescription . . . . . . . . . . . . . . . . 21 4.1.7. localDescription . . . . . . . . . . . . . . . . . . 22 4.1.8. remoteDescription . . . . . . . . . . . . . . . . . . 22 - 4.1.9. canTrickle . . . . . . . . . . . . . . . . . . . . . 22 + 4.1.9. canTrickleIceCandidates . . . . . . . . . . . . . . . 22 4.1.10. setConfiguration . . . . . . . . . . . . . . . . . . 23 4.1.11. addIceCandidate . . . . . . . . . . . . . . . . . . . 24 5. SDP Interaction Procedures . . . . . . . . . . . . . . . . . 24 5.1. Requirements Overview . . . . . . . . . . . . . . . . . . 24 5.1.1. Implementation Requirements . . . . . . . . . . . . . 24 5.1.2. Usage Requirements . . . . . . . . . . . . . . . . . 26 5.1.3. Profile Names and Interoperability . . . . . . . . . 26 5.2. Constructing an Offer . . . . . . . . . . . . . . . . . . 27 5.2.1. Initial Offers . . . . . . . . . . . . . . . . . . . 27 5.2.2. Subsequent Offers . . . . . . . . . . . . . . . . . . 32 5.2.3. Options Handling . . . . . . . . . . . . . . . . . . 35 5.2.3.1. OfferToReceiveAudio . . . . . . . . . . . . . . . 35 5.2.3.2. OfferToReceiveVideo . . . . . . . . . . . . . . . 35 5.2.3.3. IceRestart . . . . . . . . . . . . . . . . . . . 36 5.2.3.4. VoiceActivityDetection . . . . . . . . . . . . . 36 5.3. Generating an Answer . . . . . . . . . . . . . . . . . . 36 5.3.1. Initial Answers . . . . . . . . . . . . . . . . . . . 36 - 5.3.2. Subsequent Answers . . . . . . . . . . . . . . . . . 40 - 5.3.3. Options Handling . . . . . . . . . . . . . . . . . . 41 - 5.3.3.1. VoiceActivityDetection . . . . . . . . . . . . . 41 - 5.4. Parsing an Offer . . . . . . . . . . . . . . . . . . . . 41 - 5.5. Parsing an Answer . . . . . . . . . . . . . . . . . . . . 41 - 5.6. Applying a Local Description . . . . . . . . . . . . . . 41 - 5.7. Applying a Remote Description . . . . . . . . . . . . . . 41 - 6. Configurable SDP Parameters . . . . . . . . . . . . . . . . . 41 - 7. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 42 - 7.1. Simple Example . . . . . . . . . . . . . . . . . . . . . 43 - 7.2. Normal Examples . . . . . . . . . . . . . . . . . . . . . 47 - 8. Security Considerations . . . . . . . . . . . . . . . . . . . 58 - 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 58 - 10. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 58 - 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 59 - 11.1. Normative References . . . . . . . . . . . . . . . . . . 59 - 11.2. Informative References . . . . . . . . . . . . . . . . . 61 - Appendix A. Change log . . . . . . . . . . . . . . . . . . . . . 62 - Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 65 + 5.3.2. Subsequent Answers . . . . . . . . . . . . . . . . . 41 + 5.3.3. Options Handling . . . . . . . . . . . . . . . . . . 42 + 5.3.3.1. VoiceActivityDetection . . . . . . . . . . . . . 42 + 5.4. Processing a Local Description . . . . . . . . . . . . . 42 + 5.5. Processing a Remote Description . . . . . . . . . . . . . 43 + 5.6. Parsing a Session Description . . . . . . . . . . . . . . 43 + 5.6.1. Session-Level Parsing . . . . . . . . . . . . . . . . 44 + 5.6.2. Media Section Parsing . . . . . . . . . . . . . . . . 45 + 5.6.3. Semantics Verification . . . . . . . . . . . . . . . 47 + 5.7. Applying a Local Description . . . . . . . . . . . . . . 47 + 5.8. Applying a Remote Description . . . . . . . . . . . . . . 48 + 5.9. Applying an Answer . . . . . . . . . . . . . . . . . . . 48 + 6. Configurable SDP Parameters . . . . . . . . . . . . . . . . . 48 + 7. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 49 + 7.1. Simple Example . . . . . . . . . . . . . . . . . . . . . 50 + 7.2. Normal Examples . . . . . . . . . . . . . . . . . . . . . 54 + 8. Security Considerations . . . . . . . . . . . . . . . . . . . 65 + 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 65 + 10. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 65 + 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 66 + 11.1. Normative References . . . . . . . . . . . . . . . . . . 66 + 11.2. Informative References . . . . . . . . . . . . . . . . . 69 + Appendix A. Change log . . . . . . . . . . . . . . . . . . . . . 70 + Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 73 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 @@ -291,23 +296,23 @@ willing to receive, which, when intersected with the set of codecs the remote side supports, specifies what the remote side should send. However, not all parameters follow this rule; for example, the DTLS- SRTP parameters [RFC5763] sent to a remote party indicate what certificate the local side will use in DTLS setup, and thereby what the remote party should expect to receive; the remote party will have to accept these parameters, with no option to choose different values. In addition, various RFCs put different conditions on the format of - offers versus answers. For example, a offer may propose an arbitrary - number of media streams (i.e. m= sections), but an answer must - contain the exact same number as the offer. + offers versus answers. For example, an offer may propose an + arbitrary number of media streams (i.e. m= sections), but an answer + must contain the exact same number as the offer. Lastly, while the exact media parameters are only known only after an offer and an answer have been exchanged, it is possible for the offerer to receive media after they have sent an offer and before they have received an answer. To properly process incoming media in this case, the offerer's media handler must be aware of the details of the offer before the answer arrives. Therefore, in order to handle session descriptions properly, the user agent needs: @@ -434,27 +439,27 @@ JSEP gathers ICE candidates as needed by the application. Collection of ICE candidates is referred to as a gathering phase, and this is triggered either by the addition of a new or recycled m= line to the local session description, or new ICE credentials in the description, indicating an ICE restart. Use of new ICE credentials can be triggered explicitly by the application, or implicitly by the browser in response to changes in the ICE configuration. When a new gathering phase starts, the ICE Agent will notify the - application that gathering is occurring through a callback. Then, - when each new ICE candidate becomes available, the ICE Agent will - supply it to the application via an additional callback; these - candidates will also automatically be added to the local session - description. Finally, when all candidates have been gathered, a - callback will be dispatched to signal that the gathering process is - complete. + application that gathering is occurring through an event. Then, when + each new ICE candidate becomes available, the ICE Agent will supply + it to the application via an additional event; these candidates will + also automatically be added to the local session description. + + Finally, when all candidates have been gathered, an event will be + dispatched to signal that the gathering process is complete. Note that gathering phases only gather the candidates needed by new/recycled/restarting m= lines; other m= lines continue to use their existing candidates. 3.4.2. ICE Candidate Trickling Candidate trickling is a technique through which a caller may incrementally provide candidates to the callee after the initial offer has been dispatched; the semantics of "Trickle ICE" are defined @@ -547,21 +553,21 @@ the app specifies the number of media streams, and thereby ICE components, for which to gather candidates. However, to accelerate cases where the application knows the number of ICE components to use ahead of time, it may ask the browser to gather a pool of potential ICE candidates to help ensure rapid media setup. When setLocalDescription is eventually called, and the browser goes to gather the needed ICE candidates, it SHOULD start by checking if any candidates are available in the pool. If there are candidates in the pool, they SHOULD be handed to the application immediately via - the ICE candidate callback. If the pool becomes depleted, either + the ICE candidate event. If the pool becomes depleted, either because a larger-than-expected number of ICE components is used, or because the pool has not had enough time to gather candidates, the remaining candidates are gathered as usual. One example of where this concept is useful is an application that expects an incoming call at some point in the future, and wants to minimize the time it takes to establish connectivity, to avoid clipping of initial media. By pre-gathering candidates into the pool, it can exchange and start sending connectivity checks from these candidates almost immediately upon receipt of a call. Note @@ -693,22 +699,22 @@ candidate policy MUST be set to allow all candidates, as this minimizes use of application STUN/TURN server resources. If a size is specified for the ICE candidate pool, this indicates the number of ICE components to pre-gather candidates for. Because pre- gathering results in utilizing STUN/TURN server resources for potentially long periods of time, this must only occur upon application request, and therefore the default candidate pool size MUST be zero. - Lastly, the application can specify its preferred policy regarding - use of BUNDLE, the multiplexing mechanism defined in + The application can specify its preferred policy regarding use of + BUNDLE, the multiplexing mechanism defined in [I-D.ietf-mmusic-sdp-bundle-negotiation]. By specifying a policy from the list below, the application can control how aggressively it will try to BUNDLE media streams together. The set of available policies is as follows: balanced: The application will BUNDLE all media streams of the same type together. That is, if there are multiple audio and multiple video MediaStreamTracks attached to a PeerConnection, all but the first audio and video tracks will be marked as bundle-only, and candidates will only be gathered for N media streams, where N is @@ -722,29 +728,36 @@ streams 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: The application will BUNDLE all of its media streams, including data channels, on a single transport. 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. - max-bundle-and-rtcp-mux: Similar to max-bundle, but RTCP candidates - are not gathered. This policy reduces the candidates that must be - gathered to the absolute minimum, but will not be compatible with - legacy endpoints that do not support RTCP mux. - 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 + either multiplexing or non-multiplexing endpoints. + + require: The browser will only gather RTP candidates. [[OPEN ISSUE: + how should the answerer behave. https://github.com/rtcweb- + wg/jsep/issues/114]] This halves the number of candidates that the + offerer needs to gather. + 4.1.2. 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 local MediaStreams attached 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 should allow for the following manipulations to be performed: @@ -975,62 +988,63 @@ The localDescription method returns a copy of the current local configuration, i.e. what was most recently passed to setLocalDescription, plus any local candidates that have been generated by the ICE Agent. [[OPEN ISSUE: Do we need to expose accessors for both the current and proposed local description? https://github.com/rtcweb-wg/jsep/ issues/16]] A null object will be returned if the local description has not yet - been established, or if the PeerConnection has been closed. + been established. 4.1.8. remoteDescription The remoteDescription method returns a copy of the current remote configuration, i.e. what was most recently passed to setRemoteDescription, plus any remote candidates that have been supplied via processIceMessage. [[OPEN ISSUE: Do we need to expose accessors for both the current and proposed remote description? https://github.com/rtcweb-wg/jsep/ issues/16]] A null object will be returned if the remote description has not yet - been established, or if the PeerConnection has been closed. + been established. -4.1.9. canTrickle +4.1.9. canTrickleIceCandidates - [[TODO: Revise if the W3C API uses different stuff here.]] The - canTrickle property indicates whether the remote side supports - receiving trickled candidates. There are three potential values: + The canTrickleIceCandidates property indicates whether the remote + side supports receiving trickled candidates. There are three + potential values: null: No SDP has been received from the other side, so it is not known if it can handle trickle. This is the initial value before setRemoteDescription() is called. true: SDP has been received from the other side indicating that it can support trickle. false: SDP has been received from the other side indicating that it cannot support trickle. As described in Section 3.4.2, JSEP implementations always provide candidates to the application individually, consistent with what is - needed for Trickle ICE. However, applications can use the canTrickle - property to determine whether they can actually do Trickle ICE, i.e. - safely send an initial offer or answer followed later by candidates - as they are gathered. As "true" is the only value that definitively - indicates remote Trickle ICE support, an application which compares - canTrickle against "true" will by default attempt Half Trickle on - initial offers and Full Trickle on subsequent interactions with a - Trickle ICE-compatible agent. + needed for Trickle ICE. However, applications can use the + canTrickleIceCandidates property to determine whether their peer can + actually do Trickle ICE, i.e., whether it is safe to send an initial + offer or answer followed later by candidates as they are gathered. + As "true" is the only value that definitively indicates remote + Trickle ICE support, an application which compares + canTrickleIceCandidates against "true" will by default attempt Half + Trickle on initial offers and Full Trickle on subsequent interactions + with a Trickle ICE-compatible agent. 4.1.10. setConfiguration The setConfiguration method allows the global configuration of the PeerConnection, which was initially set by constructor parameters, to be changed during the session. The effects of this method call depend on when it is invoked, and differ depending on which specific parameters are changed: o Any changes to the STUN/TURN servers to use affect the next @@ -1047,23 +1061,22 @@ described above. Note though that changes to the policy have no effect on the candidate pool, because pooled candidates are not surfaced to the application until a gathering phase occurs, and so any necessary filtering can still be done on any pooled candidates. o Any changes to the ICE candidate pool size take effect immediately; if increased, additional candidates are pre-gathered; if decreased, the now-superfluous candidates are discarded. - o Any changes to the BUNDLE policy take effect immediately, i.e. - any future tracks added to the PeerConnection will have their - bundle-only state marked accordingly. + o The BUNDLE and RTCP-multiplexing policies MUST NOT be changed + after the construction of the PeerConnection. 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.11. addIceCandidate The addIceCandidate method provides a remote candidate to the ICE Agent, which, if parsed successfully, will be added to the remote description according to the rules defined for Trickle ICE. @@ -1094,21 +1107,21 @@ 5.1.1. Implementation Requirements This list of mandatory-to-implement specifications is derived from the requirements outlined in [I-D.ietf-rtcweb-rtp-usage]. R-1 [RFC4566] is the base SDP specification and MUST be implemented. R-2 [RFC5764] MUST be supported for signaling the UDP/TLS/RTP/SAVPF - [RFC5764] and TCP/TLS/RTP/SAVPF + [RFC5764] and TCP/DTLS/RTP/SAVPF [I-D.nandakumar-mmusic-proto-iana-registration] RTP profiles. R-3 [RFC5245] MUST be implemented for signaling the ICE credentials and candidate lines corresponding to each media stream. The ICE implementation MUST be a Full implementation, not a Lite implementation. R-4 [RFC5763] MUST be implemented to signal DTLS certificate fingerprints. @@ -1125,57 +1138,64 @@ R-8 The bundle mechanism in [I-D.ietf-mmusic-sdp-bundle-negotiation] MUST be supported to signal the ability to multiplex RTP streams on a single UDP port, in order to avoid excessive use of port number resources. R-9 The SDP attributes of "sendonly", "recvonly", "inactive", and "sendrecv" from [RFC4566] MUST be implemented to signal information about media direction. - R-10 [RFC5576] MUST be implemented to signal RTP SSRC values. + R-10 [RFC5576] MUST be implemented to signal RTP SSRC values and + grouping semantics. R-11 [RFC4585] MUST be implemented to signal RTCP based feedback. R-12 [RFC5761] MUST be implemented to signal multiplexing of RTP and RTCP. R-13 [RFC5506] MUST be implemented to signal reduced-size RTCP messages. - R-14 [RFC3556] with bandwidth modifiers MAY be supported for + R-14 [RFC4588] MUST be implemented to signal RTX payload type + associations. + + R-15 [RFC3556] with bandwidth modifiers MAY be supported for specifying RTCP bandwidth as a fraction of the media bandwidth, RTCP fraction allocated to the senders and setting maximum media bit-rate boundaries. + R-16 TODO: any others? As required by [RFC4566], Section 5.13, JSEP implementations MUST ignore unknown attribute (a=) lines. 5.1.2. Usage Requirements All session descriptions handled by JSEP endpoints, both local and remote, MUST indicate support for the following specifications. If any of these are absent, this omission MUST be treated as an error. R-1 ICE, as specified in [RFC5245], MUST be used. Note that the remote endpoint may use a Lite implementation; implementations MUST properly handle remote endpoints which do ICE-Lite. - R-2 DTLS-SRTP, as specified in [RFC5763], MUST be used. + R-2 DTLS [RFC6347] or DTLS-SRTP [RFC5763], MUST be used, as + appropriate for the media type, as specified in + [I-D.ietf-rtcweb-security-arch] 5.1.3. Profile Names and Interoperability For media m= sections, JSEP endpoints MUST support both the "UDP/TLS/ - RTP/SAVPF" and "TCP/TLS/RTP/SAVPF" profiles and MUST indicate one of + RTP/SAVPF" and "TCP/DTLS/RTP/SAVPF" profiles and MUST indicate one of these two profiles for each media m= line they produce in an offer. - For data m= sections, JSEP endpoints must support both the "UDP/TLS/ - SCTP" and "TCP/TLS/SCTP" profiles and MUST indicate one of these two + For data m= sections, JSEP endpoints must support both the "UDP/DTLS/ + SCTP" and "TCP/DTLS/SCTP" profiles and MUST indicate one of these two profiles for each data m= line they produce in an offer. Because ICE can select either TCP or UDP transport depending on network conditions, both advertisements are consistent with ICE eventually selecting either either UDP or TCP. Unfortunately, in an attempt at compatibility, some endpoints generate other profile strings even when they mean to support one of these profiles. For instance, an endpoint might generate "RTP/AVP" but supply "a=fingerprint" and "a=rtcp-fb" attributes, indicating its willingness to support "(UDP,TCP)/TLS/RTP/SAVPF". In order to @@ -1194,21 +1214,21 @@ "a=fingerprint" attribute. Note that lack of an "a=fingerprint" attribute will lead to negotiation failure. o The use of AVPF or AVP simply controls the timing rules used for RTCP feedback. If AVPF is provided, or an "a=rtcp-fb" attribute is present, assume AVPF timing, i.e. a default value of "trr- int=0". Otherwise, assume that AVPF is being used in an AVP compatible mode and use AVP timing, i.e., "trr-int=4". o For data m= sections, JSEP endpoints MUST support receiving the - "UDP/ TLS/SCTP", "TCP/TLS/SCTP", or "DTLS/SCTP" (for backwards + "UDP/ DTLS/SCTP", "TCP/DTLS/SCTP", or "DTLS/SCTP" (for backwards compatibility) profiles. Note that re-offers by JSEP endpoints MUST use the correct profile strings even if the initial offer/answer exchange used an (incorrect) older profile string. 5.2. Constructing an Offer When createOffer is called, a new SDP description must be created that includes the functionality specified in @@ -1293,21 +1313,21 @@ 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-mmusic-trickle-ice], Section 5.1. o To properly indicate use of DTLS, the field MUST be set to "UDP/TLS/RTP/SAVPF", as specified in [RFC5764], Section 8, if the - default candidate uses UDP transport, or "TCP/TLS/RTP/SAVPF", as + default candidate uses UDP transport, or "TCP/DTLS/RTP/SAVPF", as specified in[I-D.nandakumar-mmusic-proto-iana-registration] if the default candidate uses TCP transport. The m= line MUST be followed immediately by a "c=" line, as specified in [RFC4566], Section 5.7. Again, as no candidates have yet been gathered, the "c=" line must contain the "dummy" value "IN IP6 ::", as defined in [I-D.ietf-mmusic-trickle-ice], Section 5.1. Each m= section MUST include the following attribute lines: @@ -1320,37 +1340,40 @@ o An "a=rtcp" line, as specified in [RFC3605], Section 2.1, containing the dummy value "9 IN IP6 ::", because no candidates have yet been gathered. o An "a=msid" line, as specified in [I-D.ietf-mmusic-msid], Section 2. o An "a=sendrecv" line, as specified in [RFC3264], Section 5.1. o For each supported codec, "a=rtpmap" and "a=fmtp" lines, as - specified in [RFC4566], Section 6. For audio, the codecs - specified in [I-D.ietf-rtcweb-audio], Section 3, MUST be be - supported. + 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 specified in [RFC4566], Section 6. o For each primary codec where RTP retransmission should be used, a corresponding "a=rtpmap" line indicating "rtx" with the clock rate of the primary codec and an "a=fmtp" line that references the payload type of the primary codec, as specified in [RFC4588], Section 8.1. - o For each supported FEC mechanism, a corresponding "a=rtpmap" line - indicating the desired FEC codec. + 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-passwd" lines, as specified in [RFC5245], Section 15.4. o An "a=ice-options" line, with the "trickle" option, as specified in [I-D.ietf-mmusic-trickle-ice], Section 4. o An "a=fingerprint" line, as specified in [RFC4572], Section 5; the algorithm used for the fingerprint MUST match that used in the certificate signature. @@ -1359,24 +1382,23 @@ 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-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. [TODO: ensure that - urn:ietf:params:rtp-hdrext:sdes:mid appears either there or here] - Any header extensions that require encryption MUST be specified as - indicated in [RFC6904], Section 4. + [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" mechanism, as specified in [RFC4585], Section 4.2. The list of RTCP feedback mechanisms that SHOULD/MUST be supported is specified in [I-D.ietf-rtcweb-rtp-usage], Section 5.1. o An "a=ssrc" line, as specified in [RFC5576], Section 4.1, indicating the SSRC to be used for sending media, along with the mandatory "cname" source attribute, as specified in Section 6.1, indicating the CNAME for the source. The CNAME must be generated @@ -1384,35 +1406,36 @@ specified for MSTs? Are they randomly generated for each MediaStream? If so, can two MediaStreams be synced? See: https://github.com/rtcweb-wg/jsep/issues/4] o If RTX is supported for this media type, another "a=ssrc" line with the RTX SSRC, and an "a=ssrc-group" line, as specified in [RFC5576], section 4.2, with semantics set to "FID" and including the primary and RTX SSRCs. o If FEC is supported for this media type, another "a=ssrc" line - with the FEC SSRC, and an "a=ssrc-group" line, as specified in - [RFC5576], section 4.2, with semantics set to "FEC" and including - the primary and FEC SSRCs. + with the FEC SSRC, and an "a=ssrc-group" line with semantics set + to "FEC-FR" and including the primary and FEC SSRCs, as specified + in [RFC5956], section 4.3. For simplicity, if both RTX and FEC + are supported, the FEC SSRC MUST be the same as the RTX SSRC. o [OPEN ISSUE: Handling of a=imageattr] o If the BUNDLE policy for this PeerConnection is set to "max- bundle", and this is not the first m= section, or the BUNDLE policy is set to "balanced", and this is not the first m= section for this media type, an "a=bundle-only" line. Lastly, if a data channel has been created, a m= section MUST be generated for data. The field MUST be set to "application" - and the field MUST be set to "UDP/TLS/SCTP" if the default - candidate uses UDP transport, or "TCP/TLS/SCTP" if the default + and the field MUST be set to "UDP/DTLS/SCTP" if the default + candidate uses UDP transport, or "TCP/DTLS/SCTP" if the default candidate uses TCP transport [I-D.ietf-mmusic-sctp-sdp]. The "fmt" value MUST be set to the SCTP port number, as specified in Section 4.1. [TODO: update this to use a=sctp-port, as indicated in the latest data channel docs] Within the data m= section, the "a=mid", "a=ice-ufrag", "a=ice- passwd", "a=ice-options", "a=candidate", "a=fingerprint", and "a=setup" lines MUST be included as mentioned above, along with an "a=sctpmap" line referencing the SCTP port number and specifying the application protocol indicated in [I-D.ietf-rtcweb-data-protocol]. @@ -1467,31 +1490,31 @@ candidates. 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 Each "m=" and c=" line MUST be filled in with the port and address - of the default candidate for the m= section, as described in - [RFC5245], Section 4.3. Each "a=rtcp" attribute line MUST also be - filled in with the port and address of the appropriate default - candidate, either the default RTP or RTCP candidate, depending on - whether RTCP multiplexing is currently active or not. Note that - if RTCP multiplexing is being offered, but not yet active, the - default RTCP candidate MUST be used, as indicated in [RFC5761], - section 5.1.3. In each case, if no candidates of the desired type - have yet been gathered, dummy values MUST be used, as described - above. [TODO: update profile UDP/TCP per default candidate] + o Each "m=" and c=" line MUST be filled in with the port, protocol, + and address of the default candidate for the m= section, as + described in [RFC5245], Section 4.3. Each "a=rtcp" attribute line + MUST also be filled in with the port and address of the + appropriate default candidate, either the default RTP or RTCP + candidate, depending on whether RTCP multiplexing is currently + active or not. Note that if RTCP multiplexing is being offered, + but not yet active, the default RTCP candidate MUST be used, as + indicated in [RFC5761], section 5.1.3. In each case, if no + candidates of the desired type have yet been gathered, dummy + values MUST be used, as described above. o Each "a=mid" line MUST stay the same. o Each "a=ice-ufrag" and "a=ice-pwd" line MUST stay the same, unless the ICE configuration has changed (either changes to the supported STUN/TURN servers, or the ICE candidate policy), or the "IceRestart" option (Section 5.2.3.3 was specified. o Within each m= section, for each candidate that has been gathered during the most recent gathering phase (see Section 3.4.1), an @@ -1570,21 +1592,21 @@ 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. 5.2.3. Options Handling The createOffer method takes as a parameter an RTCOfferOptions object. Special processing is performed when generating a SDP - description if the following constraints are present. + description if the following options are present. 5.2.3.1. OfferToReceiveAudio If the "OfferToReceiveAudio" option is specified, with an integer value of N, and M audio MediaStreamTracks have been added to the PeerConnection, the offer MUST include N non-rejected m= sections with media type "audio", even if N is greater than M. This allows the offerer to receive audio, including multiple independent streams, even when not sending it; accordingly, the directional attribute on the N-M audio m= sections without associated MediaStreamTracks MUST @@ -1747,90 +1769,97 @@ there is a local MediaStreamTrack that has been associated, the directionality MUST be set as sendrecv. If the offer was sendonly, and the remote MediaStreamTrack is still "live", the directionality MUST be set as recvonly. If the offer was recvonly, and a local MediaStreamTrack has been associated, the directionality MUST be set as sendonly. If the offer was inactive, the directionality MUST be set as inactive. 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. For audio, the codecs specified in - [I-D.ietf-rtcweb-audio], Section 3, MUST be supported. Note that - for simplicity, the answerer MAY use different payload types for + [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). Note that for + simplicity, the answerer MAY use different payload types for codecs than the offerer, as it is not prohibited by Section 6.1. 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 specified in [RFC4566], Section 6. o If "rtx" is present in the offer, for each primary codec where RTP retransmission should be used, a corresponding "a=rtpmap" line indicating "rtx" with the clock rate of the primary codec and an "a=fmtp" line that references the payload type of the primary codec, as specified in [RFC4588], Section 8.1. - o For each supported FEC mechanism that is present in the offer, a - corresponding "a=rtpmap" line indicating the desired FEC codec. + 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-passwd" lines, as specified in [RFC5245], Section 15.4. o If the "trickle" ICE option is present in the offer, an "a=ice- options" line, with the "trickle" option, as specified in [I-D.ietf-mmusic-trickle-ice], Section 4. o An "a=fingerprint" line, as specified in [RFC4572], Section 5; the algorithm used for the fingerprint MUST match that used in the certificate signature. 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. + [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-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. [TODO: - Ensure this contains MID header] Any header extensions that - require encryption MUST be specified as indicated in [RFC6904], - Section 4. + 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 that is present in the offer, an "a=rtcp-fb" mechanism, as specified in [RFC4585], Section 4.2. The list of RTCP feedback mechanisms that SHOULD/ MUST be supported is specified in [I-D.ietf-rtcweb-rtp-usage], Section 5.1. o If a local MediaStreamTrack has been associated, an "a=ssrc" line, as specified in [RFC5576], Section 4.1, indicating the SSRC to be used for sending media. o If a local MediaStreamTrack has been associated, and RTX has been negotiated for this m= section, another "a=ssrc" line with the RTX SSRC, and an "a=ssrc-group" line, as specified in [RFC5576], section 4.2, with semantics set to "FID" and including the primary and RTX SSRCs. o If a local MediaStreamTrack has been associated, and FEC has been negotiated for this m= section, another "a=ssrc" line with the FEC - SSRC, and an "a=ssrc-group" line, as specified in [RFC5576], - section 4.2, with semantics set to "FEC" and including the primary - and FEC SSRCs. + SSRC, and an "a=ssrc-group" line with semantics set to "FEC-FR" + and including the primary and FEC SSRCs, as specified in + [RFC5956], section 4.3. For simplicity, if both RTX and FEC are + supported, the FEC SSRC MUST be the same as the RTX SSRC. o [OPEN ISSUE: Handling of a=imageattr] If a data channel m= section has been offered, a m= section MUST also be generated for data. The field MUST be set to "application" and the field MUST be set to exactly match the field in the offer; the "fmt" value MUST be set to the SCTP port number, as specified in Section 4.1. [TODO: update this to use a=sctp-port, as indicated in the latest data channel docs] @@ -1849,68 +1878,395 @@ the presence of "a=bundle-only" in the offer, no m= sections in the answer should have an "a=bundle-only" line. Attributes that are common between all m= sections MAY be moved to session-level, if explicitly defined to be valid at session-level. The attributes prohibited in the creation of offers are also prohibited in the creation of answers. 5.3.2. Subsequent Answers + + When createAnswer 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 answer. + + If the initial answer was not applied using setLocalDescription, + meaning the PeerConnection is still in the "have-remote-offer" state, + the steps for generating an initial answer 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 from the previously generated + answer. + + If any session description was previously supplied to + setLocalDescription, an answer is generated by following the steps in + the "have-remote-offer" state above, along with these exceptions: + + o The "s=" and "t=" lines MUST stay the same. + + o Each "m=" and c=" line MUST be filled in with the port and address + of the default candidate for the m= section, as described in + [RFC5245], Section 4.3. Note, however, that the m= line protocol + need not match the default candidate, because this protocol value + must instead match what was supplied in the offer, as described + above. Each "a=rtcp" attribute line MUST also be filled in with + the port and address of the appropriate default candidate, either + the default RTP or RTCP candidate, depending on whether RTCP + multiplexing is enabled in the answer. In each case, if no + candidates of the desired type have yet been gathered, dummy + values MUST be used, as described in the initial answer section + above. + + o Each "a=ice-ufrag" and "a=ice-pwd" line MUST stay the same. + + o Within each m= section, for each candidate that has been gathered + during the most recent gathering phase (see Section 3.4.1), an + "a=candidate" line MUST be added, as specified in [RFC5245], + Section 4.3., paragraph 3. If candidate gathering for the section + has completed, an "a=end-of-candidates" attribute MUST be added, + as described in [I-D.ietf-mmusic-trickle-ice], Section 9.3. + + o For MediaStreamTracks that are still present, the "a=msid", + "a=ssrc", and "a=ssrc-group" lines MUST stay the same. + 5.3.3. Options Handling - The createOffer method takes as a parameter an RTCAnswerOptions - object. Special processing is performed when generating a SDP - description if the following constraints are present. + The createAnswer method takes as a parameter an RTCAnswerOptions + object. The set of parameters for RTCAnswerOptions is different than + those supported in RTCOfferOptions; the OfferToReceiveAudio, + OfferToReceiveVideo, and IceRestart options mentioned in + Section 5.2.3 are meaningless in the context of generating an answer, + as there is no need to generate extra m= lines in an answer, and ICE + credentials will automatically be changed for all m= lines where the + offerer chose to perform ICE restart. + + The following options are supported in RTCAnswerOptions. 5.3.3.1. VoiceActivityDetection - Handling of the "VoiceActivityDetection" option in answers is the - same as is indicated for offers in Section 5.2.3.4. + Silence suppression in the answer is handled as described in + Section 5.2.3.4. -5.4. Parsing an Offer +5.4. Processing a Local Description -5.5. Parsing an Answer + When a SessionDescription is supplied to setLocalDescription, the + following steps MUST be performed: -5.6. Applying a Local Description + o First, the type of the SessionDescription is checked against the + current state of the PeerConnection: -5.7. Applying a Remote Description + * 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 + 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. + +5.5. 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 + 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. + +5.6. Parsing a Session Description + + [The behavior described herein is a draft version, and needs more + discussion to resolve various open issues.] + + 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 + information. However, SDP allows many types of lines, not all of + which are relevant to JSEP applications. For each line, the + implementation will first ensure it is syntactically correct + according its defining ABNF [TODO: reference], check that it conforms + to [RFC4566] and [RFC3264] semantics, and then either parse and store + or discard the provided value, as described below. [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 + + 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 + not meaningful in the JSEP context and MAY be discarded once they + have been checked. + + TODO + + The remaining lines are processed as follows: + + The "c=" line MUST be parsed and stored. + + [OPEN ISSUE: For example, because session-level bandwidth is + ambiguous when multiple media streams are present, a "b=" line at + session level is not useful and its value SHOULD be ignored. + [OPEN ISSUE: is this WG consensus? Are there other non-a= lines + that we need to do more than just syntactical validation, e.g. + v=?] + + Specific processing MUST be applied for the following session-level + attribute ("a=") lines: + + o Any "a=group" lines are parsed as specified in [RFC5888], + Section 5, and the group's semantics and mids are stored. + + o If present, a single "a=ice-lite" line is parsed as specified in + [RFC5245], Section 15.3, and a value indicating the presence of + ice-lite is stored. + + o If present, a single "a=ice-ufrag" line is parsed as specified in + [RFC5245], Section 15.4, and the ufrag value is stored. + + o If present, a single "a=ice-pwd" line is parsed as specified in + [RFC5245], Section 15.4, and the password value is stored. + + o If present, a single "a=ice-options" line is parsed as specified + in [RFC5245], Section 15.5, and the set of specified options is + stored. + + 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: msid-semantic, identity, rtcp-rsize, rtcp-mux, and any other + attribs 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 + + 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: + + o The "c=" line, if present, MUST be parsed as specified in + [RFC4566], Section 5.7, and its contents stored. + + o The "b=" line, if present, MUST be parsed as specified in + [RFC4566], Section 5.8, and the bwtype and bandwidth values + stored. + + Specific processing MUST also be applied for the following attribute + lines: + + o If present, a single "a=ice-lite" line is parsed as specified in + [RFC5245], Section 15.3, and a value indicating the presence of + ice-lite is stored. + + o If present, a single "a=ice-ufrag" line is parsed as specified in + [RFC5245], Section 15.4, and the ufrag value is stored. + + o If present, a single "a=ice-pwd" line is parsed as specified in + [RFC5245], Section 15.4, and the password value is stored. + + o If present, a single "a=ice-options" line is parsed as specified + in [RFC5245], Section 15.5, and the set of specified options is + stored. + + 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. + + If the "m=" proto value indicates use of RTP, as decribed in the + Section 5.1.3 section above, the following attribute lines MUST be + processed: + + o The "m=" fmt value MUST be parsed as specified in [RFC4566], + Section 5.14, and the individual values stored. + + o Any "a=rtpmap" or "a=fmtp" lines MUST be parsed as specified in + [RFC4566], Section 6, and their values stored. + + o If present, a single "a=ptime" line MUST be parsed as described in + [RFC4566], Section 6, and its value stored. + + o If present, a single direction attribute line (e.g. "a=sendrecv") + MUST be parsed as described in [RFC4566], Section 6, and its value + stored. + + o Any "a=ssrc" or "a=ssrc-group" attributes MUST be parsed as + specified in [RFC5576], Sections 4.1-4.2, and their values stored. + + 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" line MUST be parsed as specified + in [RFC5761], Section 5.1.1, and its presence or absence flagged + and stored. + + o TODO: a=rtcp-rsize, a=rtcp, a=msid, a=candidate, a=end-of- + candidates + + Otherwise, if the "m=" proto value indicats use of SCTP, the + following attribute lines MUST be processed: + + o The "m=" fmt value MUST be parsed as specified in + [I-D.ietf-mmusic-sctp-sdp], Section 4.3, and the application + 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 TODO: max message size + +5.6.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. + + * ICE ufrag and password values + + * DTLS fingerprint and setup values + + If this session description is of type "pranswer" or "answer", the + following additional checks are applied: + + o The session description must follow the rules defined in + [RFC3264], Section 6. + + o For each m= section, the protocol value MUST exactly match the + protocol value in the corresponding m= section in the associated + offer. + +5.7. 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. + + 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 TODO + + Finally, if this description is of type "pranswer" or "answer", + follow the processing defined in the Section 5.9 section below. + +5.8. Applying a Remote Description + + TODO + +5.9. Applying an Answer + + TODO 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. Changes MUST NOT be silently ignored. The following elements of the SDP media description MUST NOT be - changed between the createOffer 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: + 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: o The number, type and port number of m= lines. o The generated ICE credentials (a=ice-ufrag and a=ice-pwd). o The set of ICE candidates and their parameters (a=candidate). + o The DTLS fingerprint(s) (a=fingerprint). + The following modifications, if done by the browser to a description between createOffer/createAnswer and the setLocalDescription, MUST be honored by the browser: o Remove or reorder codecs (m=) - The following parameters may be controlled by constraints passed into + 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): o [[OPEN ISSUE: This is a placeholder for other modifications, which we may continue adding as use cases appear.]] Implementations MAY choose to either honor or reject any elements not @@ -1961,52 +2317,52 @@ Alice's side and Bob's side waits for all candidates before sending the offer or answer, so the offers and answers are complete. Trickle ICE is not used. Both Alice and Bob are using the default policy of balanced. // set up local media state AliceJS->AliceUA: create new PeerConnection AliceJS->AliceUA: addStream with stream containing audio and video AliceJS->AliceUA: createOffer to get offer AliceJS->AliceUA: setLocalDescription with offer -AliceUA->AliceJS: multiple onicecandidate callbacks with candidates +AliceUA->AliceJS: multiple onicecandidate events with candidates // wait for ICE gathering to complete -AliceUA->AliceJS: onicecandidate callback with null candidate +AliceUA->AliceJS: onicecandidate event with null candidate AliceJS->AliceUA: get |offer-A1| from value of localDescription // |offer-A1| is sent over signaling protocol to Bob AliceJS->WebServer: signaling with |offer-A1| WebServer->BobJS: signaling with |offer-A1| // |offer-A1| arrives at Bob BobJS->BobUA: create a PeerConnection BobJS->BobUA: setRemoteDescription with |offer-A1| -BobUA->BobJS: onaddstream callback with remoteStream +BobUA->BobJS: onaddstream event with remoteStream // Bob accepts call BobJS->BobUA: addStream with local media BobJS->BobUA: createAnswer BobJS->BobUA: setLocalDescription with answer -BobUA->BobJS: multiple onicecandidate callbacks with candidates +BobUA->BobJS: multiple onicecandidate events with candidates // wait for ICE gathering to complete -BobUA->BobJS: onicecandidate callback with null candidate +BobUA->BobJS: onicecandidate event with null candidate BobJS->BobUA: get |answer-A1| from value of localDescription // |answer-A1| is sent over signaling protocol to Alice BobJS->WebServer: signaling with |answer-A1| WebServer->AliceJS: signaling with |answer-A1| // |answer-A1| arrives at Alice AliceJS->AliceUA: setRemoteDescription with |answer-A1| -AliceUA->AliceJS: onaddstream callback with remoteStream +AliceUA->AliceJS: onaddstream event with remoteStream // media flows BobUA->AliceUA: media sent from Bob to Alice AliceUA->BobUA: media sent from Alice to Bob The SDP for |offer-A1| looks like: v=0 o=- 4962303333179871722 1 IN IP4 0.0.0.0 s=- @@ -2135,108 +2491,108 @@ a=ssrc:3229706346 cname:Q/NWs1ao1HmN4Xa5 a=ssrc-group:FID 3229706345 3229706346 a=candidate:2299743422 1 udp 2113937151 192.0.2.2 20001 typ host a=end-of-candidates 7.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 policy of max-bundle-and-rtcp-mux - 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. + 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. // set up local media state AliceJS->AliceUA: create new PeerConnection AliceJS->AliceUA: addStream that contains audio track AliceJS->AliceUA: createDataChannel to get data channel AliceJS->AliceUA: createOffer to get |offer-B1| AliceJS->AliceUA: setLocalDescription with |offer-B1| // |offer-B1| is sent over signaling protocol to Bob AliceJS->WebServer: signaling with |offer-B1| WebServer->BobJS: signaling with |offer-B1| // |offer-B1| arrives at Bob BobJS->BobUA: create a PeerConnection BobJS->BobUA: setRemoteDescription with |offer-B1| BobUA->BobJS: onaddstream with audio track from Alice // candidates are sent to Bob - AliceUA->AliceJS: onicecandidate callback with |candidate-B1| (host) + AliceUA->AliceJS: onicecandidate event with |candidate-B1| (host) AliceJS->WebServer: signaling with |candidate-B1| - AliceUA->AliceJS: onicecandidate callback with |candidate-B2| (srflx) + AliceUA->AliceJS: onicecandidate event with |candidate-B2| (srflx) AliceJS->WebServer: signaling with |candidate-B2| - AliceUA->AliceJS: onicecandidate callback with |candidate-B3| (relay) + AliceUA->AliceJS: onicecandidate event with |candidate-B3| (relay) AliceJS->WebServer: signaling with |candidate-B3| WebServer->BobJS: signaling with |candidate-B1| BobJS->BobUA: addIceCandidate with |candidate-B1| WebServer->BobJS: signaling with |candidate-B2| BobJS->BobUA: addIceCandidate with |candidate-B2| WebServer->BobJS: signaling with |candidate-B3| BobJS->BobUA: addIceCandidate with |candidate-B3| // Bob accepts call BobJS->BobUA: addStream with local audio stream BobJS->BobUA: createDataChannel to get data channel BobJS->BobUA: createAnswer to get |answer-B1| BobJS->BobUA: setLocalDescription with |answer-B1| // |answer-B1| is sent to Alice BobJS->WebServer: signaling with |answer-B1| WebServer->AliceJS: signaling with |answer-B1| AliceJS->AliceUA: setRemoteDescription with |answer-B1| - AliceUA->AliceJS: onaddstream callback with audio track from Bob + AliceUA->AliceJS: onaddstream event with audio track from Bob // candidates are sent to Alice - BobUA->BobJS: onicecandidate callback with |candidate-B4| (host) + BobUA->BobJS: onicecandidate event with |candidate-B4| (host) BobJS->WebServer: signaling with |candidate-B4| - BobUA->BobJS: onicecandidate callback with |candidate-B5| (srflx) + BobUA->BobJS: onicecandidate event with |candidate-B5| (srflx) BobJS->WebServer: signaling with |candidate-B5| - BobUA->BobJS: onicecandidate callback with |candidate-B6| (relay) + BobUA->BobJS: onicecandidate event with |candidate-B6| (relay) BobJS->WebServer: signaling with |candidate-B6| WebServer->AliceJS: signaling with |candidate-B4| AliceJS->AliceUA: addIceCandidate with |candidate-B4| WebServer->AliceJS: signaling with |candidate-B5| AliceJS->AliceUA: addIceCandidate with |candidate-B5| WebServer->AliceJS: signaling with |candidate-B6| AliceJS->AliceUA: addIceCandidate with |candidate-B6| // data channel opens - BobUA->BobJS: ondatachannel callback - AliceUA->AliceJS: ondatachannel callback + BobUA->BobJS: ondatachannel event + AliceUA->AliceJS: ondatachannel event BobUA->BobJS: onopen AliceUA->AliceJS: onopen // media is flowing between browsers BobUA->AliceUA: audio+data sent from Bob to Alice AliceUA->BobUA: audio+data sent from Alice to Bob // some time later Bob adds two video streams // note, no candidates exchanged, because of BUNDLE BobJS->BobUA: addStream with first video stream BobJS->BobUA: addStream with second video stream BobJS->BobUA: createOffer to get |offer-B2| BobJS->BobUA: setLocalDescription with |offer-B2| // |offer-B2| is sent to Alice BobJS->WebServer: signaling with |offer-B2| WebServer->AliceJS: signaling with |offer-B2| AliceJS->AliceUA: setRemoteDescription with |offer-B2| - AliceUA->AliceJS: onaddstream callback with first video stream - AliceUA->AliceJS: onaddstream callback with second video stream + AliceUA->AliceJS: onaddstream event with first video stream + AliceUA->AliceJS: onaddstream event with second video stream AliceJS->AliceUA: createAnswer to get |answer-B2| AliceJS->AliceUA: setLocalDescription with |answer-B2| // |answer-B2| is sent over signaling protocol to Bob AliceJS->WebServer: signaling with |answer-B2| WebServer->BobJS: signaling with |answer-B2| BobJS->BobUA: setRemoteDescription with |answer-B2| // media is flowing between browsers BobUA->AliceUA: audio+video+data sent from Bob to Alice @@ -2269,21 +2625,21 @@ a=fingerprint:sha-256 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:actpass a=rtcp-mux a=rtcp-rsize a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid a=ssrc:1732846380 cname:FocUG1f0fcg/yvY7 - m=application 9 UDP/TLS/SCTP webrtc-datachannel + m=application 9 UDP/DTLS/SCTP webrtc-datachannel c=IN IP6 :: a=mid:d1 a=fmtp:webrtc-datachannel max-message-size=65536 a=sctp-port 5000 a=ice-ufrag:ATEn1v9DoTMB9J4r a=ice-pwd:AtSK0WpNtpUjkY4+86js7ZQl a=ice-options:trickle a=fingerprint:sha-256 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:actpass @@ -2327,21 +2683,21 @@ a=ice-options:trickle a=fingerprint:sha-256 6B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35 :DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 a=setup:active a=rtcp-mux a=rtcp-rsize a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid a=ssrc:4429951804 cname:Q/NWs1ao1HmN4Xa5 - m=application 9 UDP/TLS/SCTP webrtc-datachannel + m=application 9 UDP/DTLS/SCTP webrtc-datachannel c=IN IP6 :: a=mid:d1 a=fmtp:webrtc-datachannel max-message-size=65536 a=sctp-port 5000 a=ice-ufrag:7sFvz2gdLkEwjZEr a=ice-pwd:dOTZKZNVlO9RSGsEGM63JXT2 a=ice-options:trickle a=fingerprint:sha-256 6B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35 :DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 a=setup:active @@ -2393,21 +2749,21 @@ a=rtcp-rsize a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid a=ssrc:4429951804 cname:Q/NWs1ao1HmN4Xa5 a=candidate:109270924 1 udp 2122194687 192.168.2.3 61665 typ host a=candidate:4036177504 1 udp 1685987071 55.66.77.88 64532 typ srflx raddr 192.168.2.3 rport 61665 a=candidate:3671762467 1 udp 41819903 66.77.88.99 50416 typ relay raddr 55.66.77.88 rport 64532 a=end-of-candidates - m=application 64532 UDP/TLS/SCTP webrtc-datachannel + m=application 64532 UDP/DTLS/SCTP webrtc-datachannel c=IN IP4 55.66.77.88 a=mid:d1 a=fmtp:webrtc-datachannel max-message-size=65536 a=sctp-port 5000 a=ice-ufrag:7sFvz2gdLkEwjZEr a=ice-pwd:dOTZKZNVlO9RSGsEGM63JXT2 a=ice-options:trickle a=fingerprint:sha-256 6B:8B:F0:65:5F:78:E2:51:3B:AC:6F:F3:3F:46:1B:35 :DC:B8:5F:64:1A:24:C2:43:F0:A1:58:D0:A1:2C:19:08 a=setup:actpass @@ -2506,44 +2862,44 @@ a=rtpmap:8 PCMA/8000 a=rtpmap:97 telephone-event/8000 a=rtpmap:98 telephone-event/48000 a=maxptime:120 a=ice-ufrag:ATEn1v9DoTMB9J4r a=ice-pwd:AtSK0WpNtpUjkY4+86js7ZQl a=ice-options:trickle a=fingerprint:sha-256 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:actpass + a=setup:passive a=rtcp-mux a=rtcp-rsize a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid a=ssrc:1732846380 cname:FocUG1f0fcg/yvY7 a=candidate:109270923 1 udp 2122194687 192.168.1.2 51556 typ host a=candidate:4036177503 1 udp 1685987071 11.22.33.44 52546 typ srflx raddr 192.168.1.2 rport 51556 a=candidate:3671762466 1 udp 41819903 22.33.44.55 61405 typ relay raddr 11.22.33.44 rport 52546 a=end-of-candidates - m=application 52546 UDP/TLS/SCTP webrtc-datachannel + m=application 52546 UDP/DTLS/SCTP webrtc-datachannel c=IN IP4 11.22.33.44 a=mid:d1 a=fmtp:webrtc-datachannel max-message-size=65536 a=sctp-port 5000 a=ice-ufrag:ATEn1v9DoTMB9J4r a=ice-pwd:AtSK0WpNtpUjkY4+86js7ZQl a=ice-options:trickle a=fingerprint:sha-256 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:actpass + a=setup:passive a=candidate:109270923 1 udp 2122194687 192.168.1.2 51556 typ host a=candidate:4036177503 1 udp 1685987071 11.22.33.44 52546 typ srflx raddr 192.168.1.2 rport 51556 a=candidate:3671762466 1 udp 41819903 22.33.44.55 61405 typ relay raddr 11.22.33.44 rport 52546 a=end-of-candidates m=video 52546 UDP/TLS/RTP/SAVPF 100 101 c=IN IP4 11.22.33.44 a=rtcp:52546 IN IP4 11.22.33.44 a=mid:v1 @@ -2676,34 +3032,44 @@ [I-D.ietf-rtcweb-audio] Valin, J. and C. Bran, "WebRTC Audio Codec and Processing Requirements", draft-ietf-rtcweb-audio-02 (work in progress), August 2013. [I-D.ietf-rtcweb-data-protocol] Jesup, R., Loreto, S., and M. Tuexen, "WebRTC Data Channel Protocol", draft-ietf-rtcweb-data-protocol-04 (work in progress), February 2013. + [I-D.ietf-rtcweb-fec] + Uberti, J., "WebRTC Forward Error Correction + Requirements", draft-ietf-rtcweb-fec-00 (work in + progress), February 2015. + [I-D.ietf-rtcweb-rtp-usage] Perkins, C., Westerlund, M., and J. Ott, "Web Real-Time Communication (WebRTC): Media Transport and Use of RTP", draft-ietf-rtcweb-rtp-usage-09 (work in progress), September 2013. [I-D.ietf-rtcweb-security] Rescorla, E., "Security Considerations for WebRTC", draft- ietf-rtcweb-security-06 (work in progress), January 2014. [I-D.ietf-rtcweb-security-arch] Rescorla, E., "WebRTC Security Architecture", draft-ietf- rtcweb-security-arch-09 (work in progress), February 2014. + [I-D.ietf-rtcweb-video] + Roach, A., "WebRTC Video Processing and Codec + Requirements", draft-ietf-rtcweb-video-00 (work in + progress), July 2014. + [I-D.nandakumar-mmusic-proto-iana-registration] Nandakumar, S., "IANA registration of SDP 'proto' attribute for transporting RTP Media over TCP under various RTP profiles.", September 2014. [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. [RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, A., Peterson, J., Sparks, R., Handley, M., and E. @@ -2749,20 +3115,23 @@ [RFC5285] Singer, D. and H. Desineni, "A General Mechanism for RTP Header Extensions", RFC 5285, July 2008. [RFC5761] Perkins, C. and M. Westerlund, "Multiplexing RTP Data and Control Packets on a Single Port", RFC 5761, April 2010. [RFC5888] Camarillo, G. and H. Schulzrinne, "The Session Description Protocol (SDP) Grouping Framework", RFC 5888, June 2010. + [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. [RFC7022] Begen, A., Perkins, C., Wing, D., and E. Rescorla, "Guidelines for Choosing RTP Control Protocol (RTCP) Canonical Names (CNAMEs)", RFC 7022, September 2013. 11.2. Informative References @@ -2800,31 +3169,51 @@ [RFC5763] Fischl, J., Tschofenig, H., and E. Rescorla, "Framework for Establishing a Secure Real-time Transport Protocol (SRTP) Security Context Using Datagram Transport Layer Security (DTLS)", RFC 5763, May 2010. [RFC5764] McGrew, D. and E. Rescorla, "Datagram Transport Layer Security (DTLS) Extension to Establish Keys for the Secure Real-time Transport Protocol (SRTP)", RFC 5764, May 2010. + [RFC5956] Begen, A., "Forward Error Correction Grouping Semantics in + the Session Description Protocol", RFC 5956, September + 2010. + [W3C.WD-webrtc-20140617] 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-09:"> + + o Don't return null for {local,remote}Description after close(). + + o Changed TCP/TLS to UDP/DTLS in RTP profile names. + + o Separate out bundle and mux policy. + + o Added specific references to FEC mechanisms. + + o Added canTrickle mechanism. + + o Added section on subsequent answers and, answer options. + + o Added text defining set{Local,Remote}Description behavior. + Changes in draft-08: o Added new example section and removed old examples in appendix. o Fixed field handling. o Added text describing a=rtcp attribute. o Reworked handling of OfferToReceiveAudio and OfferToReceiveVideo per discussion at IETF 90.