mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 21:21:12 +00:00
decodebin3: Rename and refactor function
It was doing a bit more than it did initially, update the name accordingly. Refactor slightly for visibility Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5052>
This commit is contained in:
parent
1fd7c2c17a
commit
7e7f02f4f4
2 changed files with 45 additions and 49 deletions
|
@ -84,6 +84,7 @@ static gboolean
|
||||||
all_inputs_are_eos (GstDecodebin3 * dbin)
|
all_inputs_are_eos (GstDecodebin3 * dbin)
|
||||||
{
|
{
|
||||||
GList *tmp;
|
GList *tmp;
|
||||||
|
|
||||||
/* First check input streams */
|
/* First check input streams */
|
||||||
for (tmp = dbin->input_streams; tmp; tmp = tmp->next) {
|
for (tmp = dbin->input_streams; tmp; tmp = tmp->next) {
|
||||||
DecodebinInputStream *input = (DecodebinInputStream *) tmp->data;
|
DecodebinInputStream *input = (DecodebinInputStream *) tmp->data;
|
||||||
|
@ -91,7 +92,7 @@ all_inputs_are_eos (GstDecodebin3 * dbin)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (dbin, "All streams are EOS");
|
GST_DEBUG_OBJECT (dbin, "All input streams are EOS");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2362,35 +2362,31 @@ is_selection_done (GstDecodebin3 * dbin)
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Must be called with SELECTION_LOCK taken */
|
/* Must be called with SELECTION_LOCK taken
|
||||||
|
*
|
||||||
|
* This code is used to propagate the final EOS if all slots and inputs are
|
||||||
|
* drained.
|
||||||
|
**/
|
||||||
static void
|
static void
|
||||||
check_all_slot_for_eos (GstDecodebin3 * dbin, GstEvent * ev)
|
check_inputs_and_slots_for_eos (GstDecodebin3 * dbin, GstEvent * ev)
|
||||||
{
|
{
|
||||||
gboolean all_drained = TRUE;
|
|
||||||
GList *iter;
|
GList *iter;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (dbin, "check slot for eos");
|
GST_DEBUG_OBJECT (dbin, "checking slots for eos");
|
||||||
|
|
||||||
for (iter = dbin->slots; iter; iter = iter->next) {
|
for (iter = dbin->slots; iter; iter = iter->next) {
|
||||||
MultiQueueSlot *slot = iter->data;
|
MultiQueueSlot *slot = iter->data;
|
||||||
|
|
||||||
if (!slot->output)
|
if (slot->output && !slot->is_drained) {
|
||||||
continue;
|
GST_LOG_OBJECT (slot->sink_pad, "Not drained, not all slots are done");
|
||||||
|
return;
|
||||||
if (slot->is_drained) {
|
|
||||||
GST_LOG_OBJECT (slot->sink_pad, "slot %p is drained", slot);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
all_drained = FALSE;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Also check with the inputs, data might be pending */
|
/* Also check with the inputs, data might be pending */
|
||||||
if (all_drained)
|
if (!all_inputs_are_eos (dbin))
|
||||||
all_drained = all_inputs_are_eos (dbin);
|
return;
|
||||||
|
|
||||||
if (all_drained) {
|
|
||||||
GST_DEBUG_OBJECT (dbin,
|
GST_DEBUG_OBJECT (dbin,
|
||||||
"All active slots are drained, and no pending input, push EOS");
|
"All active slots are drained, and no pending input, push EOS");
|
||||||
|
|
||||||
|
@ -2405,7 +2401,8 @@ check_all_slot_for_eos (GstDecodebin3 * dbin, GstEvent * ev)
|
||||||
stream_start =
|
stream_start =
|
||||||
gst_pad_get_sticky_event (input->srcpad, GST_EVENT_STREAM_START, 0);
|
gst_pad_get_sticky_event (input->srcpad, GST_EVENT_STREAM_START, 0);
|
||||||
|
|
||||||
/* First forward a custom STREAM_START event to reset the EOS status (if any) */
|
/* First forward a custom STREAM_START event to reset the EOS status (if
|
||||||
|
* any) */
|
||||||
if (stream_start) {
|
if (stream_start) {
|
||||||
GstStructure *s;
|
GstStructure *s;
|
||||||
GstEvent *custom_stream_start = gst_event_copy (stream_start);
|
GstEvent *custom_stream_start = gst_event_copy (stream_start);
|
||||||
|
@ -2419,15 +2416,13 @@ check_all_slot_for_eos (GstDecodebin3 * dbin, GstEvent * ev)
|
||||||
eos = gst_event_new_eos ();
|
eos = gst_event_new_eos ();
|
||||||
gst_event_set_seqnum (eos, gst_event_get_seqnum (ev));
|
gst_event_set_seqnum (eos, gst_event_get_seqnum (ev));
|
||||||
gst_mini_object_set_qdata (GST_MINI_OBJECT_CAST (eos),
|
gst_mini_object_set_qdata (GST_MINI_OBJECT_CAST (eos),
|
||||||
CUSTOM_FINAL_EOS_QUARK, (gchar *) CUSTOM_FINAL_EOS_QUARK_DATA,
|
CUSTOM_FINAL_EOS_QUARK, (gchar *) CUSTOM_FINAL_EOS_QUARK_DATA, NULL);
|
||||||
NULL);
|
|
||||||
gst_pad_send_event (peer, eos);
|
gst_pad_send_event (peer, eos);
|
||||||
gst_object_unref (peer);
|
gst_object_unref (peer);
|
||||||
} else
|
} else
|
||||||
GST_DEBUG_OBJECT (dbin, "no output");
|
GST_DEBUG_OBJECT (dbin, "no output");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
check_slot_reconfiguration (GstDecodebin3 * dbin, MultiQueueSlot * slot)
|
check_slot_reconfiguration (GstDecodebin3 * dbin, MultiQueueSlot * slot)
|
||||||
|
@ -2568,7 +2563,7 @@ multiqueue_src_probe (GstPad * pad, GstPadProbeInfo * info,
|
||||||
free_multiqueue_slot_async (dbin, slot);
|
free_multiqueue_slot_async (dbin, slot);
|
||||||
ret = GST_PAD_PROBE_REMOVE;
|
ret = GST_PAD_PROBE_REMOVE;
|
||||||
} else if (!was_drained) {
|
} else if (!was_drained) {
|
||||||
check_all_slot_for_eos (dbin, ev);
|
check_inputs_and_slots_for_eos (dbin, ev);
|
||||||
}
|
}
|
||||||
if (ret == GST_PAD_PROBE_HANDLED)
|
if (ret == GST_PAD_PROBE_HANDLED)
|
||||||
gst_event_unref (ev);
|
gst_event_unref (ev);
|
||||||
|
@ -2615,7 +2610,7 @@ multiqueue_src_probe (GstPad * pad, GstPadProbeInfo * info,
|
||||||
* when all output streams are also eos */
|
* when all output streams are also eos */
|
||||||
ret = GST_PAD_PROBE_DROP;
|
ret = GST_PAD_PROBE_DROP;
|
||||||
SELECTION_LOCK (dbin);
|
SELECTION_LOCK (dbin);
|
||||||
check_all_slot_for_eos (dbin, ev);
|
check_inputs_and_slots_for_eos (dbin, ev);
|
||||||
SELECTION_UNLOCK (dbin);
|
SELECTION_UNLOCK (dbin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue