summaryrefslogtreecommitdiffstats
path: root/gst/rtpmanager/gstrtpssrcdemux.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2007-04-05 13:54:23 +0000
committerWim Taymans <wim.taymans@gmail.com>2007-04-05 13:54:23 +0000
commitb1e2b088796ab44ae047a76960d65ef5ace8f627 (patch)
treecc46d3d5d7702a7d7aa3f2c8122e50a3dc2baad2 /gst/rtpmanager/gstrtpssrcdemux.c
parent91167f63f40c2606815cfeba666096ecc2030a4b (diff)
downloadgst-plugins-bad-b1e2b088796ab44ae047a76960d65ef5ace8f627.tar.gz
gst-plugins-bad-b1e2b088796ab44ae047a76960d65ef5ace8f627.tar.bz2
gst-plugins-bad-b1e2b088796ab44ae047a76960d65ef5ace8f627.zip
gst/rtpmanager/gstrtpbin.*: Add debugging category.
Original commit message from CVS: * gst/rtpmanager/gstrtpbin.c: (find_session_by_id), (create_session), (find_stream_by_ssrc), (create_stream), (gst_rtp_bin_class_init), (new_payload_found), (new_ssrc_pad_found), (create_recv_rtp), (create_recv_rtcp), (create_send_rtp), (create_rtcp): * gst/rtpmanager/gstrtpbin.h: Add debugging category. Added RTPStream to manage stream per SSRC, each with its own jitterbuffer and ptdemux. Added SSRCDemux. Connect to various SSRC and PT signals and create ghostpads, link stuff. * gst/rtpmanager/gstrtpmanager.c: (plugin_init): Added rtpbin to elements. * gst/rtpmanager/gstrtpptdemux.c: (gst_rtp_pt_demux_chain): Fix caps and forward GstFlowReturn * gst/rtpmanager/gstrtpsession.c: (gst_rtp_session_class_init), (gst_rtp_session_event_recv_rtp_sink), (gst_rtp_session_chain_recv_rtp), (gst_rtp_session_event_recv_rtcp_sink), (gst_rtp_session_chain_recv_rtcp), (gst_rtp_session_event_send_rtp_sink), (gst_rtp_session_chain_send_rtp), (create_recv_rtp_sink), (create_recv_rtcp_sink), (create_send_rtp_sink), (create_rtcp_src), (gst_rtp_session_request_new_pad): Add debug category. Add event handling * gst/rtpmanager/gstrtpssrcdemux.c: (find_rtp_pad_for_ssrc), (create_rtp_pad_for_ssrc), (gst_rtp_ssrc_demux_class_init), (gst_rtp_ssrc_demux_init), (gst_rtp_ssrc_demux_chain), (gst_rtp_ssrc_demux_change_state): * gst/rtpmanager/gstrtpssrcdemux.h: Add debug category. Add new-pt-pad signal.
Diffstat (limited to 'gst/rtpmanager/gstrtpssrcdemux.c')
-rw-r--r--gst/rtpmanager/gstrtpssrcdemux.c50
1 files changed, 32 insertions, 18 deletions
diff --git a/gst/rtpmanager/gstrtpssrcdemux.c b/gst/rtpmanager/gstrtpssrcdemux.c
index fe6f1bee..3237100c 100644
--- a/gst/rtpmanager/gstrtpssrcdemux.c
+++ b/gst/rtpmanager/gstrtpssrcdemux.c
@@ -28,6 +28,9 @@
#include "gstrtpssrcdemux.h"
+GST_DEBUG_CATEGORY_STATIC (gst_rtp_ssrc_demux_debug);
+#define GST_CAT_DEFAULT gst_rtp_ssrc_demux_debug
+
/* generic templates */
static GstStaticPadTemplate rtp_ssrc_demux_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
@@ -50,12 +53,10 @@ static GstElementDetails gst_rtp_ssrc_demux_details = {
"Wim Taymans <wim@fluendo.com>"
};
-GST_DEBUG_CATEGORY_STATIC (gst_rtp_ssrc_demux_debug);
-#define GST_CAT_DEFAULT gst_rtp_ssrc_demux_debug
-
/* signals */
enum
{
+ SIGNAL_NEW_SSRC_PAD,
LAST_SIGNAL
};
@@ -77,7 +78,7 @@ static gboolean gst_rtp_ssrc_demux_sink_event (GstPad * pad, GstEvent * event);
/* srcpad stuff */
static gboolean gst_rtp_ssrc_demux_src_event (GstPad * pad, GstEvent * event);
-/* static guint gst_rtp_ssrc_demux_signals[LAST_SIGNAL] = { 0 }; */
+static guint gst_rtp_ssrc_demux_signals[LAST_SIGNAL] = { 0 };
/**
* Item for storing GstPad <-> SSRC pairs.
@@ -91,11 +92,11 @@ struct _GstRTPSsrcDemuxPad
/* find a src pad for a given SSRC, returns NULL if the SSRC was not found
*/
static GstPad *
-find_pad_for_ssrc (GstRTPSsrcDemux * demux, guint32 ssrc)
+find_rtp_pad_for_ssrc (GstRTPSsrcDemux * demux, guint32 ssrc)
{
GSList *walk;
- for (walk = demux->srcpads; walk; walk = g_slist_next (walk)) {
+ for (walk = demux->rtp_srcpads; walk; walk = g_slist_next (walk)) {
GstRTPSsrcDemuxPad *pad = (GstRTPSsrcDemuxPad *) walk->data;
if (pad->ssrc == ssrc)
@@ -105,7 +106,7 @@ find_pad_for_ssrc (GstRTPSsrcDemux * demux, guint32 ssrc)
}
static GstPad *
-create_pad_for_ssrc (GstRTPSsrcDemux * demux, guint32 ssrc)
+create_rtp_pad_for_ssrc (GstRTPSsrcDemux * demux, guint32 ssrc)
{
GstPad *result;
GstElementClass *klass;
@@ -123,15 +124,18 @@ create_pad_for_ssrc (GstRTPSsrcDemux * demux, guint32 ssrc)
demuxpad = g_new0 (GstRTPSsrcDemuxPad, 1);
demuxpad->ssrc = ssrc;
demuxpad->pad = result;
- demux->srcpads = g_slist_prepend (demux->srcpads, demuxpad);
+ demux->rtp_srcpads = g_slist_prepend (demux->rtp_srcpads, demuxpad);
/* copy caps from input */
- gst_pad_set_caps (result, GST_PAD_CAPS (demux->sinkpad));
+ gst_pad_set_caps (result, GST_PAD_CAPS (demux->rtp_sink));
gst_pad_set_event_function (result, gst_rtp_ssrc_demux_src_event);
gst_pad_set_active (result, TRUE);
gst_element_add_pad (GST_ELEMENT_CAST (demux), result);
+ g_signal_emit (G_OBJECT (demux),
+ gst_rtp_ssrc_demux_signals[SIGNAL_NEW_SSRC_PAD], 0, ssrc, result);
+
return result;
}
@@ -159,6 +163,13 @@ gst_rtp_ssrc_demux_class_init (GstRTPSsrcDemuxClass * klass)
gobject_klass->finalize = GST_DEBUG_FUNCPTR (gst_rtp_ssrc_demux_finalize);
+ gst_rtp_ssrc_demux_signals[SIGNAL_NEW_SSRC_PAD] =
+ g_signal_new ("new-ssrc-pad",
+ G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstRTPSsrcDemuxClass, new_ssrc_pad),
+ NULL, NULL, g_cclosure_marshal_VOID__UINT_POINTER,
+ G_TYPE_NONE, 2, G_TYPE_INT, GST_TYPE_PAD);
+
gstelement_klass->change_state =
GST_DEBUG_FUNCPTR (gst_rtp_ssrc_demux_change_state);
@@ -172,12 +183,12 @@ gst_rtp_ssrc_demux_init (GstRTPSsrcDemux * demux,
{
GstElementClass *klass = GST_ELEMENT_GET_CLASS (demux);
- demux->sinkpad =
+ demux->rtp_sink =
gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
"sink"), "sink");
- gst_pad_set_chain_function (demux->sinkpad, gst_rtp_ssrc_demux_chain);
- gst_pad_set_event_function (demux->sinkpad, gst_rtp_ssrc_demux_sink_event);
- gst_element_add_pad (GST_ELEMENT_CAST (demux), demux->sinkpad);
+ gst_pad_set_chain_function (demux->rtp_sink, gst_rtp_ssrc_demux_chain);
+ gst_pad_set_event_function (demux->rtp_sink, gst_rtp_ssrc_demux_sink_event);
+ gst_element_add_pad (GST_ELEMENT_CAST (demux), demux->rtp_sink);
}
static void
@@ -224,9 +235,12 @@ gst_rtp_ssrc_demux_chain (GstPad * pad, GstBuffer * buf)
ssrc = gst_rtp_buffer_get_ssrc (buf);
- srcpad = find_pad_for_ssrc (demux, ssrc);
+ GST_DEBUG_OBJECT (demux, "received buffer of SSRC %08x", ssrc);
+
+ srcpad = find_rtp_pad_for_ssrc (demux, ssrc);
if (srcpad == NULL) {
- srcpad = create_pad_for_ssrc (demux, ssrc);
+ GST_DEBUG_OBJECT (demux, "creating pad for SSRC %08x", ssrc);
+ srcpad = create_rtp_pad_for_ssrc (demux, ssrc);
if (!srcpad)
goto create_failed;
}
@@ -239,11 +253,11 @@ gst_rtp_ssrc_demux_chain (GstPad * pad, GstBuffer * buf)
/* ERRORS */
invalid_payload:
{
- /* this is not fatal yet */
- GST_ELEMENT_WARNING (demux, STREAM, DECODE, (NULL),
+ /* this is fatal and should be filtered earlier */
+ GST_ELEMENT_ERROR (demux, STREAM, DECODE, (NULL),
("Dropping invalid RTP payload"));
gst_buffer_unref (buf);
- return GST_FLOW_OK;
+ return GST_FLOW_ERROR;
}
create_failed:
{