From 605590606f2ea26b5abf293fc5eee4504e39b2d1 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Mon, 20 Jun 2016 02:22:40 -0700 Subject: [PATCH] obs-outputs: Remove send_remaining_packets Because output stop timing has been fixed, there is no need to send the remaining packets in the queue because it now just waits for the stop timing anyway. --- plugins/obs-outputs/rtmp-stream.c | 32 +------------------------------ 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/plugins/obs-outputs/rtmp-stream.c b/plugins/obs-outputs/rtmp-stream.c index 5b3fa5e8e..ccf7bde7e 100644 --- a/plugins/obs-outputs/rtmp-stream.c +++ b/plugins/obs-outputs/rtmp-stream.c @@ -313,33 +313,6 @@ static int send_packet(struct rtmp_stream *stream, static inline bool send_headers(struct rtmp_stream *stream); -static bool send_remaining_packets(struct rtmp_stream *stream) -{ - struct encoder_packet packet; - uint64_t max_ns = (uint64_t)stream->max_shutdown_time_sec * 1000000000; - uint64_t begin_time_ns = os_gettime_ns(); - - if (!stream->sent_headers) { - if (!send_headers(stream)) - return false; - } - - while (get_next_packet(stream, &packet)) { - if (send_packet(stream, &packet, false, packet.track_idx) < 0) - return false; - - /* Just disconnect if it takes too long to shut down */ - if ((os_gettime_ns() - begin_time_ns) > max_ns) { - info("Took longer than %d second(s) to shut down, " - "automatically stopping connection", - stream->max_shutdown_time_sec); - return false; - } - } - - return true; -} - static void *send_thread(void *data) { struct rtmp_stream *stream = data; @@ -367,12 +340,8 @@ static void *send_thread(void *data) } } - if (!disconnected(stream) && !send_remaining_packets(stream)) - os_atomic_set_bool(&stream->disconnected, true); - if (disconnected(stream)) { info("Disconnected from %s", stream->path.array); - free_packets(stream); } else { info("User stopped the stream"); } @@ -384,6 +353,7 @@ static void *send_thread(void *data) obs_output_signal_stop(stream->output, OBS_OUTPUT_DISCONNECTED); } + free_packets(stream); os_event_reset(stream->stop_event); os_atomic_set_bool(&stream->active, false); stream->sent_headers = false;