rtpssrcdemux: Rename confusingly name lock macros

This is an extra internal recurisve lock use to avoid having to take
both sink pad streams lock all the time. This patch renamed it
INTERLNAL_STREAM_LOCK/UNLOCK() to avoid confusion with possible upstream
GST_PAD API.
This commit is contained in:
Nicolas Dufresne 2018-11-29 14:54:06 -05:00
parent 40daf6322d
commit d637567ab3

View file

@ -80,8 +80,8 @@ GST_STATIC_PAD_TEMPLATE ("rtcp_src_%u",
GST_STATIC_CAPS ("application/x-rtcp")
);
#define GST_PAD_LOCK(obj) (g_rec_mutex_lock (&(obj)->padlock))
#define GST_PAD_UNLOCK(obj) (g_rec_mutex_unlock (&(obj)->padlock))
#define INTERNAL_STREAM_LOCK(obj) (g_rec_mutex_lock (&(obj)->padlock))
#define INTERNAL_STREAM_UNLOCK(obj) (g_rec_mutex_unlock (&(obj)->padlock))
typedef enum
{
@ -240,7 +240,7 @@ find_or_create_demux_pad_for_ssrc (GstRtpSsrcDemux * demux, guint32 ssrc,
GstRtpSsrcDemuxPad *demuxpad;
GstPad *retpad;
GST_PAD_LOCK (demux);
INTERNAL_STREAM_LOCK (demux);
demuxpad = find_demux_pad_for_ssrc (demux, ssrc);
if (demuxpad != NULL) {
@ -256,7 +256,7 @@ find_or_create_demux_pad_for_ssrc (GstRtpSsrcDemux * demux, guint32 ssrc,
g_assert_not_reached ();
}
GST_PAD_UNLOCK (demux);
INTERNAL_STREAM_UNLOCK (demux);
return retpad;
}
@ -322,7 +322,7 @@ find_or_create_demux_pad_for_ssrc (GstRtpSsrcDemux * demux, guint32 ssrc,
g_signal_emit (G_OBJECT (demux),
gst_rtp_ssrc_demux_signals[SIGNAL_NEW_SSRC_PAD], 0, ssrc, rtp_pad);
GST_PAD_UNLOCK (demux);
INTERNAL_STREAM_UNLOCK (demux);
gst_object_unref (rtp_pad);
gst_object_unref (rtcp_pad);
@ -483,17 +483,17 @@ gst_rtp_ssrc_demux_clear_ssrc (GstRtpSsrcDemux * demux, guint32 ssrc)
{
GstRtpSsrcDemuxPad *dpad;
GST_PAD_LOCK (demux);
INTERNAL_STREAM_LOCK (demux);
dpad = find_demux_pad_for_ssrc (demux, ssrc);
if (dpad == NULL) {
GST_PAD_UNLOCK (demux);
INTERNAL_STREAM_UNLOCK (demux);
goto unknown_pad;
}
GST_DEBUG_OBJECT (demux, "clearing pad for SSRC %08x", ssrc);
demux->srcpads = g_slist_remove (demux->srcpads, dpad);
GST_PAD_UNLOCK (demux);
INTERNAL_STREAM_UNLOCK (demux);
gst_pad_set_active (dpad->rtp_pad, FALSE);
gst_pad_set_active (dpad->rtcp_pad, FALSE);
@ -532,7 +532,7 @@ forward_event (GstPad * pad, gpointer user_data)
GSList *walk = NULL;
GstEvent *newevent = NULL;
GST_PAD_LOCK (fdata->demux);
INTERNAL_STREAM_LOCK (fdata->demux);
for (walk = fdata->demux->srcpads; walk; walk = walk->next) {
GstRtpSsrcDemuxPad *dpad = (GstRtpSsrcDemuxPad *) walk->data;
@ -541,7 +541,7 @@ forward_event (GstPad * pad, gpointer user_data)
break;
}
}
GST_PAD_UNLOCK (fdata->demux);
INTERNAL_STREAM_UNLOCK (fdata->demux);
if (newevent)
fdata->res &= gst_pad_push_event (pad, newevent);
@ -600,13 +600,13 @@ gst_rtp_ssrc_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
if (ret != GST_FLOW_OK) {
/* check if the ssrc still there, may have been removed */
GST_PAD_LOCK (demux);
INTERNAL_STREAM_LOCK (demux);
dpad = find_demux_pad_for_ssrc (demux, ssrc);
if (dpad == NULL || dpad->rtp_pad != srcpad) {
/* SSRC was removed during the push ... ignore the error */
ret = GST_FLOW_OK;
}
GST_PAD_UNLOCK (demux);
INTERNAL_STREAM_UNLOCK (demux);
}
gst_object_unref (srcpad);
@ -687,13 +687,13 @@ gst_rtp_ssrc_demux_rtcp_chain (GstPad * pad, GstObject * parent,
if (ret != GST_FLOW_OK) {
/* check if the ssrc still there, may have been removed */
GST_PAD_LOCK (demux);
INTERNAL_STREAM_LOCK (demux);
dpad = find_demux_pad_for_ssrc (demux, ssrc);
if (dpad == NULL || dpad->rtcp_pad != srcpad) {
/* SSRC was removed during the push ... ignore the error */
ret = GST_FLOW_OK;
}
GST_PAD_UNLOCK (demux);
INTERNAL_STREAM_UNLOCK (demux);
}
gst_object_unref (srcpad);
@ -783,7 +783,7 @@ gst_rtp_ssrc_demux_iterate_internal_links_src (GstPad * pad, GstObject * parent)
demux = GST_RTP_SSRC_DEMUX (parent);
GST_PAD_LOCK (demux);
INTERNAL_STREAM_LOCK (demux);
for (current = demux->srcpads; current; current = g_slist_next (current)) {
GstRtpSsrcDemuxPad *dpad = (GstRtpSsrcDemuxPad *) current->data;
@ -804,7 +804,7 @@ gst_rtp_ssrc_demux_iterate_internal_links_src (GstPad * pad, GstObject * parent)
g_value_unset (&val);
}
GST_PAD_UNLOCK (demux);
INTERNAL_STREAM_UNLOCK (demux);
return it;
}