Fix native PCM startup stall at the queue gate

The PCM queue cap was applied before the first output sample.  For any
input longer than about two seconds the gate could trigger while
samples_out was still zero, emit() had nothing to return, and process_pcm
returned without marking filter progress.  The decoder thread then stopped
and audio never became ready; short clips and E-AC-3 JOC were unaffected.

Only apply the cap after the first output sample, and mark progress when
the gate cannot emit.  This keeps the EOF flush bounded without blocking
startup.
This commit is contained in:
TheM14 committed 2026-11-14 02:53:36 +08:00
1 parent e5954169b2
commit 587ff24e86
1 file changed
+3 -1
+3 -1
View File
@@ -567,9 +567,11 @@ static void process_pcm(struct mp_filter *f)
* kernel keeps a rendered-output queue but its input queue is unbounded;
* without this gate a whole track can pile up and flush() at EOF renders
* all of it at once. */
if (!p->eof && p->pcm_input_samples > p->samples_out + PCM_MAX_QUEUE_SAMPLES) {
if (p->samples_out > 0 && !p->eof &&
p->pcm_input_samples > p->samples_out + PCM_MAX_QUEUE_SAMPLES) {
if (emit(f))
return;
mp_filter_internal_mark_progress(f);
return;
}