Skip to content

audioaggregator: Resync on the next buffer when dropping a buffer on discont resyncing

If a buffer is dropped during resyncing on a discont because either its end offset is already before the current output offset of the aggregator or because it fully overlaps with the part of the current output buffer that was already filled, then don't just assume that the next buffer is going to start at exactly the expected offset. It might still require some more dropping of samples.

This caused the input to be mixed with an offset to its actual position in the output stream, causing additional latency and wrong synchronization between the different input streams.

Instead consider each buffer after a discont as a discont until the aggregator actually resynced and starts mixing samples from the input again.

Also update the start output offset of a new input buffer if samples have to be dropped at the beginning. Otherwise it might be mixed too early into the output and overwrite part of the output buffer that already took samples from this input into account.

Fixes #912 (closed) which is a regression introduced by !1180 (merged)

CC @ocrete @seungha.yang

Merge request reports