ffmpeg: Don't trigger url_interrupt_cb on the first signal

Currently, the url_interrupt_cb callback will abort all IO
after the first received signal. This makes the output files
from e.g. the mov muxer to be unreadable if the transcode is
aborted with ctrl+c.

After this patch, the first signal cleanly breaks out of
the transcoding loop, but won't forcibly abort all IO.
After the second signal is received, the url_interrupt_cb
callback will abort all IO.

Signed-off-by: Martin Storsjö <martin@martin.st>
pull/2/head
Martin Storsjö 14 years ago
parent 8089b7fa8c
commit a121754852
  1. 4
      ffmpeg.c

@ -426,11 +426,13 @@ static void term_exit(void)
} }
static volatile int received_sigterm = 0; static volatile int received_sigterm = 0;
static volatile int received_nb_signals = 0;
static void static void
sigterm_handler(int sig) sigterm_handler(int sig)
{ {
received_sigterm = sig; received_sigterm = sig;
received_nb_signals++;
term_exit(); term_exit();
} }
@ -445,7 +447,7 @@ static void term_init(void)
static int decode_interrupt_cb(void) static int decode_interrupt_cb(void)
{ {
return received_sigterm; return received_nb_signals > 1;
} }
static int ffmpeg_exit(int ret) static int ffmpeg_exit(int ret)

Loading…
Cancel
Save