[FFmpeg-devel] [PATCH 2/2] RFC ffmpeg: exit demuxers earlier after signal received

Michael Niedermayer michael at niedermayer.cc
Sun Mar 14 23:25:33 EET 2021


On Sat, Nov 28, 2020 at 02:46:54PM -0500, Andriy Gelman wrote:
> From: Andriy Gelman <andriy.gelman at gmail.com>
> 
> We currently use the same interrupt_callback function for both muxers
> and demuxers to break out of potential infinite loops.
> 
> The function decode_interrupt_cb() checks for how many SIGINT/SIGTERM
> interrupts have been received, and (usually) two interrupts are needed to
> break out of an infinite loop.
> 
> If this condition is seen on the muxer, however, we will fail to flush the
> avio buffers (see retry_transfer_wrapper()).
> An example of this issue is seen in Ticket #9009 (which would be fixed
> by this patch).
> 
> A more robust alternative maybe to break out of demuxers with one
> interrupt. The error should propagate through, close the muxers and
> allow them to flush properly.
> (If the infinite loop is present on the muxer then a second interrupt would
> cause it break out and have the same behavior as before.)
> 
> This patch adds this behavior. I've labelled it RFC because it
> potentially touches many demuxers.
> ---
>  fftools/ffmpeg.c     | 6 ++++++
>  fftools/ffmpeg.h     | 1 +
>  fftools/ffmpeg_opt.c | 2 +-
>  3 files changed, 8 insertions(+), 1 deletion(-)

The idea is that a single SIG* would try to exit normally
if you on a single one do interrupt the IO this could result in 
some corruption on the input side.

If the goal is to improve the user experience and only
requirte a single SIGINT even in light of infinite loops
then some sort of automated staged interruption could be done.

that is keep trak of progress being made.
If the input is stuck and makes no progress for a period of
time then a signal could enable interruption immedeatly
similar for the output side.
otherwise a signal would only break the main loop cleanly

Thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20210314/1488e192/attachment.sig>


More information about the ffmpeg-devel mailing list