Re: Issue 141: Mandatory "kind" in RTCRtpReceiver constructor

On Tue, Aug 5, 2014 at 11:03 AM, Bernard Aboba
<Bernard.Aboba@microsoft.com> wrote:
> Peter Thatcher said:
>
> "Wouldn't the RtpReceiver know if it's audio or video as soon as the RtpParameters are passed into receive()?"
>
> [BA] Currently, "kind" is not passed to receive, only RTCRtpParameters which looks like this:
>
> dictionary RTCRtpParameters {
>     DOMString                                 muxId = "";
>     sequence<RTCRtpCodecParameters>           codecs;
>     sequence<RTCRtpHeaderExtensionParameters> headerExtensions;
>     sequence<RTCRtpEncodingParameters>        encodings;
>     RTCRtcpParameters                         rtcp;
> };
>
> RTCRtpCodecParameters does not include "kind", although RTCRtpCodecCapabilities does include it:
>
> partial dictionary RTCRtpCodecParameters {
>     DOMString                 name = "";
>     payloadtype               payloadType;
> };
>
> partial dictionary RTCRtpCodecCapability {
>     DOMString                 name = "";
>     DOMString                 kind;
>     payloadtype               preferredPayloadType;
> };
>
> So it seems that an implementation would need to match RTCRtpParameters.codecs[i].name against RTCRtpCodecCapability.name in order to determine the "kind" of each of the codecs.

Right, and I think this is easy to do in the implementation.  In fact,
if we had the JS pass down  the kind explicitly, it would still need
to do so anyway, because if the JS passes down kind=audio, and then
passes down video codecs, the implementation should complain.   So, it
needs to check either way, and I'd prefer not having duplicate,
possibly contradictory parameters.

>
> Since the intended "kind" is typically known when the RTCRtpReceiver object is created (it is always known for WebRTC 1.0), this seems like something that need not wait until packets are received to be determined.

The time at which the kind is known, the codecs will probably be know
also.  If we can think of a use case where the receiver knows the kind
and wants a track but doesn't know the codecs yet, then I could see a
reason for the JS to pass down the kind explicitly.  But I don't know
of such a use case.

Received on Tuesday, 5 August 2014 18:20:31 UTC