- If SSRC is present in SSRC table, forward RTP packet immediately to associated RtpReceiver
- Extract MID from RTP packet, search MuxID table for existing RtpReceiver; if match found add SSRC to SSRC table to point to RtpReceiver, forward immediately to RtpReceiver;
- In order of RtpReceiver object receive() being called, search for SSRC match inside encoding parameters as well as rtx.ssrc and fec.ssrc (if set). If match found add SSRC to SSRC table to point to RtpReceiver, forward immediately to RtpReceiver;
- In order of RtpReceiver object receive() being called (all checks done in same step):
- If encodings array is specified, search each encoding:
- If encodings[n].payloadTypee is specified, ensure a match of the incoming payload type matches (if not RTX/FEC codec).
- If the incoming payload type codec is an RTX codec, ensure encodings[n].rtx is set.
- If the incoming payload typecodec is an FEC codec, ensure the encodings[n].fec is set.
- If encodings[n].payloadTypes is NOT specified, ensure the codec is a memeber of the codec list.
- If any of the above is true, make a copy of the encodings[n] and fill in respective copy encodings[n].payloadType, and encodings[n].ssrc, or encodings[n].rtx.ssrc, or encodings[n].fec.ssrc as appropriate and prevent any latchings to this same encoding where a direct payload/SSRC match to the filled in copied information is not present. Add SSRC to SSRC table pointing to RtpReceiver. This can allow independent latching of media codecs, RTX codecs and FEC codes to the same encoding.
- If encodings array is empty, latch all inconing payload types types where the payload is a member of the receiver's codec list. Add SSRC to SSRC table pointing to RtpReceiver.
Additional note: When expiring SSRCs from SSRC table, the RtpReceiver's where copied information was filled via a latch in would become purged. For example, if the codec payload type and SSRC were filled into the copied information, both would expire and revert to the value contained in the original encoding. Media codecs, RTX and FEC SSRCS/codec values are independently expired from SSRC tables if they do not sure the same SSRC value.
Assumption is all RtpReceivers can only have unique MuxIDs and SSRCs although no error is dispatched if the RtpReceivers overlap values.
I believe that the current text comes pretty close (if not giving the same result) on items 1-3. A question about item 4:
If there are no encodings set, will payload types ever match? For example, imagine a VOIP call with a G.711 codec set in a single receiver, no encodings, no SSRCs or MIDs. Wondering if codecs[].payloadType comes into play.