[FFmpeg-devel] [PATCH] ffmpeg_mux: terminate stream thread queue only on sq_send EOF
Anton Khirnov
anton at khirnov.net
Tue Feb 7 10:33:50 EET 2023
Quoting Gyan Doshi (2023-02-07 09:18:22)
>
>
> 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.
How does that happen? Doesn't seem to me that muxers should do this.
Otherwise, I'm not a big fan of your patch since it adds yet more
overloading to ost->finished, which I'd like to remove actually. Not to
mention you manipulate it from the muxer thread, which is a race.
IMO this should be done without any context variables.
--
Anton Khirnov
More information about the ffmpeg-devel
mailing list