From 250885333256a85d1aabe4774149dbda47867311 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Mon, 14 Aug 2017 13:20:10 +0100 Subject: [PATCH] Wait for play session to fully terminate before acknowledging a TEARDOWN request. --- rtsp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rtsp.c b/rtsp.c index c4c2dd72..36d7b5ea 100644 --- a/rtsp.c +++ b/rtsp.c @@ -667,6 +667,9 @@ static void handle_teardown(rtsp_conn_info *conn, rtsp_message *req, rtsp_messag msg_add_header(resp, "Connection", "close"); debug(2, "TEARDOWN asking connection to stop"); conn->stop = 1; + memory_barrier(); + pthread_kill(conn->thread, SIGUSR1); + usleep(1000000); } static void handle_flush(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp) { @@ -1406,8 +1409,7 @@ static void handle_announce(rtsp_conn_info *conn, rtsp_message *req, rtsp_messag playing_conn->stop = 1; memory_barrier(); pthread_kill(playing_conn->thread, SIGUSR1); - usleep( - 1000000); // here, it is possible for other connections to come in and nab the player. + usleep(1000000); // here, it is possible for other connections to come in and nab the player. } } else { die("Non existent the_playing_conn with play_lock enabled.");