W3C home > Mailing lists > Public > public-webrtc@w3.org > May 2016

Issue 651: addTrack/addTransceiver: need to be async?

From: Bernard Aboba <Bernard.Aboba@microsoft.com>
Date: Tue, 17 May 2016 17:03:02 +0000
To: "public-webrtc@w3.org" <public-webrtc@w3.org>
CC: Robin Raymond <robin@hookflash.com>
Message-ID: <DM2PR21MB0075EC0A1325EFC8428404E5EC480@DM2PR21MB0075.namprd21.prod.outlook.com>

In the situation where an RTCPeerConnection is constructed without supplying certificates created via generateCertificate(), certificates need to be created and this may happen some time after the RTCPeerConnection is constructed.   As a result, methods that depend on the creation of certificates such as createOffer() are Promise-based, so that certificate creation can be guaranteed to occur before they return (since this is needed to calculate fingerprints, for example).

Currently however, addTrack() and addTransceiver() are synchronous.   This raises questions about the state of the RTCDtlsTransport objects referenced in RTCRtpSender/RTCRtpReceiver objects created by these methods.


addTrack returns an RTCRtpSender:

    RTCRtpSender                addTrack(MediaStreamTrack track,

                                         MediaStream<http://w3c.github.io/webrtc-pc/#dfn-mediastream>... streams);

addTransceiver returns a transceiver:

RTCRtpTransceiver           addTransceiver((MediaStreamTrack or DOMString) trackOrKind,

                                               RTCRtpTransceiverInit init);

The RTCRtpSender includes read-only attributes for RTCDtlsTransport objects:

partial interface RTCRtpSender {

    readonly attribute RTCDtlsTransport  transport<http://w3c.github.io/webrtc-pc/#dom-rtcrtpsender-transport>;

    readonly attribute RTCDtlsTransport? rtcpTransport;


As does the RTCRtpReceiver:

partial interface RTCRtpReceiver {

    readonly attribute RTCDtlsTransport  transport<http://w3c.github.io/webrtc-pc/#dom-rtcrtpreceiver-transport>;

    readonly attribute RTCDtlsTransport? rtcpTransport<http://w3c.github.io/webrtc-pc/#dom-rtcrtpreceiver-rtcptransport>;


Here is the RTCDtlsTransport interface:

interface RTCDtlsTransport {

    readonly attribute RTCIceTransport       transport<http://w3c.github.io/webrtc-pc/#dom-rtcdtlstransport-transport>;

    readonly attribute RTCDtlsTransportState state<http://w3c.github.io/webrtc-pc/#dom-rtcdtlstransport-state>;

    sequence<ArrayBuffer> getRemoteCertificates();

             attribute EventHandler          onstatechange;


Currently, when addTrack()/addTransceiver() methods return, the RTCDtlsTransport objects may not necessarily have certificates.   If not, does RTCDtlsTransportState remain "new" until the certificate is created, at which time it can begin negotiation and transition to "connecting"?

Should addTrack()/addTransceiver() use Promises?  Or should applications assume that certificate creation is not assured until createOffer() returns?
Received on Tuesday, 17 May 2016 17:03:34 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 15:19:48 UTC