[FFmpeg-devel] [PATCH] ffmpeg.c: use sigterm_handler with sigpipe

Mark Thompson sw at jkqxz.net
Thu Jan 18 18:30:14 EET 2018


On 18/01/18 16:02, Carl Eugen Hoyos wrote:
> 2018-01-18 16:55 GMT+01:00 Mark Thompson <sw at jkqxz.net>:
> 
>> Setting the termination option in the ffmpeg program or not shouldn't
>> make a difference to the behaviour inside the muxer
> 
> How did you test this?

The signal is received by a write call deep inside lavf, and it runs the signal handler which sets the termination option but doesn't actually act on it immediately.  The signal handler returns and the write call returns EPIPE, which then has to be handled correctly by all callers up the stack before the ffmpeg program even gets a chance to check the termination option at all.

>From a little bit of testing with named pipes ignoring the signal does appear to have the right effect (fails in one muxer and closes the other cleanly), so I think that's probably the right answer.

- Mark


More information about the ffmpeg-devel mailing list