From 718d31fe63c734e4cd6b9b05960b69b2f2d9d626 Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Mon, 16 May 2022 14:40:41 +0200 Subject: [PATCH] splitmuxsink: When flushing, exit handle_mq_input quickly 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: --- .../gst/multifile/gstsplitmuxsink.c | 15 ++++++--------- .../gst/multifile/gstsplitmuxsink.h | 1 - 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c b/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c index e517800dca..8fa6f1b7f2 100644 --- a/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c +++ b/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c @@ -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); diff --git a/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.h b/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.h index 7cf8c45124..140149adc1 100644 --- a/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.h +++ b/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.h @@ -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;