parsebin: Emit 'drained' only for the top-level chain

Instead of emitting 'drained' whenever every single chain is drained
(which would result in plenty of signal emission, and would also
occur when switching groups), only emit it when the top-level chain
is drained.

Furthermore, mark unknown (and therefore unexposed) pads as drained
since we'll never get EOS on them.

https://bugzilla.gnome.org/show_bug.cgi?id=787367
This commit is contained in:
Edward Hervey 2017-09-06 16:50:31 +02:00 committed by Edward Hervey
parent b9aaa7f4f2
commit 92e8876844

View file

@ -1515,6 +1515,7 @@ unknown_type:
chain->deadend_details = deadend_details; chain->deadend_details = deadend_details;
chain->deadend = TRUE; chain->deadend = TRUE;
chain->drained = TRUE;
chain->endcaps = caps; chain->endcaps = caps;
gst_object_replace ((GstObject **) & chain->current_pad, NULL); gst_object_replace ((GstObject **) & chain->current_pad, NULL);
@ -3217,14 +3218,13 @@ drain_and_switch_chains (GstParseChain * chain, GstParsePad * drainpad,
beach: beach:
CHAIN_MUTEX_UNLOCK (chain); CHAIN_MUTEX_UNLOCK (chain);
GST_DEBUG ("Chain %p (handled:%d, last_group:%d, drained:%d, switched:%d)", GST_DEBUG
chain, handled, *last_group, chain->drained, *switched); ("Chain %p (%s:%s handled:%d, last_group:%d, drained:%d, switched:%d, deadend:%d)",
chain, GST_DEBUG_PAD_NAME (chain->pad), handled, *last_group,
chain->drained, *switched, chain->deadend);
*drained = chain->drained; *drained = chain->drained;
if (*drained)
g_signal_emit (parsebin, gst_parse_bin_signals[SIGNAL_DRAINED], 0, NULL);
return handled; return handled;
} }
@ -3245,11 +3245,18 @@ gst_parse_pad_handle_eos (GstParsePad * pad)
drain_and_switch_chains (parsebin->parse_chain, pad, &last_group, &drained, drain_and_switch_chains (parsebin->parse_chain, pad, &last_group, &drained,
&switched); &switched);
GST_LOG_OBJECT (parsebin, "drained:%d switched:%d", drained, switched);
if (switched) { if (switched) {
/* If we resulted in a group switch, expose what's needed */ /* If we resulted in a group switch, expose what's needed */
if (gst_parse_chain_is_complete (parsebin->parse_chain)) if (gst_parse_chain_is_complete (parsebin->parse_chain))
gst_parse_bin_expose (parsebin); gst_parse_bin_expose (parsebin);
} }
if (drained) {
GST_DEBUG_OBJECT (parsebin, "We are fully drained, emitting signal");
g_signal_emit (parsebin, gst_parse_bin_signals[SIGNAL_DRAINED], 0, NULL);
}
} }
EXPOSE_UNLOCK (parsebin); EXPOSE_UNLOCK (parsebin);