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

Gyan Doshi ffmpeg at gyani.pro
Tue Feb 7 10:18:22 EET 2023



On 2023-02-07 01:39 pm, Anton Khirnov wrote:
> 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?

Yes.

Regards,
Gyan



More information about the ffmpeg-devel mailing list