summaryrefslogtreecommitdiffstats
path: root/gst/rtpmanager/gstrtpssrcdemux.c
diff options
context:
space:
mode:
Diffstat (limited to 'gst/rtpmanager/gstrtpssrcdemux.c')
-rw-r--r--gst/rtpmanager/gstrtpssrcdemux.c82
1 files changed, 81 insertions, 1 deletions
diff --git a/gst/rtpmanager/gstrtpssrcdemux.c b/gst/rtpmanager/gstrtpssrcdemux.c
index 64394c45..6a305d8e 100644
--- a/gst/rtpmanager/gstrtpssrcdemux.c
+++ b/gst/rtpmanager/gstrtpssrcdemux.c
@@ -97,6 +97,8 @@ static GstElementDetails gst_rtp_ssrc_demux_details = {
enum
{
SIGNAL_NEW_SSRC_PAD,
+ SIGNAL_REMOVED_SSRC_PAD,
+ SIGNAL_CLEAR_SSRC,
LAST_SIGNAL
};
@@ -112,6 +114,9 @@ static void gst_rtp_ssrc_demux_finalize (GObject * object);
static GstStateChangeReturn gst_rtp_ssrc_demux_change_state (GstElement *
element, GstStateChange transition);
+static void gst_rtp_ssrc_demux_clear_ssrc (GstRtpSsrcDemux * demux,
+ guint32 ssrc);
+
/* sinkpad stuff */
static GstFlowReturn gst_rtp_ssrc_demux_chain (GstPad * pad, GstBuffer * buf);
static gboolean gst_rtp_ssrc_demux_sink_event (GstPad * pad, GstEvent * event);
@@ -245,9 +250,11 @@ gst_rtp_ssrc_demux_class_init (GstRtpSsrcDemuxClass * klass)
{
GObjectClass *gobject_klass;
GstElementClass *gstelement_klass;
+ GstRtpSsrcDemuxClass *gstrtpssrcdemux_klass;
gobject_klass = (GObjectClass *) klass;
gstelement_klass = (GstElementClass *) klass;
+ gstrtpssrcdemux_klass = (GstRtpSsrcDemuxClass *) klass;
gobject_klass->dispose = GST_DEBUG_FUNCPTR (gst_rtp_ssrc_demux_dispose);
gobject_klass->finalize = GST_DEBUG_FUNCPTR (gst_rtp_ssrc_demux_finalize);
@@ -267,8 +274,38 @@ gst_rtp_ssrc_demux_class_init (GstRtpSsrcDemuxClass * klass)
NULL, NULL, gst_rtp_bin_marshal_VOID__UINT_OBJECT,
G_TYPE_NONE, 2, G_TYPE_UINT, GST_TYPE_PAD);
+ /**
+ * GstRtpSsrcDemux::removed-ssrc-pad:
+ * @demux: the object which received the signal
+ * @ssrc: the SSRC of the pad
+ * @pad: the removed pad.
+ *
+ * Emited when a SSRC pad has been removed.
+ */
+ gst_rtp_ssrc_demux_signals[SIGNAL_REMOVED_SSRC_PAD] =
+ g_signal_new ("removed-ssrc-pad",
+ G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstRtpSsrcDemuxClass, removed_ssrc_pad),
+ NULL, NULL, gst_rtp_bin_marshal_VOID__UINT_OBJECT,
+ G_TYPE_NONE, 2, G_TYPE_UINT, GST_TYPE_PAD);
+
+ /**
+ * GstRtpSsrcDemux::clear-ssrc:
+ * @demux: the object which received the signal
+ * @ssrc: the SSRC of the pad
+ *
+ * Action signal to remove the pad for SSRC.
+ */
+ gst_rtp_ssrc_demux_signals[SIGNAL_CLEAR_SSRC] =
+ g_signal_new ("clear-ssrc",
+ G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GstRtpSsrcDemuxClass, clear_ssrc),
+ NULL, NULL, gst_rtp_bin_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT);
+
gstelement_klass->change_state =
GST_DEBUG_FUNCPTR (gst_rtp_ssrc_demux_change_state);
+ gstrtpssrcdemux_klass->clear_ssrc =
+ GST_DEBUG_FUNCPTR (gst_rtp_ssrc_demux_clear_ssrc);
GST_DEBUG_CATEGORY_INIT (gst_rtp_ssrc_demux_debug,
"rtpssrcdemux", 0, "RTP SSRC demuxer");
@@ -342,6 +379,43 @@ gst_rtp_ssrc_demux_finalize (GObject * object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
+static void
+gst_rtp_ssrc_demux_clear_ssrc (GstRtpSsrcDemux * demux, guint32 ssrc)
+{
+ GstRtpSsrcDemuxPad *dpad;
+
+ GST_PAD_LOCK (demux);
+ dpad = find_demux_pad_for_ssrc (demux, ssrc);
+ if (dpad != NULL)
+ 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);
+
+ gst_pad_set_active (dpad->rtp_pad, FALSE);
+ gst_pad_set_active (dpad->rtcp_pad, FALSE);
+
+ g_signal_emit (G_OBJECT (demux),
+ gst_rtp_ssrc_demux_signals[SIGNAL_REMOVED_SSRC_PAD], 0, ssrc,
+ dpad->rtp_pad);
+
+ gst_element_remove_pad (GST_ELEMENT_CAST (demux), dpad->rtp_pad);
+ gst_element_remove_pad (GST_ELEMENT_CAST (demux), dpad->rtcp_pad);
+
+ g_free (dpad);
+
+ return;
+
+ /* ERRORS */
+unknown_pad:
+ {
+ g_warning ("unknown SSRC %08x", ssrc);
+ return;
+ }
+}
+
static gboolean
gst_rtp_ssrc_demux_sink_event (GstPad * pad, GstEvent * event)
{
@@ -483,7 +557,7 @@ gst_rtp_ssrc_demux_rtcp_chain (GstPad * pad, GstBuffer * buf)
NULL);
break;
default:
- goto invalid_rtcp;
+ goto unexpected_rtcp;
}
GST_DEBUG_OBJECT (demux, "received RTCP of SSRC %08x", ssrc);
@@ -511,6 +585,12 @@ invalid_rtcp:
gst_buffer_unref (buf);
return GST_FLOW_ERROR;
}
+unexpected_rtcp:
+ {
+ GST_DEBUG_OBJECT (demux, "dropping unexpected RTCP packet");
+ gst_buffer_unref (buf);
+ return GST_FLOW_OK;
+ }
create_failed:
{
GST_ELEMENT_ERROR (demux, STREAM, DECODE, (NULL),