Commit 2482a536 authored by Mark Nauwelaerts's avatar Mark Nauwelaerts
Browse files

decodebin2: sprinkle some more locking

... to avoid races and ensure some data structure consistency.

See also #574289.
parent 45447337
......@@ -1897,17 +1897,19 @@ no_more_pads_cb (GstElement * element, GstDecodeChain * chain)
GST_LOG_OBJECT (element, "got no more pads");
CHAIN_MUTEX_LOCK (chain);
if (!chain->elements || (GstElement *) chain->elements->data != element) {
GST_LOG_OBJECT (chain->dbin, "no-more-pads from old chain element '%s'",
GST_OBJECT_NAME (element));
CHAIN_MUTEX_UNLOCK (chain);
return;
} else if (!chain->demuxer) {
GST_LOG_OBJECT (chain->dbin, "no-more-pads from a non-demuxer element '%s'",
GST_OBJECT_NAME (element));
CHAIN_MUTEX_UNLOCK (chain);
return;
}
CHAIN_MUTEX_LOCK (chain);
/* when we received no_more_pads, we can complete the pads of the chain */
if (!chain->next_groups && chain->active_group) {
group = chain->active_group;
......@@ -2548,6 +2550,7 @@ gst_decode_chain_is_complete (GstDecodeChain * chain)
{
gboolean complete = FALSE;
CHAIN_MUTEX_LOCK (chain);
if (chain->deadend) {
complete = TRUE;
goto out;
......@@ -2567,6 +2570,7 @@ gst_decode_chain_is_complete (GstDecodeChain * chain)
}
out:
CHAIN_MUTEX_UNLOCK (chain);
GST_DEBUG_OBJECT (chain->dbin, "Chain %p is complete: %d", chain, complete);
return complete;
}
......
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