rtmp2sink: Correctly return GST_FLOW_ERROR on error
authorArun Raghavan <arun@asymptotic.io>
Fri, 14 Oct 2022 20:21:07 +0000 (16:21 -0400)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Sat, 15 Oct 2022 08:21:40 +0000 (08:21 +0000)
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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3189>

subprojects/gst-plugins-bad/gst/rtmp2/gstrtmp2sink.c

index 46dbe35..3cc6983 100644 (file)
@@ -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);