Re: Issue #39: What happens when X is omitted from dictionary Y

Martin Thomson said: 

Attributes in dictionaries are optional. That means that the spec needs to define what happens when an attribute is omitted. For every attribute. The easiest way to do this is to define a default value.

[BA] I agree that this needs to be fixed.  At the moment, the specification uses "?" within several dictionary definitions (to denote optional values??). 

Among other things, this issue would appear to impact when an RTCRtpUnhandledEvent will fire. 

The event is supposed to fire if there is no RTCRtpReceiver object set up to handle an incoming RTP packet, but the precise conditions are not well defined: 

[Constructor(RTCDtlsTransport transport)]
interface RTCRtpReceiver {
    readonly    attribute MediaStreamTrack? track;
    readonly    attribute RTCDtlsTransport  transport;
    static RTCRtpCapabilities getCapabilities ();
    static RTCRtpParameters   createParameters (DOMString kind, optional RTCRtpCapabilities capabilities);
    static RTCRtpParameters   filterParameters (RTCRtpParameters parameters, optional RTCRtpCapabilities capabilities);
    void                      receive (RTCRtpParameters parameters);
    void                      stop ();
};

dictionary RTCRtpParameters {
    DOMString?                                receiverId;
    sequence<RTCRtpCodecParameters>           codecs;
    sequence<RTCRtpHeaderExtensionParameters> headerExtensions;
    sequence<RTCRtpEncodingParameters>        encodings;
};

dictionary RTCRtpCodecParameters {
    unsigned byte                  payloadType;
    RTCRtpCodec                    codec;
    sequence<KeyValueParam>        formatParameters;
    sequence<RTCRtcpFeedbackParam> rtcpFeedbackParameters;
};

dictionary RTCRtpEncodingParameters {
    unsigned int         ssrc;
    DOMString?           codecName;
    RTCRtpFecParameters? fec;
    RTCRtpRtxParameters? rtx;
    int                  TODO;
};

Some questions raised by the above (ignore the "?" in the dictionary definitions): 

a. If there is no SSRC value in the RTCRtpEncodingParameters object corresponding to a given codecName, does that mean that an RTP packet only needs to match the payloadType value  in RTCRtpCodecParameters? (e.g. that codec is expecting to handle only one SSRC at a time and will switch between them).   Omitting the SSRC might be useful for an audio codec only expecting to receive a single stream (or intending to switch between SSRCs if more than one were to arrive), without having to handle an RTP unhandled event for the initial or subsequent SSRCs (which could result in additional delay and/or packet loss). 

b. What if there is no payloadType value in the RTCRtpCodecParameters object, but there is an SSRC value in the RTCRtpEncodingParameters object?  Does that mean that this codec will only be used for SSRCs matching the specified value, regardless of the payloadType value (e.g. the codec has no defined PT, only a defined SSRC)?  Or is this an error? (e.g. a payloadType value always needs to be specified). 

c. What happens if there is no receiverId value in the RTCRtpParameters object? (presumably an appId if present would be ignored). 

Received on Tuesday, 1 April 2014 23:58:51 UTC