summaryrefslogtreecommitdiffstats
path: root/gst/rtpmanager/gstrtpbin.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2007-04-30 13:41:30 +0000
committerWim Taymans <wim.taymans@gmail.com>2007-04-30 13:41:30 +0000
commit5171199836b057eef7d98542268c5918fdaa47cd (patch)
tree32e7ccbfd16994fcaa1f3e09a6d4c711892e5251 /gst/rtpmanager/gstrtpbin.c
parentf4508d302c4edb5f51374815c360b4bcc6b9f43d (diff)
downloadgst-plugins-bad-5171199836b057eef7d98542268c5918fdaa47cd.tar.gz
gst-plugins-bad-5171199836b057eef7d98542268c5918fdaa47cd.tar.bz2
gst-plugins-bad-5171199836b057eef7d98542268c5918fdaa47cd.zip
gst/rtpmanager/async_jitter_queue.c: Fix the case where the buffer underruns and does not block.
Original commit message from CVS: * gst/rtpmanager/async_jitter_queue.c: (signal_waiting_threads), (async_jitter_queue_pop_intern_unlocked): Fix the case where the buffer underruns and does not block. * gst/rtpmanager/gstrtpbin.c: (gst_rtp_bin_base_init), (create_recv_rtcp), (create_send_rtp), (create_rtcp), (gst_rtp_bin_request_new_pad): Rename RTCP send pad, like in the session manager. Allow getting an RTCP pad for receiving even if we don't receive RTP. fix handling of send_rtp_src pad. * gst/rtpmanager/gstrtpptdemux.c: (gst_rtp_pt_demux_chain): When no pt map could be found, fall back to the sinkpad caps. * gst/rtpmanager/gstrtpsession.c: (gst_rtp_session_process_rtp), (gst_rtp_session_send_rtp), (create_recv_rtp_sink), (create_recv_rtcp_sink), (create_send_rtp_sink), (create_send_rtcp_src): Fix pad names. * gst/rtpmanager/rtpsession.c: (source_push_rtp), (rtp_session_create_source), (rtp_session_process_sr), (rtp_session_send_rtp), (session_start_rtcp): * gst/rtpmanager/rtpsession.h: Unlock session when performing a callback. Add callbacks for the internal session object. Fix sending of RTP packets. first attempt at adding NTP times in the SR packets. Small debug and doc improvements. * gst/rtpmanager/rtpsource.c: (rtp_source_send_rtp): Update stats for SR reports.
Diffstat (limited to 'gst/rtpmanager/gstrtpbin.c')
-rw-r--r--gst/rtpmanager/gstrtpbin.c51
1 files changed, 30 insertions, 21 deletions
diff --git a/gst/rtpmanager/gstrtpbin.c b/gst/rtpmanager/gstrtpbin.c
index eb827392..927755f5 100644
--- a/gst/rtpmanager/gstrtpbin.c
+++ b/gst/rtpmanager/gstrtpbin.c
@@ -84,8 +84,8 @@ GST_STATIC_PAD_TEMPLATE ("recv_rtp_src_%d_%d_%d",
GST_STATIC_CAPS ("application/x-rtp")
);
-static GstStaticPadTemplate rtpbin_rtcp_src_template =
-GST_STATIC_PAD_TEMPLATE ("rtcp_src_%d",
+static GstStaticPadTemplate rtpbin_send_rtcp_src_template =
+GST_STATIC_PAD_TEMPLATE ("send_rtcp_src_%d",
GST_PAD_SRC,
GST_PAD_REQUEST,
GST_STATIC_CAPS ("application/x-rtcp")
@@ -195,7 +195,7 @@ struct _GstRTPBinSession
GstPad *recv_rtcp_src;
GstPad *send_rtp_sink;
GstPad *send_rtp_src;
- GstPad *rtcp_src;
+ GstPad *send_rtcp_src;
};
/* find a session with the given id. Must be called with RTP_BIN_LOCK */
@@ -432,7 +432,7 @@ gst_rtp_bin_base_init (gpointer klass)
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&rtpbin_recv_rtp_src_template));
gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&rtpbin_rtcp_src_template));
+ gst_static_pad_template_get (&rtpbin_send_rtcp_src_template));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&rtpbin_send_rtp_src_template));
@@ -795,10 +795,15 @@ create_recv_rtcp (GstRTPBin * rtpbin, GstPadTemplate * templ,
GST_DEBUG_OBJECT (rtpbin, "finding session %d", sessid);
- /* get the session, it must exist or we error */
+ /* get or create the session */
session = find_session_by_id (rtpbin, sessid);
- if (!session)
- goto no_session;
+ if (!session) {
+ GST_DEBUG_OBJECT (rtpbin, "creating session %d", sessid);
+ /* create session now */
+ session = create_session (rtpbin, sessid);
+ if (session == NULL)
+ goto create_error;
+ }
/* check if pad was requested */
if (session->recv_rtcp_sink != NULL)
@@ -841,9 +846,9 @@ no_name:
g_warning ("rtpbin: invalid name given");
return NULL;
}
-no_session:
+create_error:
{
- g_warning ("rtpbin: no session with id %d", sessid);
+ /* create_session already warned */
return NULL;
}
existed:
@@ -872,7 +877,7 @@ link_failed:
static GstPad *
create_send_rtp (GstRTPBin * rtpbin, GstPadTemplate * templ, const gchar * name)
{
- GstPad *result, *srcpad, *srcghost;
+ GstPad *result, *srcghost;
gchar *gname;
guint sessid;
GstRTPBinSession *session;
@@ -895,7 +900,7 @@ create_send_rtp (GstRTPBin * rtpbin, GstPadTemplate * templ, const gchar * name)
if (session->send_rtp_sink != NULL)
goto existed;
- /* get recv_rtp pad and store */
+ /* get send_rtp pad and store */
session->send_rtp_sink =
gst_element_get_request_pad (session->session, "send_rtp_sink");
if (session->send_rtp_sink == NULL)
@@ -907,8 +912,9 @@ create_send_rtp (GstRTPBin * rtpbin, GstPadTemplate * templ, const gchar * name)
gst_element_add_pad (GST_ELEMENT_CAST (rtpbin), result);
/* get srcpad */
- srcpad = gst_element_get_pad (session->session, "send_rtp_src");
- if (srcpad == NULL)
+ session->send_rtp_src =
+ gst_element_get_static_pad (session->session, "send_rtp_src");
+ if (session->send_rtp_src == NULL)
goto no_srcpad;
/* ghost the new source pad */
@@ -916,7 +922,7 @@ create_send_rtp (GstRTPBin * rtpbin, GstPadTemplate * templ, const gchar * name)
gname = g_strdup_printf ("send_rtp_src_%d", sessid);
templ = gst_element_class_get_pad_template (klass, "send_rtp_src_%d");
srcghost =
- gst_ghost_pad_new_from_template (gname, session->send_rtp_sink, templ);
+ gst_ghost_pad_new_from_template (gname, session->send_rtp_src, templ);
gst_pad_set_active (srcghost, TRUE);
gst_element_add_pad (GST_ELEMENT_CAST (rtpbin), srcghost);
g_free (gname);
@@ -962,7 +968,7 @@ create_rtcp (GstRTPBin * rtpbin, GstPadTemplate * templ, const gchar * name)
GstRTPBinSession *session;
/* first get the session number */
- if (name == NULL || sscanf (name, "rtcp_src_%d", &sessid) != 1)
+ if (name == NULL || sscanf (name, "send_rtcp_src_%d", &sessid) != 1)
goto no_name;
/* get or create session */
@@ -971,16 +977,17 @@ create_rtcp (GstRTPBin * rtpbin, GstPadTemplate * templ, const gchar * name)
goto no_session;
/* check if pad was requested */
- if (session->rtcp_src != NULL)
+ if (session->send_rtcp_src != NULL)
goto existed;
/* get rtcp_src pad and store */
- session->rtcp_src =
+ session->send_rtcp_src =
gst_element_get_request_pad (session->session, "send_rtcp_src");
- if (session->rtcp_src == NULL)
+ if (session->send_rtcp_src == NULL)
goto pad_failed;
- result = gst_ghost_pad_new_from_template (name, session->rtcp_src, templ);
+ result =
+ gst_ghost_pad_new_from_template (name, session->send_rtcp_src, templ);
gst_pad_set_active (result, TRUE);
gst_element_add_pad (GST_ELEMENT_CAST (rtpbin), result);
@@ -999,7 +1006,8 @@ no_session:
}
existed:
{
- g_warning ("rtpbin: rtcp_src pad already requested for session %d", sessid);
+ g_warning ("rtpbin: send_rtcp_src pad already requested for session %d",
+ sessid);
return NULL;
}
pad_failed:
@@ -1036,7 +1044,8 @@ gst_rtp_bin_request_new_pad (GstElement * element,
} else if (templ == gst_element_class_get_pad_template (klass,
"send_rtp_sink_%d")) {
result = create_send_rtp (rtpbin, templ, name);
- } else if (templ == gst_element_class_get_pad_template (klass, "rtcp_src_%d")) {
+ } else if (templ == gst_element_class_get_pad_template (klass,
+ "send_rtcp_src_%d")) {
result = create_rtcp (rtpbin, templ, name);
} else
goto wrong_template;