mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
splitmuxsink: Make sure flushing doesn't block
* Trying to disconnect a stream from a running splitmuxsink by flushing it results in the FLUSH_START blocking in the stream queue's gst_pad_pause_task because the flush did not unblock complete_or_wait_on_out, so add a check for ctx->flushing there. * Add a GST_SPLITMUX_BROADCAST_INPUT so check_completed_gop notices flushing changed and the incoming push is unblocked. * Pass the FLUSH_STOP along to the muxer without waiting. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/687>
This commit is contained in:
parent
af9e66d7a5
commit
28a616f693
1 changed files with 5 additions and 3 deletions
|
@ -1331,7 +1331,7 @@ complete_or_wait_on_out (GstSplitMuxSink * splitmux, MqStreamCtx * ctx)
|
||||||
} else {
|
} else {
|
||||||
GST_SPLITMUX_WAIT_OUTPUT (splitmux);
|
GST_SPLITMUX_WAIT_OUTPUT (splitmux);
|
||||||
}
|
}
|
||||||
} while (splitmux->output_state ==
|
} while (!ctx->flushing && splitmux->output_state ==
|
||||||
SPLITMUX_OUTPUT_STATE_AWAITING_COMMAND);
|
SPLITMUX_OUTPUT_STATE_AWAITING_COMMAND);
|
||||||
/* loop and re-check the state */
|
/* loop and re-check the state */
|
||||||
continue;
|
continue;
|
||||||
|
@ -1551,7 +1551,7 @@ handle_mq_output (GstPad * pad, GstPadProbeInfo * info, MqStreamCtx * ctx)
|
||||||
if (info->type & GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM ||
|
if (info->type & GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM ||
|
||||||
info->type & GST_PAD_PROBE_TYPE_EVENT_FLUSH) {
|
info->type & GST_PAD_PROBE_TYPE_EVENT_FLUSH) {
|
||||||
GstEvent *event = gst_pad_probe_info_get_event (info);
|
GstEvent *event = gst_pad_probe_info_get_event (info);
|
||||||
gboolean locked = FALSE;
|
gboolean locked = FALSE, wait = !ctx->is_reference;
|
||||||
|
|
||||||
GST_LOG_OBJECT (pad, "Event %" GST_PTR_FORMAT, event);
|
GST_LOG_OBJECT (pad, "Event %" GST_PTR_FORMAT, event);
|
||||||
|
|
||||||
|
@ -1570,12 +1570,14 @@ handle_mq_output (GstPad * pad, GstPadProbeInfo * info, MqStreamCtx * ctx)
|
||||||
if (ctx->is_reference)
|
if (ctx->is_reference)
|
||||||
splitmux->queued_keyframes = 0;
|
splitmux->queued_keyframes = 0;
|
||||||
ctx->flushing = FALSE;
|
ctx->flushing = FALSE;
|
||||||
|
wait = FALSE;
|
||||||
break;
|
break;
|
||||||
case GST_EVENT_FLUSH_START:
|
case GST_EVENT_FLUSH_START:
|
||||||
GST_SPLITMUX_LOCK (splitmux);
|
GST_SPLITMUX_LOCK (splitmux);
|
||||||
locked = TRUE;
|
locked = TRUE;
|
||||||
GST_LOG_OBJECT (pad, "Flush start");
|
GST_LOG_OBJECT (pad, "Flush start");
|
||||||
ctx->flushing = TRUE;
|
ctx->flushing = TRUE;
|
||||||
|
GST_SPLITMUX_BROADCAST_INPUT (splitmux);
|
||||||
GST_SPLITMUX_BROADCAST_OUTPUT (splitmux);
|
GST_SPLITMUX_BROADCAST_OUTPUT (splitmux);
|
||||||
break;
|
break;
|
||||||
case GST_EVENT_EOS:
|
case GST_EVENT_EOS:
|
||||||
|
@ -1691,7 +1693,7 @@ handle_mq_output (GstPad * pad, GstPadProbeInfo * info, MqStreamCtx * ctx)
|
||||||
* until the muxer / sink are ready for it */
|
* until the muxer / sink are ready for it */
|
||||||
if (!locked)
|
if (!locked)
|
||||||
GST_SPLITMUX_LOCK (splitmux);
|
GST_SPLITMUX_LOCK (splitmux);
|
||||||
if (!ctx->is_reference)
|
if (wait)
|
||||||
complete_or_wait_on_out (splitmux, ctx);
|
complete_or_wait_on_out (splitmux, ctx);
|
||||||
GST_SPLITMUX_UNLOCK (splitmux);
|
GST_SPLITMUX_UNLOCK (splitmux);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue