From 5cfefce55e11f6b2da51f40d4c88a855bf3c206e Mon Sep 17 00:00:00 2001 From: jp9000 Date: Thu, 12 Oct 2017 09:56:47 -0700 Subject: [PATCH] obs-outputs: Only set stop events if still active The new code in 3032535f56 would signal that the output has stopped to the back-end and front-end, but the event used in the outputs themselves to shut down the send thread would still be signaled, causing the next connection to immediately stop as soon as it had started. This fixes it so that the event does not get signaled unless the thread is active. --- plugins/obs-outputs/ftl-stream.c | 2 +- plugins/obs-outputs/rtmp-stream.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/obs-outputs/ftl-stream.c b/plugins/obs-outputs/ftl-stream.c index 581d3524e..7db381482 100644 --- a/plugins/obs-outputs/ftl-stream.c +++ b/plugins/obs-outputs/ftl-stream.c @@ -257,7 +257,6 @@ static void ftl_stream_stop(void *data, uint64_t ts) } stream->stop_ts = ts / 1000ULL; - os_event_signal(stream->stop_event); if (ts) { stream->shutdown_timeout_ts = ts + @@ -265,6 +264,7 @@ static void ftl_stream_stop(void *data, uint64_t ts) } if (active(stream)) { + os_event_signal(stream->stop_event); if (stream->stop_ts == 0) os_sem_post(stream->send_sem); } else { diff --git a/plugins/obs-outputs/rtmp-stream.c b/plugins/obs-outputs/rtmp-stream.c index 53c03b909..d33969e97 100644 --- a/plugins/obs-outputs/rtmp-stream.c +++ b/plugins/obs-outputs/rtmp-stream.c @@ -178,13 +178,13 @@ static void rtmp_stream_stop(void *data, uint64_t ts) pthread_join(stream->connect_thread, NULL); stream->stop_ts = ts / 1000ULL; - os_event_signal(stream->stop_event); if (ts) stream->shutdown_timeout_ts = ts + (uint64_t)stream->max_shutdown_time_sec * 1000000000ULL; if (active(stream)) { + os_event_signal(stream->stop_event); if (stream->stop_ts == 0) os_sem_post(stream->send_sem); } else {