diff options
author | Vivia Nikolaidou <vivia@ahiru.eu> | 2020-12-10 14:27:49 +0200 |
---|---|---|
committer | GStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2020-12-16 06:17:08 +0000 |
commit | 81d2f67ba5e926d864f711338eb0e78a0e2a1fdb (patch) | |
tree | d90c4e5c5b6cd91334c6575b6392c1a3843ed0e7 /gst/multifile/gstsplitmuxsink.c | |
parent | ff1dd307f2e2733628590a3875f8838cb6d1d979 (diff) | |
download | gstreamer-plugins-good-81d2f67ba5e926d864f711338eb0e78a0e2a1fdb.tar.gz |
splitmuxsink: Avoid deadlock when releasing a pad from a running muxer
Might not drain correctly
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/838>
Diffstat (limited to 'gst/multifile/gstsplitmuxsink.c')
-rw-r--r-- | gst/multifile/gstsplitmuxsink.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/gst/multifile/gstsplitmuxsink.c b/gst/multifile/gstsplitmuxsink.c index b6d7f1815..093f5a501 100644 --- a/gst/multifile/gstsplitmuxsink.c +++ b/gst/multifile/gstsplitmuxsink.c @@ -2768,7 +2768,12 @@ handle_mq_input (GstPad * pad, GstPadProbeInfo * info, MqStreamCtx * ctx) switch (splitmux->input_state) { case SPLITMUX_INPUT_STATE_COLLECTING_GOP_START: - if (ctx->is_reference) { + 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) { /* This is the reference context. If it's a keyframe, * it marks the start of a new GOP and we should wait in * check_completed_gop before continuing, but either way @@ -3232,6 +3237,9 @@ gst_splitmux_sink_release_pad (GstElement * element, GstPad * pad) GST_SPLITMUX_LOCK (splitmux); + ctx->is_releasing = TRUE; + GST_SPLITMUX_BROADCAST_INPUT (splitmux); + /* Can release the context now */ mq_stream_ctx_free (ctx); if (ctx == splitmux->reference_ctx) @@ -3254,6 +3262,10 @@ gst_splitmux_sink_release_pad (GstElement * element, GstPad * pad) if (splitmux->contexts == NULL) gst_splitmux_reset_elements (splitmux); + /* Wake up other input streams to check if the completion conditions have + * changed */ + GST_SPLITMUX_BROADCAST_INPUT (splitmux); + fail: GST_SPLITMUX_UNLOCK (splitmux); } |