splitmuxsink: When flushing, exit handle_mq_input quickly
authorJan Alexander Steffens (heftig) <jan.steffens@ltnglobal.com>
Mon, 16 May 2022 12:40:41 +0000 (14:40 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 17 May 2022 09:24:10 +0000 (09:24 +0000)
If we just break the loop, we might run into the `gop != NULL` assert
that follows it. Rather, exit immediately with flushing flow.

Also use this flushing mechanism when we release a pad. This avoids
having an extra flag.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1030>

subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c
subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.h

index e517800..8fa6f1b 100644 (file)
@@ -3081,17 +3081,14 @@ handle_mq_input (GstPad * pad, GstPadProbeInfo * info, MqStreamCtx * ctx)
 
   loop_again = TRUE;
   do {
-    if (ctx->flushing)
-      break;
+    if (ctx->flushing) {
+      ret = GST_FLOW_FLUSHING;
+      goto beach;
+    }
 
     switch (splitmux->input_state) {
       case SPLITMUX_INPUT_STATE_COLLECTING_GOP_START:
-        if (ctx->is_releasing) {
-          /* The pad belonging to this context is being released */
-          GST_WARNING_OBJECT (pad, "Pad is being released while the muxer is "
-              "running. Data might not drain correctly");
-          loop_again = FALSE;
-        } else if (ctx->is_reference) {
+        if (ctx->is_reference) {
           const InputGop *gop, *next_gop;
 
           /* This is the reference context. If it's a keyframe,
@@ -3576,7 +3573,7 @@ gst_splitmux_sink_release_pad (GstElement * element, GstPad * pad)
   /* Remove the context from our consideration */
   splitmux->contexts = g_list_remove (splitmux->contexts, ctx);
 
-  ctx->is_releasing = TRUE;
+  ctx->flushing = TRUE;
   GST_SPLITMUX_BROADCAST_INPUT (splitmux);
 
   GST_SPLITMUX_UNLOCK (splitmux);
index 7cf8c45..140149a 100644 (file)
@@ -104,7 +104,6 @@ typedef struct _MqStreamCtx
   gboolean out_eos_async_done;
   gboolean need_unblock;
   gboolean caps_change;
-  gboolean is_releasing;
 
   GstSegment in_segment;
   GstSegment out_segment;