From 34ca46c786efffd9ba72a5ffa08b26fc04dde943 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Fri, 14 Oct 2022 16:21:07 -0400 Subject: [PATCH] rtmp2sink: Correctly return GST_FLOW_ERROR on error If there is an error while connecting, the streaming task will be stopped, and is_running() will be false, causing a GST_FLOW_FLUSHING to be returned. Instead, we perform the error check (!self->connection) first, to return an error if that's what occured. Part-of: --- subprojects/gst-plugins-bad/gst/rtmp2/gstrtmp2sink.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst/rtmp2/gstrtmp2sink.c b/subprojects/gst-plugins-bad/gst/rtmp2/gstrtmp2sink.c index 46dbe35..3cc6983 100644 --- a/subprojects/gst-plugins-bad/gst/rtmp2/gstrtmp2sink.c +++ b/subprojects/gst-plugins-bad/gst/rtmp2/gstrtmp2sink.c @@ -861,13 +861,13 @@ gst_rtmp2_sink_render (GstBaseSink * sink, GstBuffer * buffer) g_cond_wait (&self->cond, &self->lock); } - if (G_UNLIKELY (!is_running (self))) { - gst_buffer_unref (message); - ret = GST_FLOW_FLUSHING; - } else if (G_UNLIKELY (!self->connection)) { + if (G_UNLIKELY (!self->connection)) { gst_buffer_unref (message); /* send_connect_error has sent an ERROR message */ ret = GST_FLOW_ERROR; + } else if (G_UNLIKELY (!is_running (self))) { + gst_buffer_unref (message); + ret = GST_FLOW_FLUSHING; } else { send_streamheader (self); send_message (self, message); -- 2.7.4