You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: libobs: the output interleaver batch limit grows on every restart of the same output #487
Each time an output starts, the interleaver adds the batch limit for the new capture onto the previous value instead of replacing it. After one restart (or a reconnect) the limit is double what it should be, after two it is triple, and so on. The catch-up that sends an extra packet when the interleave buffer backs up then triggers later and later, so a backlog drains more slowly than designed. Severity: low. There is no crash or data loss; it shows up as extra latency after stalls on outputs that restart.
Steps / trigger
Public API, with an output that has one 50 fps video encoder and one audio encoder at 48 kHz with 960-sample packets (both packet intervals are 20 ms, so the limit is four):
Start the output. With debug logging on, "Maximum interleaver batch size for ... calculated to be 4 packets" is logged.
Stop and start the same output object again (an automatic reconnect does the same). The log now says 8, then 12 after the next restart.
Queue five eligible packets past the ordinary send. On the first capture the catch-up sends a second packet; after the restart it sends only one, and the backlog stays queued.
Cause
Line numbers are against current master.
libobs/obs-output.c:2737-2780: calculate_batch_size does output->interleaver_max_batch_size += num (:2775) and never sets the field to zero first.
libobs/obs-output.c:2805: it is called from obs_output_begin_data_capture_internal on every start.
libobs/obs-internal.h:1281: the field is only zero-initialised when the output is created.
libobs/obs-output.c:2326: the catch-up check --streamable > output->interleaver_max_batch_size reads the inflated value.
Proposed fix
Reset interleaver_max_batch_size to zero at the start of calculate_batch_size. The regression test uses public encoder, output and media APIs. It creates one output, starts it twice, and checks that with exactly four, five and six eligible packets queued the delivery count is the same on the first capture and on the restart (one, two and two).
I'd like to work on this; a fix with a regression test is ready.
@chriscoveries go ahead: please open the PR with the RED test commit first, then the fix (one PR per issue, targeting master). Marking it claimed for you so nobody duplicates it.
Releasing this one. We're backed up on CI and won't get it landed soon, so anyone who wants it is welcome to take it.
If it helps, our RED test and fix are on the fork branch fix/interleave-batch-size-reset. They passed review on our side but haven't been through CI, so reuse them or start fresh, whichever you prefer.
Activity
zackees commentedon Oct 13, 2026
@chriscoveries go ahead: please open the PR with the RED test commit first, then the fix (one PR per issue, targeting master). Marking it claimed for you so nobody duplicates it.
chriscoveries commentedon Oct 14, 2026
Releasing this one. We're backed up on CI and won't get it landed soon, so anyone who wants it is welcome to take it.
If it helps, our RED test and fix are on the fork branch
fix/interleave-batch-size-reset. They passed review on our side but haven't been through CI, so reuse them or start fresh, whichever you prefer.