[FFmpeg-devel] [PATCH] ffmpeg_mux: terminate stream thread queue only on sq_send EOF

Anton Khirnov anton at khirnov.net
Tue Feb 7 10:09:34 EET 2023

Quoting Gyan Doshi (2023-02-04 11:01:21)
> Prior to 2d924b3a630, ffmpeg would exit if any packet write failed.
> After the switch to threaded mode for muxing, ffmpeg only closes that
> OutputStream instead of closng the file. This happens because EOF
> returned by write_packet isn't distinguished from EOF returned by sq_send,
> both relayed via sync_queue_process.
> This breaks the abort behaviour when there are multiple streams in an output,
> and can leave the ffmpeg process running beyond the intended point of abortion.
> Fixed by marking the OutputStream as finished upon sq_send EOF and letting
> write_packet EOF lead to muxer termination.

What is the situation you're handling exactly?
av_interleaved_write_frame() returns EOF?

Anton Khirnov

More information about the ffmpeg-devel mailing list