This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 2b72d5243ca1ac8687e6ffb42e186c81f42cad2b Author: Niklas Haas <[email protected]> AuthorDate: Fri May 15 18:17:52 2026 +0200 Commit: Niklas Haas <[email protected]> CommitDate: Sat May 23 08:41:12 2026 +0000 fftools/ffmpeg_sched: drain incoming frames before blocking filters When a filter is choked, but upstream threads are trying to write to its input, this can result in the filter's input queue getting stuck. Normally, the unchoke_downstream() logic would prevent this from happening, since the filter would itself get unchoked as a result of upstream decoders receiving pressure from the demuxer. However, upcoming changes to this logic will require weakening this upstream unchoking logic, so preventing the deadlock in a more elegant way helps with making the code more robust. Sponsored-by: nxtedition AB Signed-off-by: Niklas Haas <[email protected]> --- fftools/ffmpeg_sched.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/fftools/ffmpeg_sched.c b/fftools/ffmpeg_sched.c index 9070be614a..dddd1d2c67 100644 --- a/fftools/ffmpeg_sched.c +++ b/fftools/ffmpeg_sched.c @@ -2552,6 +2552,7 @@ int sch_filter_receive(Scheduler *sch, unsigned fg_idx, unsigned *in_idx, AVFrame *frame) { SchFilterGraph *fg; + int ret, idx; av_assert0(fg_idx < sch->nb_filters); fg = &sch->filters[fg_idx]; @@ -2572,13 +2573,19 @@ int sch_filter_receive(Scheduler *sch, unsigned fg_idx, } if (*in_idx == fg->nb_inputs) { + // drain incoming frames before waiting, to avoid blocking downstream + ret = tq_receive(fg->queue, &idx, frame, THREAD_QUEUE_FLAG_NO_BLOCK); + if (ret >= 0) { + av_assert0(idx >= 0); + *in_idx = idx; + return 0; + } + int terminate = waiter_wait(sch, &fg->waiter); return terminate ? AVERROR_EOF : AVERROR(EAGAIN); } while (1) { - int ret, idx; - ret = tq_receive(fg->queue, &idx, frame, 0); if (idx < 0) return AVERROR_EOF; _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
