This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new 62508d7629 fftools/ffplay: exit via do_exit() on termination signal
62508d7629 is described below

commit 62508d7629d820e1968016112d2d3594447a4fdb
Author:     Thomas Devoogdt <[email protected]>
AuthorDate: Sun Jul 19 19:23:45 2026 +0200
Commit:     Marvin Scholz <[email protected]>
CommitDate: Wed Sep 16 17:03:53 2026 +0000

    fftools/ffplay: exit via do_exit() on termination signal
    
    sigterm_handler() called exit(123) directly, bypassing
    avformat_close_input() and therefore any protocol level shutdown, such as
    the RTSP TEARDOWN.  Set a flag instead and let the event loop leave
    through do_exit(), which keeps the 123 exit status.
    
    Add a hard exit on the 4th sigterm, similar to ffmpeg.
    
    Signed-off-by: Thomas Devoogdt <[email protected]>
---
 fftools/ffplay.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 31dca9a7fa..b9d9641582 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -362,6 +362,10 @@ static int64_t audio_callback_time;
 
 #define FF_QUIT_EVENT    (SDL_USEREVENT + 2)
 
+static volatile sig_atomic_t received_sigterm = 0;
+static volatile int received_nb_signals = 0;
+static int exit_status = 0;
+
 static SDL_Window *window;
 static SDL_Renderer *renderer;
 static SDL_RendererInfo renderer_info = {0};
@@ -1368,12 +1372,14 @@ static void do_exit(VideoState *is)
         printf("\n");
     SDL_Quit();
     av_log(NULL, AV_LOG_QUIET, "%s", "");
-    exit(0);
+    exit(exit_status);
 }
 
 static void sigterm_handler(int sig)
 {
-    exit(123);
+    received_sigterm = sig;
+    if (++received_nb_signals > 3)
+        exit(123);
 }
 
 static void set_default_window_size(int width, int height, AVRational sar)
@@ -3404,6 +3410,10 @@ static void refresh_loop_wait_event(VideoState *is, 
SDL_Event *event) {
     double remaining_time = 0.0;
     SDL_PumpEvents();
     while (!SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, 
SDL_LASTEVENT)) {
+        if (received_sigterm) {
+            exit_status = 123;
+            do_exit(is);
+        }
         if (!cursor_hidden && av_gettime_relative() - cursor_last_shown > 
CURSOR_HIDE_DELAY) {
             SDL_ShowCursor(0);
             cursor_hidden = 1;

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to