Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libobs: Fix pulseaudio monitoring, once and for all
This makes multiple changes to resolve issues with monitoring. We have added a number of things over time to resolve various issues due to our misunderstanding of the pulse api and the explicitly wrong pulse api documentation. First is removing the prior stream write tracking. Write tracking was incorrect as pulse sends you the total number of bytes it wants written at that time and not a incremental, but also this write tracking is unhelpful since we can just let begin_write signal when we should stop writing. Second removing underflow tracking, this sort of worked to detect high latency sources like vlc which buffer ~1s of data before writing audio data. It worked because it would grow the buffer in PA until we could write enough data into it, but it didn't allow us to leverage that larger buffer because we never paused the PA stream. To solve the buffering/high latency issue instead start the PA stream corked and only uncork it once we have enough data to reach the targeted latency. We also check how much data we recieve from the source and if it appears to be high latency providing us with much more data than our target latency we increase the latency to match the source. Fixing the VLC source issue and resulting in a smooth start to audio instead of underruns while we play and increase latency. Finally add some handling for pulses incorrectly documented API. Notably that begin_write may request more or less data from you so handle both cases. And stop attempting to use attr.maxlength which is not updated after set_buffer_attr calls and was always -1, and tlength is just more appropriate. old mantis resulting in some changes, still fixed. https://obsproject.com/mantis/view.php?id=1076 fixes #7574
- Loading branch information