31a9dc384d
df4eb82 fixed a bug that caused source audio timestamps to perpetually lag. However, there is a deeper issue where after we reach max buffering, lagging sources make OBS's entire audio pipeline fall over. These may be corrected by later code, but still cause global audio glitches at best. Persistent problems, as prior to df4eb82, cause audio to fail entirely. The root cause is that OBS's audio mixing tree cannot deal with timestamps prior to the current audio tick. Intermediate mixing stages assume that the lowest incoming timestamp is the base of the current tick, and mix accordingly. This propagates lagged timestamps up the tree, where at the top level mix_audio will drop the source entirely - which at this point is a transition covering all inputs, thus glitching audio globally. Where extra buffering can cover the slip, the entire mix gets retried and the error corrected, but when the global buffer duration is maxed out, it makes it to the output. The solution is to catch laggy sources immediately after rendering, and drop audio to bring them back in sync, or mark them pending if not enough audio is available. This ensures later mixing stages are not fed with out of sync timestamps. This improves the ignore_audio code to only drop as much audio as needed to bring the source back in sync, and moves its call to immediately after source audio rendering.