AudioMixSettings.maxQueueMs property

Opt-in: the longest the mix waits for a pin that is behind.

By default the mix waits for every pin (for up to 10 s), so it runs as late as its latest pin: one talker 3 s behind delays everything this mixer puts out by 3 s, and a pin that stops sending holds it up altogether.

With this set, the mixer paces itself by a clock of its own, which runs in real time (on the engine’s clock, which the inputs' timestamps are on) and cannot stall. A pin more than maxQueueMs behind that clock no longer holds the mix back: the mix carries on without it, as if it were silent, and the audio it sends for moments that have already been mixed is discarded, not mixed late. When it catches up to within maxQueueMs it is back in the mix. A pin that sends nothing for longer than maxQueueMs is treated the same way.

A pin whose timestamps run AHEAD of real time (after a jump forward, say) does not make the others late: it waits for the clock, and is mixed when its timestamps come round. Its audio more than 10 s ahead is discarded.

What it costs: whenever a pin is late the mix runs up to maxQueueMs (plus about a frame, 40 ms) behind real time, so keep it small for low latency; and a pin that is always more than maxQueueMs behind is never heard, so make it larger than the lag you are prepared to wait for (a source that delivers in bursts loses each burst that arrives late). maxQueueMs counts from when the audio was received by Norsk, so it has to cover the time the audio takes to get to the mixer as well (decoding, and any jitter buffer on the way): set lower than that, every pin is late and the mix is silent.

Signature:

maxQueueMs?: number;