diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2007-09-15 18:48:03 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2007-09-15 18:48:03 +0000 |
commit | 6494828ef2e9aefb41822cf476afe4b306ceb42a (patch) | |
tree | 15f086dc4e98736591f826d218654c2566bcb814 | |
parent | f6b7f47cf430393041bd4262ddac2bb51a3a8a1d (diff) | |
download | gst-plugins-bad-6494828ef2e9aefb41822cf476afe4b306ceb42a.tar.gz gst-plugins-bad-6494828ef2e9aefb41822cf476afe4b306ceb42a.tar.bz2 gst-plugins-bad-6494828ef2e9aefb41822cf476afe4b306ceb42a.zip |
gst/rtpmanager/gstrtpbin.c: Also set NTP base time on new sessions.
Original commit message from CVS:
* gst/rtpmanager/gstrtpbin.c: (create_session):
Also set NTP base time on new sessions.
* gst/rtpmanager/gstrtpjitterbuffer.c:
(gst_rtp_jitter_buffer_loop), (gst_rtp_jitter_buffer_query),
(gst_rtp_jitter_buffer_set_property),
(gst_rtp_jitter_buffer_get_property):
Use the right lock to protect our variables.
Fix some comment.
* gst/rtpmanager/gstrtpsession.c:
(gst_rtp_session_getcaps_send_rtp),
(gst_rtp_session_chain_send_rtp), (create_send_rtp_sink):
Implement getcaps on the sender sinkpad so that payloaders can negotiate
the right SSRC.
-rw-r--r-- | ChangeLog | 18 | ||||
-rw-r--r-- | gst/rtpmanager/gstrtpbin.c | 3 | ||||
-rw-r--r-- | gst/rtpmanager/gstrtpjitterbuffer.c | 13 | ||||
-rw-r--r-- | gst/rtpmanager/gstrtpsession.c | 34 |
4 files changed, 62 insertions, 6 deletions
@@ -1,3 +1,21 @@ +2007-09-15 Wim Taymans <wim.taymans@gmail.com> + + * gst/rtpmanager/gstrtpbin.c: (create_session): + Also set NTP base time on new sessions. + + * gst/rtpmanager/gstrtpjitterbuffer.c: + (gst_rtp_jitter_buffer_loop), (gst_rtp_jitter_buffer_query), + (gst_rtp_jitter_buffer_set_property), + (gst_rtp_jitter_buffer_get_property): + Use the right lock to protect our variables. + Fix some comment. + + * gst/rtpmanager/gstrtpsession.c: + (gst_rtp_session_getcaps_send_rtp), + (gst_rtp_session_chain_send_rtp), (create_send_rtp_sink): + Implement getcaps on the sender sinkpad so that payloaders can negotiate + the right SSRC. + 2007-09-12 Wim Taymans <wim.taymans@gmail.com> * gst/rtpmanager/gstrtpbin.c: (create_session), (free_session), diff --git a/gst/rtpmanager/gstrtpbin.c b/gst/rtpmanager/gstrtpbin.c index 6f288bdc..eb028fb1 100644 --- a/gst/rtpmanager/gstrtpbin.c +++ b/gst/rtpmanager/gstrtpbin.c @@ -427,6 +427,9 @@ create_session (GstRtpBin * rtpbin, gint id) sess->ptmap = g_hash_table_new (NULL, NULL); rtpbin->sessions = g_slist_prepend (rtpbin->sessions, sess); + /* set NTP base or new session */ + g_object_set (session, "ntp-ns-base", rtpbin->priv->ntp_ns_base, NULL); + /* provide clock_rate to the session manager when needed */ g_signal_connect (session, "request-pt-map", (GCallback) pt_map_requested, sess); diff --git a/gst/rtpmanager/gstrtpjitterbuffer.c b/gst/rtpmanager/gstrtpjitterbuffer.c index 497ce89d..327ff0a3 100644 --- a/gst/rtpmanager/gstrtpjitterbuffer.c +++ b/gst/rtpmanager/gstrtpjitterbuffer.c @@ -1018,7 +1018,8 @@ again: priv->clock_base = exttimestamp; } - /* take rtp timestamp offset into account, this can wrap around */ + /* take rtp timestamp offset into account, this should not wrap around since + * we are dealing with the extended timestamp here. */ exttimestamp -= priv->clock_base; /* bring timestamp to gst time */ @@ -1218,9 +1219,8 @@ gst_rtp_jitter_buffer_query (GstPad * pad, GstQuery * query) /* store this so that we can safely sync on the peer buffers. */ JBUF_LOCK (priv); priv->peer_latency = min_latency; - JBUF_UNLOCK (priv); - our_latency = ((guint64) priv->latency_ms) * GST_MSECOND; + JBUF_UNLOCK (priv); GST_DEBUG_OBJECT (jitterbuffer, "Our latency: %" GST_TIME_FORMAT, GST_TIME_ARGS (our_latency)); @@ -1263,11 +1263,12 @@ gst_rtp_jitter_buffer_set_property (GObject * object, { guint new_latency, old_latency; - /* FIXME, not threadsafe */ new_latency = g_value_get_uint (value); - old_latency = priv->latency_ms; + JBUF_LOCK (priv); + old_latency = priv->latency_ms; priv->latency_ms = new_latency; + JBUF_UNLOCK (priv); /* post message if latency changed, this will inform the parent pipeline * that a latency reconfiguration is possible/needed. */ @@ -1306,7 +1307,9 @@ gst_rtp_jitter_buffer_get_property (GObject * object, switch (prop_id) { case PROP_LATENCY: + JBUF_LOCK (priv); g_value_set_uint (value, priv->latency_ms); + JBUF_UNLOCK (priv); break; case PROP_DROP_ON_LATENCY: g_value_set_boolean (value, priv->drop_on_latency); diff --git a/gst/rtpmanager/gstrtpsession.c b/gst/rtpmanager/gstrtpsession.c index 44f6535a..6d4cf8b0 100644 --- a/gst/rtpmanager/gstrtpsession.c +++ b/gst/rtpmanager/gstrtpsession.c @@ -1226,6 +1226,33 @@ gst_rtp_session_event_send_rtp_sink (GstPad * pad, GstEvent * event) return ret; } +static GstCaps * +gst_rtp_session_getcaps_send_rtp (GstPad * pad) +{ + GstRtpSession *rtpsession; + GstRtpSessionPrivate *priv; + GstCaps *result; + GstStructure *s1, *s2; + + rtpsession = GST_RTP_SESSION (gst_pad_get_parent (pad)); + priv = rtpsession->priv; + + /* we can basically accept anything but we prefer to receive packets with our + * internal SSRC so that we don't have to patch it. Create a structure with + * the SSRC and another one without. */ + s1 = gst_structure_new ("application/x-rtp", + "ssrc", G_TYPE_UINT, priv->session->source->ssrc, NULL); + s2 = gst_structure_new ("application/x-rtp", NULL); + + result = gst_caps_new_full (s1, s2, NULL); + + GST_DEBUG_OBJECT (rtpsession, "getting caps %" GST_PTR_FORMAT, result); + + gst_object_unref (rtpsession); + + return result; +} + /* Recieve an RTP packet to be send to the receivers, send to RTP session * manager and forward to send_rtp_src. */ @@ -1252,8 +1279,11 @@ gst_rtp_session_chain_send_rtp (GstPad * pad, GstBuffer * buffer) timestamp); /* convert to NTP time by adding the NTP base */ ntpnstime += priv->ntpnsbase; - } else + } else { + /* no timestamp, we could take the current running_time and convert it to + * NTP time. */ ntpnstime = -1; + } ret = rtp_session_send_rtp (priv->session, buffer, ntpnstime); @@ -1341,6 +1371,8 @@ create_send_rtp_sink (GstRtpSession * rtpsession) "send_rtp_sink"); gst_pad_set_chain_function (rtpsession->send_rtp_sink, gst_rtp_session_chain_send_rtp); + gst_pad_set_getcaps_function (rtpsession->send_rtp_sink, + gst_rtp_session_getcaps_send_rtp); gst_pad_set_event_function (rtpsession->send_rtp_sink, gst_rtp_session_event_send_rtp_sink); gst_pad_set_internal_link_function (rtpsession->send_rtp_sink, |