mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
Revert "pad: use a nested lock to avoid reffing the peer"
This reverts commit 9b424b1570
.
This commit is contained in:
parent
41e00e58e7
commit
5550136fb2
1 changed files with 18 additions and 17 deletions
35
gst/gstpad.c
35
gst/gstpad.c
|
@ -4133,6 +4133,8 @@ gst_pad_chain_data_unchecked (GstPad * pad, gboolean is_buffer, void *data)
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
gboolean emit_signal;
|
gboolean emit_signal;
|
||||||
|
|
||||||
|
GST_PAD_STREAM_LOCK (pad);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (pad);
|
GST_OBJECT_LOCK (pad);
|
||||||
if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad)))
|
if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad)))
|
||||||
goto flushing;
|
goto flushing;
|
||||||
|
@ -4199,6 +4201,8 @@ gst_pad_chain_data_unchecked (GstPad * pad, gboolean is_buffer, void *data)
|
||||||
GST_DEBUG_FUNCPTR_NAME (chainlistfunc), gst_flow_get_name (ret));
|
GST_DEBUG_FUNCPTR_NAME (chainlistfunc), gst_flow_get_name (ret));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GST_PAD_STREAM_UNLOCK (pad);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
chain_groups:
|
chain_groups:
|
||||||
|
@ -4207,6 +4211,8 @@ chain_groups:
|
||||||
GstBufferListIterator *it;
|
GstBufferListIterator *it;
|
||||||
GstBuffer *group;
|
GstBuffer *group;
|
||||||
|
|
||||||
|
GST_PAD_STREAM_UNLOCK (pad);
|
||||||
|
|
||||||
GST_INFO_OBJECT (pad, "chaining each group in list as a merged buffer");
|
GST_INFO_OBJECT (pad, "chaining each group in list as a merged buffer");
|
||||||
|
|
||||||
list = GST_BUFFER_LIST_CAST (data);
|
list = GST_BUFFER_LIST_CAST (data);
|
||||||
|
@ -4241,12 +4247,14 @@ flushing:
|
||||||
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
|
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
|
||||||
"pushing, but pad was flushing");
|
"pushing, but pad was flushing");
|
||||||
GST_OBJECT_UNLOCK (pad);
|
GST_OBJECT_UNLOCK (pad);
|
||||||
|
GST_PAD_STREAM_UNLOCK (pad);
|
||||||
return GST_FLOW_WRONG_STATE;
|
return GST_FLOW_WRONG_STATE;
|
||||||
}
|
}
|
||||||
dropping:
|
dropping:
|
||||||
{
|
{
|
||||||
gst_pad_data_unref (is_buffer, data);
|
gst_pad_data_unref (is_buffer, data);
|
||||||
GST_DEBUG_OBJECT (pad, "Dropping buffer due to FALSE probe return");
|
GST_DEBUG_OBJECT (pad, "Dropping buffer due to FALSE probe return");
|
||||||
|
GST_PAD_STREAM_UNLOCK (pad);
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
not_negotiated:
|
not_negotiated:
|
||||||
|
@ -4254,6 +4262,7 @@ not_negotiated:
|
||||||
gst_pad_data_unref (is_buffer, data);
|
gst_pad_data_unref (is_buffer, data);
|
||||||
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
|
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
|
||||||
"pushing data but pad did not accept");
|
"pushing data but pad did not accept");
|
||||||
|
GST_PAD_STREAM_UNLOCK (pad);
|
||||||
return GST_FLOW_NOT_NEGOTIATED;
|
return GST_FLOW_NOT_NEGOTIATED;
|
||||||
}
|
}
|
||||||
no_function:
|
no_function:
|
||||||
|
@ -4264,6 +4273,7 @@ no_function:
|
||||||
GST_ELEMENT_ERROR (GST_PAD_PARENT (pad), CORE, PAD, (NULL),
|
GST_ELEMENT_ERROR (GST_PAD_PARENT (pad), CORE, PAD, (NULL),
|
||||||
("push on pad %s:%s but it has no chainfunction",
|
("push on pad %s:%s but it has no chainfunction",
|
||||||
GST_DEBUG_PAD_NAME (pad)));
|
GST_DEBUG_PAD_NAME (pad)));
|
||||||
|
GST_PAD_STREAM_UNLOCK (pad);
|
||||||
return GST_FLOW_NOT_SUPPORTED;
|
return GST_FLOW_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4297,17 +4307,11 @@ no_function:
|
||||||
GstFlowReturn
|
GstFlowReturn
|
||||||
gst_pad_chain (GstPad * pad, GstBuffer * buffer)
|
gst_pad_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
GstFlowReturn res;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR);
|
g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR);
|
||||||
g_return_val_if_fail (GST_PAD_IS_SINK (pad), GST_FLOW_ERROR);
|
g_return_val_if_fail (GST_PAD_IS_SINK (pad), GST_FLOW_ERROR);
|
||||||
g_return_val_if_fail (GST_IS_BUFFER (buffer), GST_FLOW_ERROR);
|
g_return_val_if_fail (GST_IS_BUFFER (buffer), GST_FLOW_ERROR);
|
||||||
|
|
||||||
GST_PAD_STREAM_LOCK (pad);
|
return gst_pad_chain_data_unchecked (pad, TRUE, buffer);
|
||||||
res = gst_pad_chain_data_unchecked (pad, TRUE, buffer);
|
|
||||||
GST_PAD_STREAM_UNLOCK (pad);
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4341,16 +4345,11 @@ gst_pad_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
GstFlowReturn
|
GstFlowReturn
|
||||||
gst_pad_chain_list (GstPad * pad, GstBufferList * list)
|
gst_pad_chain_list (GstPad * pad, GstBufferList * list)
|
||||||
{
|
{
|
||||||
GstFlowReturn res;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR);
|
g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR);
|
||||||
g_return_val_if_fail (GST_PAD_IS_SINK (pad), GST_FLOW_ERROR);
|
g_return_val_if_fail (GST_PAD_IS_SINK (pad), GST_FLOW_ERROR);
|
||||||
g_return_val_if_fail (GST_IS_BUFFER_LIST (list), GST_FLOW_ERROR);
|
g_return_val_if_fail (GST_IS_BUFFER_LIST (list), GST_FLOW_ERROR);
|
||||||
|
|
||||||
GST_PAD_STREAM_LOCK (pad);
|
return gst_pad_chain_data_unchecked (pad, FALSE, list);
|
||||||
res = gst_pad_chain_data_unchecked (pad, FALSE, list);
|
|
||||||
GST_PAD_STREAM_UNLOCK (pad);
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
|
@ -4395,8 +4394,9 @@ gst_pad_push_data (GstPad * pad, gboolean is_buffer, void *data)
|
||||||
caps = gst_pad_data_get_caps (is_buffer, data);
|
caps = gst_pad_data_get_caps (is_buffer, data);
|
||||||
caps_changed = caps && caps != GST_PAD_CAPS (pad);
|
caps_changed = caps && caps != GST_PAD_CAPS (pad);
|
||||||
|
|
||||||
/* use a nested lock to avoid reffing the peer pad */
|
/* take ref to peer pad before releasing the lock */
|
||||||
GST_PAD_STREAM_LOCK (peer);
|
gst_object_ref (peer);
|
||||||
|
|
||||||
GST_OBJECT_UNLOCK (pad);
|
GST_OBJECT_UNLOCK (pad);
|
||||||
|
|
||||||
/* we got a new datatype from the pad, it had better handle it */
|
/* we got a new datatype from the pad, it had better handle it */
|
||||||
|
@ -4409,7 +4409,8 @@ gst_pad_push_data (GstPad * pad, gboolean is_buffer, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = gst_pad_chain_data_unchecked (peer, is_buffer, data);
|
ret = gst_pad_chain_data_unchecked (peer, is_buffer, data);
|
||||||
GST_PAD_STREAM_UNLOCK (peer);
|
|
||||||
|
gst_object_unref (peer);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -4471,9 +4472,9 @@ not_linked:
|
||||||
not_negotiated:
|
not_negotiated:
|
||||||
{
|
{
|
||||||
gst_pad_data_unref (is_buffer, data);
|
gst_pad_data_unref (is_buffer, data);
|
||||||
|
gst_object_unref (peer);
|
||||||
GST_CAT_DEBUG_OBJECT (GST_CAT_SCHEDULING, pad,
|
GST_CAT_DEBUG_OBJECT (GST_CAT_SCHEDULING, pad,
|
||||||
"element pushed data then refused to accept the caps");
|
"element pushed data then refused to accept the caps");
|
||||||
GST_PAD_STREAM_UNLOCK (peer);
|
|
||||||
return GST_FLOW_NOT_NEGOTIATED;
|
return GST_FLOW_NOT_NEGOTIATED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue