Re: DTMF again

On 12/21/2011 04:24 AM, Justin Uberti wrote:
>
>
> On Thu, Dec 15, 2011 at 11:57 AM, Timothy B. Terriberry
> <tterriberry@mozilla.com <mailto:tterriberry@mozilla.com>> wrote:
>
>         DTMF or not. So it is best to have the API there always.
>
>
>     Some more thinking through why this could be a problem:
>
>     What happens if I have a MediaStream that's fed into a
>     ProcessedMediaStream to do some mixing, and I call sendDTMF on the
>     _input_ to that ProcessedMediaStream, rather than the output? If the
>     API is always there, this is something that's easy to do (even if
>     just by mistake), but the result I would expect from a real
>     implementation is that the DTMF tones are inserted as actual audio
>     into the MediaStream being fed into the ProcessedMediaStream
>     (because it isn't directly connected to any PeerConnection), rather
>     than as RFC 2833/etc. packets, which is clearly a bad thing. Now you
>     need to hope the far end has a DTMF decoder, and that it works, and
>     that your ProcessedMediaStream didn't distort the audio so much that
>     it breaks it. Whereas if you'd called sendDTMF on the output of the
>     ProcessedMediaStream, you could use negotiated support for a direct
>     encoding of the data.
>
>     I consider this a clear failure of the "hard-to-misuse" API design
>     principle.
>
>
> Yeah, this is definitely a pathological case, because there isn't a
> clear good way to handle this (AFAICT). Depending on what kind of
> processing the ProcessedMediaStream is doing, you may or may not want
> DTMF tones to pass through.
>
> My suggestion would be to fail insertDTMF() if the relevant stream isn't
> directly connected to an audio renderer or a PeerConnection. Certainly
> open to other proposals though.

Perhaps that is the way to do it. I assume that it would only accept 
insertDTMF if the PeerConnection in question has gotten accept for DTMF 
(there is probably some offer/answer with the other end involved).

Then there are of course the corner cases: a MediaStream (with an audio 
track) can be connected both two PeerConnections; one is DTMF capable, 
the other not.

It seems hard to find a perfect and fool proof solution...

>

Received on Wednesday, 21 December 2011 14:59:38 UTC