diff options
author | Jan Alexander Steffens (heftig) <jan.steffens@ltnglobal.com> | 2020-07-31 14:50:13 +0300 |
---|---|---|
committer | GStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2020-08-04 18:15:27 +0300 |
commit | 28a616f6933f11cab372cf4e1bb143b99c89bd0c (patch) | |
tree | e7d45610c6cf6d2ca93be8bbc4cf8b0f0c9365f2 /gst | |
parent | af9e66d7a575d8bb8c2f9dc12660c989eebe2032 (diff) |
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>
Diffstat (limited to 'gst')
-rw-r--r-- | gst/multifile/gstsplitmuxsink.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gst/multifile/gstsplitmuxsink.c b/gst/multifile/gstsplitmuxsink.c index 0dc75889b..bd45dfd08 100644 --- a/gst/multifile/gstsplitmuxsink.c +++ b/gst/multifile/gstsplitmuxsink.c @@ -1331,7 +1331,7 @@ complete_or_wait_on_out (GstSplitMuxSink * splitmux, MqStreamCtx * ctx) } else { GST_SPLITMUX_WAIT_OUTPUT (splitmux); } - } while (splitmux->output_state == + } while (!ctx->flushing && splitmux->output_state == SPLITMUX_OUTPUT_STATE_AWAITING_COMMAND); /* loop and re-check the state */ continue; @@ -1551,7 +1551,7 @@ handle_mq_output (GstPad * pad, GstPadProbeInfo * info, MqStreamCtx * ctx) if (info->type & GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM || info->type & GST_PAD_PROBE_TYPE_EVENT_FLUSH) { 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); @@ -1570,12 +1570,14 @@ handle_mq_output (GstPad * pad, GstPadProbeInfo * info, MqStreamCtx * ctx) if (ctx->is_reference) splitmux->queued_keyframes = 0; ctx->flushing = FALSE; + wait = FALSE; break; case GST_EVENT_FLUSH_START: GST_SPLITMUX_LOCK (splitmux); locked = TRUE; GST_LOG_OBJECT (pad, "Flush start"); ctx->flushing = TRUE; + GST_SPLITMUX_BROADCAST_INPUT (splitmux); GST_SPLITMUX_BROADCAST_OUTPUT (splitmux); break; 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 */ if (!locked) GST_SPLITMUX_LOCK (splitmux); - if (!ctx->is_reference) + if (wait) complete_or_wait_on_out (splitmux, ctx); GST_SPLITMUX_UNLOCK (splitmux); |