W3C home > Mailing lists > Public > public-webrtc@w3.org > August 2012

Re: [Bug 18485] Change DTMF API to be on PeerConnection

From: Martin Thomson <martin.thomson@gmail.com>
Date: Wed, 8 Aug 2012 16:40:53 -0700
Message-ID: <CABkgnnUsd6hUeuMSdyxNnS_5GvBn43UW=dxPnjcx6iZuWO4ncg@mail.gmail.com>
To: Justin Uberti <juberti@google.com>
Cc: Stefan Hakansson LK <stefan.lk.hakansson@ericsson.com>, public-webrtc@w3.org
On 8 August 2012 14:26, Justin Uberti <juberti@google.com> wrote:
> Option D seems like a good way to get what we need without spending too much
> effort on this legacy use case.

The problem with all of these - D included - is that DTMF is not
prearranged at the point that the track is added to the
PeerConnection, so either all streams have DTMF negotiated or none do.
 The former ensures that some negotiations will fail (or remove DTMF),
but will ensure that the DTMF is available everywhere it can be.  The
latter forces applications to add DTMF themselves, probably by SDP
bashing.

Given how much we care for this legacy use case - and I care even less
than most - I would suggest the API that minimizes impact on existing
APIs.  Randell's basic suggestion is good, the choice of
implementation point is not:

> Personally, I'd have SendDTMF() operate on a MediaStreamTrack, and be an
> event.  This would mean that if you have a MediaStreamTrack connected to two
> PeerConnections (quite possible), the event would be cloned and bubble up to
> both PeerConnections, which would then send DTMF (if possible).  I'd have
> PlayDTMF() operate on a track in remote or localstream via PeerConnection,
> and it would insert tones.

As I described separately, I'm not convinced that adding more stuff to
PeerConnection is the right answer, and I'm interested in learning why
this choice is considered superior to the current proposal, or
something even more explicit as I outlined.

That is, send:

var track = new DtmfAudioStreamTrack(stream.audioTracks[0]);
stream = new MediaStream(track);
track.sendTones('12');

Receive:

var track = pc.remoteStreams[0].audioTracks[0];
if (track instanceof DtmfAudioStreamTrack) {
    track.addEventListener('tone', function(dtmfEvent) {
        if (dtmfEvent.state === 'start') {
            dtmfTones[dtmfEvent.tone].enable();
            keyLog += dtmfEvent.tone;
        } else if (dtmfEvent.state === 'end') {
            dtmfTones[dtmfEvent.tone].disable();
        }
    });
}
Received on Wednesday, 8 August 2012 23:41:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 8 August 2012 23:41:16 GMT