Commit c8d176c8 authored by HoonHee Lee's avatar HoonHee Lee

decodebin3: make sure to add free_slot to async pool only once

In our DVR scenario, audio track is removed over rate 2x and the audio track
is added again when it backs to 1x.

When this behaviour is doing as very quickly, crash could be happened by
multiqueue slot is freed 2 times at similar time.
  * call free_multiqueue_slot_async from parsebin_pad_removed_cb
  * call free_multiqueue_slot_async from (custom-)eos on mutiqueue post

To avoid this problem, make sure free_multiqueue_slot_async is called
only once.
parent 779704b8
Pipeline #38628 passed with stages
in 83 minutes and 11 seconds
......@@ -618,7 +618,10 @@ parsebin_pad_removed_cb (GstElement * demux, GstPad * pad, DecodebinInput * inp)
gst_pad_remove_probe (slot->src_pad, slot->probe_id);
slot->probe_id = 0;
dbin->slots = g_list_remove (dbin->slots, slot);
free_multiqueue_slot_async (dbin, slot);
if (!slot->free_async_marked) {
slot->free_async_marked = TRUE;
free_multiqueue_slot_async (dbin, slot);
}
}
SELECTION_UNLOCK (dbin);
} else {
......
......@@ -329,6 +329,8 @@ typedef struct _MultiQueueSlot
gboolean is_drained;
gboolean free_async_marked;
DecodebinOutputStream *output;
} MultiQueueSlot;
......@@ -1739,6 +1741,7 @@ multiqueue_src_probe (GstPad * pad, GstPadProbeInfo * info,
break;
}
slot->is_drained = FALSE;
slot->free_async_marked = FALSE;
GST_DEBUG_OBJECT (pad, "Stream Start '%s'",
gst_stream_get_stream_id (stream));
if (slot->active_stream == NULL) {
......@@ -1820,7 +1823,10 @@ multiqueue_src_probe (GstPad * pad, GstPadProbeInfo * info,
}
slot->probe_id = 0;
dbin->slots = g_list_remove (dbin->slots, slot);
free_multiqueue_slot_async (dbin, slot);
if (!slot->free_async_marked) {
slot->free_async_marked = TRUE;
free_multiqueue_slot_async (dbin, slot);
}
ret = GST_PAD_PROBE_REMOVE;
} else if (!was_drained) {
check_all_slot_for_eos (dbin);
......@@ -1855,9 +1861,12 @@ multiqueue_src_probe (GstPad * pad, GstPadProbeInfo * info,
}
slot->probe_id = 0;
dbin->slots = g_list_remove (dbin->slots, slot);
SELECTION_UNLOCK (dbin);
free_multiqueue_slot_async (dbin, slot);
if (!slot->free_async_marked) {
slot->free_async_marked = TRUE;
SELECTION_UNLOCK (dbin);
free_multiqueue_slot_async (dbin, slot);
} else
SELECTION_UNLOCK (dbin);
ret = GST_PAD_PROBE_REMOVE;
} else if (gst_mini_object_get_qdata (GST_MINI_OBJECT_CAST (ev),
CUSTOM_FINAL_EOS_QUARK)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment