mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
splitmuxsink: fix sink pad release while PLAYING
- Release the split mux lock while removing the probes - Flush the sinkpad to unblock other pads - Turn check_completed_gop into a do while statement, when waking up we want to recheck whether the current GOP is ready for sending Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/719>
This commit is contained in:
parent
8f684913cf
commit
19860200ed
1 changed files with 60 additions and 52 deletions
|
@ -2453,6 +2453,7 @@ check_completed_gop (GstSplitMuxSink * splitmux, MqStreamCtx * ctx)
|
|||
return;
|
||||
}
|
||||
|
||||
do {
|
||||
if (splitmux->input_state == SPLITMUX_INPUT_STATE_WAITING_GOP_COLLECT) {
|
||||
gboolean ready = TRUE;
|
||||
|
||||
|
@ -2488,8 +2489,8 @@ check_completed_gop (GstSplitMuxSink * splitmux, MqStreamCtx * ctx)
|
|||
|
||||
/* The user has requested a split, we can split now that the previous GOP
|
||||
* has been collected to the correct location */
|
||||
if (g_atomic_int_compare_and_exchange (&(splitmux->split_requested), TRUE,
|
||||
FALSE)) {
|
||||
if (g_atomic_int_compare_and_exchange (&(splitmux->split_requested),
|
||||
TRUE, FALSE)) {
|
||||
g_atomic_int_set (&(splitmux->do_split_next_gop), TRUE);
|
||||
}
|
||||
}
|
||||
|
@ -2502,15 +2503,16 @@ check_completed_gop (GstSplitMuxSink * splitmux, MqStreamCtx * ctx)
|
|||
|
||||
/* Some pad is not yet ready, or GOP is being pushed
|
||||
* either way, sleep and wait to get woken */
|
||||
while (splitmux->input_state == SPLITMUX_INPUT_STATE_WAITING_GOP_COLLECT &&
|
||||
|
||||
if (splitmux->input_state == SPLITMUX_INPUT_STATE_WAITING_GOP_COLLECT &&
|
||||
!ctx->flushing &&
|
||||
(ctx->in_running_time >= splitmux->max_in_running_time) &&
|
||||
(splitmux->max_in_running_time != GST_CLOCK_STIME_NONE)) {
|
||||
|
||||
GST_LOG_OBJECT (splitmux, "Sleeping for GOP collection (ctx %p)", ctx);
|
||||
GST_SPLITMUX_WAIT_INPUT (splitmux);
|
||||
GST_LOG_OBJECT (splitmux, "Done waiting for complete GOP (ctx %p)", ctx);
|
||||
}
|
||||
} while (splitmux->input_state == SPLITMUX_INPUT_STATE_WAITING_GOP_COLLECT);
|
||||
}
|
||||
|
||||
static GstPadProbeReturn
|
||||
|
@ -3160,12 +3162,18 @@ gst_splitmux_sink_release_pad (GstElement * element, GstPad * pad)
|
|||
/* Remove the context from our consideration */
|
||||
splitmux->contexts = g_list_remove (splitmux->contexts, ctx);
|
||||
|
||||
if (ctx->sink_pad_block_id)
|
||||
GST_SPLITMUX_UNLOCK (splitmux);
|
||||
|
||||
if (ctx->sink_pad_block_id) {
|
||||
gst_pad_remove_probe (ctx->sinkpad, ctx->sink_pad_block_id);
|
||||
gst_pad_send_event (ctx->sinkpad, gst_event_new_flush_start ());
|
||||
}
|
||||
|
||||
if (ctx->src_pad_block_id)
|
||||
gst_pad_remove_probe (ctx->srcpad, ctx->src_pad_block_id);
|
||||
|
||||
GST_SPLITMUX_LOCK (splitmux);
|
||||
|
||||
/* Can release the context now */
|
||||
mq_stream_ctx_free (ctx);
|
||||
if (ctx == splitmux->reference_ctx)
|
||||
|
|
Loading…
Reference in a new issue