decodebin2: sprinkle some more locking
... to avoid races and ensure some data structure consistency. See also #574289.
This commit is contained in:
parent
45447337ad
commit
2482a536ac
@ -1897,17 +1897,19 @@ no_more_pads_cb (GstElement * element, GstDecodeChain * chain)
|
|||||||
|
|
||||||
GST_LOG_OBJECT (element, "got no more pads");
|
GST_LOG_OBJECT (element, "got no more pads");
|
||||||
|
|
||||||
|
CHAIN_MUTEX_LOCK (chain);
|
||||||
if (!chain->elements || (GstElement *) chain->elements->data != element) {
|
if (!chain->elements || (GstElement *) chain->elements->data != element) {
|
||||||
GST_LOG_OBJECT (chain->dbin, "no-more-pads from old chain element '%s'",
|
GST_LOG_OBJECT (chain->dbin, "no-more-pads from old chain element '%s'",
|
||||||
GST_OBJECT_NAME (element));
|
GST_OBJECT_NAME (element));
|
||||||
|
CHAIN_MUTEX_UNLOCK (chain);
|
||||||
return;
|
return;
|
||||||
} else if (!chain->demuxer) {
|
} else if (!chain->demuxer) {
|
||||||
GST_LOG_OBJECT (chain->dbin, "no-more-pads from a non-demuxer element '%s'",
|
GST_LOG_OBJECT (chain->dbin, "no-more-pads from a non-demuxer element '%s'",
|
||||||
GST_OBJECT_NAME (element));
|
GST_OBJECT_NAME (element));
|
||||||
|
CHAIN_MUTEX_UNLOCK (chain);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHAIN_MUTEX_LOCK (chain);
|
|
||||||
/* when we received no_more_pads, we can complete the pads of the chain */
|
/* when we received no_more_pads, we can complete the pads of the chain */
|
||||||
if (!chain->next_groups && chain->active_group) {
|
if (!chain->next_groups && chain->active_group) {
|
||||||
group = chain->active_group;
|
group = chain->active_group;
|
||||||
@ -2548,6 +2550,7 @@ gst_decode_chain_is_complete (GstDecodeChain * chain)
|
|||||||
{
|
{
|
||||||
gboolean complete = FALSE;
|
gboolean complete = FALSE;
|
||||||
|
|
||||||
|
CHAIN_MUTEX_LOCK (chain);
|
||||||
if (chain->deadend) {
|
if (chain->deadend) {
|
||||||
complete = TRUE;
|
complete = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
@ -2567,6 +2570,7 @@ gst_decode_chain_is_complete (GstDecodeChain * chain)
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
CHAIN_MUTEX_UNLOCK (chain);
|
||||||
GST_DEBUG_OBJECT (chain->dbin, "Chain %p is complete: %d", chain, complete);
|
GST_DEBUG_OBJECT (chain->dbin, "Chain %p is complete: %d", chain, complete);
|
||||||
return complete;
|
return complete;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user