mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-06 07:28:53 +00:00
rtp: Use new gst_iterator_new_single() for the internal linked pads iteration
This commit is contained in:
parent
a1cddb3fd6
commit
000a483d31
5 changed files with 53 additions and 224 deletions
|
@ -47,7 +47,7 @@ AC_LIBTOOL_WIN32_DLL
|
||||||
AM_PROG_LIBTOOL
|
AM_PROG_LIBTOOL
|
||||||
|
|
||||||
dnl *** required versions of GStreamer stuff ***
|
dnl *** required versions of GStreamer stuff ***
|
||||||
GST_REQ=0.10.24
|
GST_REQ=0.10.24.1
|
||||||
GSTPB_REQ=0.10.24
|
GSTPB_REQ=0.10.24
|
||||||
|
|
||||||
dnl *** autotools stuff ****
|
dnl *** autotools stuff ****
|
||||||
|
|
|
@ -466,88 +466,29 @@ gst_rtp_jitter_buffer_finalize (GObject * object)
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
GstIterator parent;
|
|
||||||
|
|
||||||
GstRtpJitterBuffer *jitterbuffer;
|
|
||||||
GstPad *pad;
|
|
||||||
gboolean start;
|
|
||||||
} GstRtpJitterBufferIterator;
|
|
||||||
|
|
||||||
static void
|
|
||||||
_iterate_free (GstIterator * it)
|
|
||||||
{
|
|
||||||
GstRtpJitterBufferIterator *jit = (GstRtpJitterBufferIterator *) it;
|
|
||||||
|
|
||||||
g_object_unref (jit->jitterbuffer);
|
|
||||||
g_object_unref (jit->pad);
|
|
||||||
|
|
||||||
g_free (it);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstIteratorResult
|
|
||||||
_iterate_next (GstIterator * it, gpointer * result)
|
|
||||||
{
|
|
||||||
GstRtpJitterBufferIterator *jit = (GstRtpJitterBufferIterator *) it;
|
|
||||||
GstPad *res = NULL;
|
|
||||||
GstRtpJitterBufferPrivate *priv;
|
|
||||||
|
|
||||||
priv = jit->jitterbuffer->priv;
|
|
||||||
|
|
||||||
if (!jit->start) {
|
|
||||||
/* go out */
|
|
||||||
} else if (jit->pad == priv->sinkpad) {
|
|
||||||
res = priv->srcpad;
|
|
||||||
} else if (jit->pad == priv->srcpad) {
|
|
||||||
res = priv->sinkpad;
|
|
||||||
} else if (jit->pad == priv->rtcpsinkpad) {
|
|
||||||
res = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
*result = res;
|
|
||||||
|
|
||||||
return res ? GST_ITERATOR_OK : GST_ITERATOR_DONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstIteratorItem
|
|
||||||
_iterate_item (GstIterator * it, gpointer item)
|
|
||||||
{
|
|
||||||
GstPad *pad = (GstPad *) item;
|
|
||||||
gst_object_ref (pad);
|
|
||||||
|
|
||||||
return GST_ITERATOR_ITEM_PASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_iterate_resync (GstIterator * it)
|
|
||||||
{
|
|
||||||
GstRtpJitterBufferIterator *jit = (GstRtpJitterBufferIterator *) it;
|
|
||||||
|
|
||||||
jit->start = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstIterator *
|
static GstIterator *
|
||||||
gst_rtp_jitter_buffer_iterate_internal_links (GstPad * pad)
|
gst_rtp_jitter_buffer_iterate_internal_links (GstPad * pad)
|
||||||
{
|
{
|
||||||
GstRtpJitterBuffer *jitterbuffer;
|
GstRtpJitterBuffer *jitterbuffer;
|
||||||
GstRtpJitterBufferIterator *it;
|
GstPad *otherpad = NULL;
|
||||||
|
GstIterator *it;
|
||||||
|
|
||||||
jitterbuffer = GST_RTP_JITTER_BUFFER (gst_pad_get_parent (pad));
|
jitterbuffer = GST_RTP_JITTER_BUFFER (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
it = (GstRtpJitterBufferIterator *)
|
if (pad == jitterbuffer->priv->sinkpad) {
|
||||||
gst_iterator_new (sizeof (GstRtpJitterBufferIterator),
|
otherpad = jitterbuffer->priv->srcpad;
|
||||||
GST_TYPE_PAD,
|
} else if (pad == jitterbuffer->priv->srcpad) {
|
||||||
GST_OBJECT_CAST (jitterbuffer)->lock,
|
otherpad = jitterbuffer->priv->sinkpad;
|
||||||
&GST_ELEMENT_CAST (jitterbuffer)->pads_cookie,
|
} else if (pad == jitterbuffer->priv->rtcpsinkpad) {
|
||||||
_iterate_next, _iterate_item, _iterate_resync, _iterate_free);
|
otherpad = NULL;
|
||||||
it->start = TRUE;
|
}
|
||||||
it->jitterbuffer = gst_object_ref (jitterbuffer);
|
|
||||||
it->pad = gst_object_ref (pad);
|
it = gst_iterator_new_single (GST_TYPE_PAD, otherpad,
|
||||||
|
(GstCopyFunction) gst_object_ref, (GFreeFunc) gst_object_unref);
|
||||||
|
|
||||||
gst_object_unref (jitterbuffer);
|
gst_object_unref (jitterbuffer);
|
||||||
|
|
||||||
return (GstIterator *) it;
|
return it;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstPad *
|
static GstPad *
|
||||||
|
|
|
@ -1236,87 +1236,31 @@ gst_rtp_session_event_recv_rtp_sink (GstPad * pad, GstEvent * event)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
GstIterator parent;
|
|
||||||
|
|
||||||
GstRtpSession *rtpsession;
|
|
||||||
GstPad *pad;
|
|
||||||
gboolean start;
|
|
||||||
} GstRtpSessionIterator;
|
|
||||||
|
|
||||||
static void
|
|
||||||
_iterate_free (GstIterator * it)
|
|
||||||
{
|
|
||||||
GstRtpSessionIterator *sit = (GstRtpSessionIterator *) it;
|
|
||||||
|
|
||||||
g_object_unref (sit->rtpsession);
|
|
||||||
g_object_unref (sit->pad);
|
|
||||||
|
|
||||||
g_free (it);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstIteratorResult
|
|
||||||
_iterate_next (GstIterator * it, gpointer * result)
|
|
||||||
{
|
|
||||||
GstRtpSessionIterator *sit = (GstRtpSessionIterator *) it;
|
|
||||||
GstPad *res = NULL;
|
|
||||||
|
|
||||||
if (!sit->start) {
|
|
||||||
/* go out */
|
|
||||||
} else if (sit->pad == sit->rtpsession->recv_rtp_src) {
|
|
||||||
res = sit->rtpsession->recv_rtp_sink;
|
|
||||||
} else if (sit->pad == sit->rtpsession->recv_rtp_sink) {
|
|
||||||
res = sit->rtpsession->recv_rtp_src;
|
|
||||||
} else if (sit->pad == sit->rtpsession->send_rtp_src) {
|
|
||||||
res = sit->rtpsession->send_rtp_sink;
|
|
||||||
} else if (sit->pad == sit->rtpsession->send_rtp_sink) {
|
|
||||||
res = sit->rtpsession->send_rtp_src;
|
|
||||||
}
|
|
||||||
|
|
||||||
*result = res;
|
|
||||||
|
|
||||||
return res ? GST_ITERATOR_OK : GST_ITERATOR_DONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstIteratorItem
|
|
||||||
_iterate_item (GstIterator * it, gpointer item)
|
|
||||||
{
|
|
||||||
GstPad *pad = (GstPad *) item;
|
|
||||||
gst_object_ref (pad);
|
|
||||||
|
|
||||||
return GST_ITERATOR_ITEM_PASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_iterate_resync (GstIterator * it)
|
|
||||||
{
|
|
||||||
GstRtpSessionIterator *sit = (GstRtpSessionIterator *) it;
|
|
||||||
|
|
||||||
sit->start = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstIterator *
|
static GstIterator *
|
||||||
gst_rtp_session_iterate_internal_links (GstPad * pad)
|
gst_rtp_session_iterate_internal_links (GstPad * pad)
|
||||||
{
|
{
|
||||||
GstRtpSession *rtpsession;
|
GstRtpSession *rtpsession;
|
||||||
GstRtpSessionIterator *it;
|
GstPad *otherpad = NULL;
|
||||||
|
GstIterator *it;
|
||||||
|
|
||||||
rtpsession = GST_RTP_SESSION (gst_pad_get_parent (pad));
|
rtpsession = GST_RTP_SESSION (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
it = (GstRtpSessionIterator *)
|
if (pad == rtpsession->recv_rtp_src) {
|
||||||
gst_iterator_new (sizeof (GstRtpSessionIterator),
|
otherpad = rtpsession->recv_rtp_sink;
|
||||||
GST_TYPE_PAD,
|
} else if (pad == rtpsession->recv_rtp_sink) {
|
||||||
rtpsession->priv->lock,
|
otherpad = rtpsession->recv_rtp_src;
|
||||||
&GST_ELEMENT_CAST (rtpsession)->pads_cookie,
|
} else if (pad == rtpsession->send_rtp_src) {
|
||||||
_iterate_next, _iterate_item, _iterate_resync, _iterate_free);
|
otherpad = rtpsession->send_rtp_sink;
|
||||||
it->start = TRUE;
|
} else if (pad == rtpsession->send_rtp_sink) {
|
||||||
it->rtpsession = gst_object_ref (rtpsession);
|
otherpad = rtpsession->send_rtp_src;
|
||||||
it->pad = gst_object_ref (pad);
|
}
|
||||||
|
|
||||||
|
it = gst_iterator_new_single (GST_TYPE_PAD, otherpad,
|
||||||
|
(GstCopyFunction) gst_object_ref, (GFreeFunc) gst_object_unref);
|
||||||
|
|
||||||
gst_object_unref (rtpsession);
|
gst_object_unref (rtpsession);
|
||||||
|
|
||||||
return (GstIterator *) it;
|
return it;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
|
@ -619,95 +619,39 @@ gst_rtp_ssrc_demux_src_event (GstPad * pad, GstEvent * event)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
GstIterator parent;
|
|
||||||
|
|
||||||
GstRtpSsrcDemux *demux;
|
|
||||||
GstPad *pad;
|
|
||||||
GSList *current;
|
|
||||||
} GstRtpSsrcDemuxIterator;
|
|
||||||
|
|
||||||
static void
|
|
||||||
_iterate_free (GstIterator * it)
|
|
||||||
{
|
|
||||||
GstRtpSsrcDemuxIterator *dit = (GstRtpSsrcDemuxIterator *) it;
|
|
||||||
|
|
||||||
g_object_unref (dit->demux);
|
|
||||||
g_object_unref (dit->pad);
|
|
||||||
|
|
||||||
g_free (it);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstIteratorResult
|
|
||||||
_iterate_next (GstIterator * it, gpointer * result)
|
|
||||||
{
|
|
||||||
GstRtpSsrcDemuxIterator *dit = (GstRtpSsrcDemuxIterator *) it;
|
|
||||||
GSList *current;
|
|
||||||
GstPad *res = NULL;
|
|
||||||
|
|
||||||
for (current = dit->current; current; current = g_slist_next (current)) {
|
|
||||||
GstRtpSsrcDemuxPad *dpad = (GstRtpSsrcDemuxPad *) current->data;
|
|
||||||
|
|
||||||
if (dit->pad == dit->demux->rtp_sink) {
|
|
||||||
res = dpad->rtp_pad;
|
|
||||||
break;
|
|
||||||
} else if (dit->pad == dit->demux->rtcp_sink) {
|
|
||||||
res = dpad->rtcp_pad;
|
|
||||||
} else if (dit->pad == dpad->rtp_pad) {
|
|
||||||
res = dit->demux->rtp_sink;
|
|
||||||
break;
|
|
||||||
} else if (dit->pad == dpad->rtcp_pad) {
|
|
||||||
res = dit->demux->rtcp_sink;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*result = res;
|
|
||||||
|
|
||||||
dit->current = current;
|
|
||||||
|
|
||||||
return res ? GST_ITERATOR_OK : GST_ITERATOR_DONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstIteratorItem
|
|
||||||
_iterate_item (GstIterator * it, gpointer item)
|
|
||||||
{
|
|
||||||
GstPad *pad = (GstPad *) item;
|
|
||||||
gst_object_ref (pad);
|
|
||||||
|
|
||||||
return GST_ITERATOR_ITEM_PASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_iterate_resync (GstIterator * it)
|
|
||||||
{
|
|
||||||
GstRtpSsrcDemuxIterator *dit = (GstRtpSsrcDemuxIterator *) it;
|
|
||||||
|
|
||||||
dit->current = dit->demux->srcpads;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstIterator *
|
static GstIterator *
|
||||||
gst_rtp_ssrc_demux_iterate_internal_links (GstPad * pad)
|
gst_rtp_ssrc_demux_iterate_internal_links (GstPad * pad)
|
||||||
{
|
{
|
||||||
GstRtpSsrcDemux *demux;
|
GstRtpSsrcDemux *demux;
|
||||||
GstRtpSsrcDemuxIterator *it;
|
GstPad *otherpad = NULL;
|
||||||
|
GstIterator *it;
|
||||||
|
GSList *current;
|
||||||
|
|
||||||
demux = GST_RTP_SSRC_DEMUX (gst_pad_get_parent (pad));
|
demux = GST_RTP_SSRC_DEMUX (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
it = (GstRtpSsrcDemuxIterator *)
|
GST_PAD_LOCK (demux);
|
||||||
gst_iterator_new (sizeof (GstRtpSsrcDemuxIterator),
|
for (current = demux->srcpads; current; current = g_slist_next (current)) {
|
||||||
GST_TYPE_PAD,
|
GstRtpSsrcDemuxPad *dpad = (GstRtpSsrcDemuxPad *) current->data;
|
||||||
demux->padlock,
|
|
||||||
&GST_ELEMENT_CAST (demux)->pads_cookie,
|
|
||||||
_iterate_next, _iterate_item, _iterate_resync, _iterate_free);
|
|
||||||
|
|
||||||
it->demux = gst_object_ref (demux);
|
if (pad == demux->rtp_sink) {
|
||||||
it->pad = gst_object_ref (pad);
|
otherpad = dpad->rtp_pad;
|
||||||
it->current = demux->srcpads;
|
break;
|
||||||
|
} else if (pad == demux->rtcp_sink) {
|
||||||
|
otherpad = dpad->rtcp_pad;
|
||||||
|
} else if (pad == dpad->rtp_pad) {
|
||||||
|
otherpad = demux->rtp_sink;
|
||||||
|
break;
|
||||||
|
} else if (pad == dpad->rtcp_pad) {
|
||||||
|
otherpad = demux->rtcp_sink;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
it = gst_iterator_new_single (GST_TYPE_PAD, otherpad,
|
||||||
|
(GstCopyFunction) gst_object_ref, (GFreeFunc) gst_object_unref);
|
||||||
|
GST_PAD_UNLOCK (demux);
|
||||||
|
|
||||||
gst_object_unref (demux);
|
gst_object_unref (demux);
|
||||||
return (GstIterator *) it;
|
return it;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
|
@ -148,7 +148,7 @@ rtp_stats_calculate_bye_interval (RTPSessionStats * stats)
|
||||||
/* no interval when we have less than 50 members */
|
/* no interval when we have less than 50 members */
|
||||||
if (stats->active_sources < 50)
|
if (stats->active_sources < 50)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
rtcp_min_time = (stats->min_interval) / 2.0;
|
rtcp_min_time = (stats->min_interval) / 2.0;
|
||||||
|
|
||||||
/* Dedicate a fraction of the RTCP bandwidth to senders unless
|
/* Dedicate a fraction of the RTCP bandwidth to senders unless
|
||||||
|
|
Loading…
Reference in a new issue