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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1030>
This commit is contained in:
Jan Alexander Steffens (heftig) 2022-05-16 14:40:41 +02:00 committed by GStreamer Marge Bot
parent fd27ee1537
commit 718d31fe63
2 changed files with 6 additions and 10 deletions

View 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);

View 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;