Commit 519305d1 authored by Wim Taymans's avatar Wim Taymans

jitterbuffer: improve sync on first packets

Don't throw away the first RTCP packet if it arrives before the first
RTP packet but remember and use it to signal sync once we get the
RTP packet.

See https://bugzilla.gnome.org/show_bug.cgi?id=691400
parent 8969f006
...@@ -275,6 +275,7 @@ gst_rtp_jitter_buffer_clear_pt_map (GstRtpJitterBuffer * jitterbuffer); ...@@ -275,6 +275,7 @@ gst_rtp_jitter_buffer_clear_pt_map (GstRtpJitterBuffer * jitterbuffer);
static GstClockTime static GstClockTime
gst_rtp_jitter_buffer_set_active (GstRtpJitterBuffer * jitterbuffer, gst_rtp_jitter_buffer_set_active (GstRtpJitterBuffer * jitterbuffer,
gboolean active, guint64 base_time); gboolean active, guint64 base_time);
static void do_handle_sync (GstRtpJitterBuffer * jitterbuffer);
static void static void
gst_rtp_jitter_buffer_class_init (GstRtpJitterBufferClass * klass) gst_rtp_jitter_buffer_class_init (GstRtpJitterBufferClass * klass)
...@@ -1392,6 +1393,10 @@ gst_rtp_jitter_buffer_chain (GstPad * pad, GstObject * parent, ...@@ -1392,6 +1393,10 @@ gst_rtp_jitter_buffer_chain (GstPad * pad, GstObject * parent,
priv->clock_rate, &tail, &percent))) priv->clock_rate, &tail, &percent)))
goto duplicate; goto duplicate;
/* we had an unhandled SR, handle it now */
if (priv->last_sr)
do_handle_sync (jitterbuffer);
/* signal addition of new buffer when the _loop is waiting. */ /* signal addition of new buffer when the _loop is waiting. */
if (priv->waiting && priv->active) if (priv->waiting && priv->active)
JBUF_SIGNAL (priv); JBUF_SIGNAL (priv);
...@@ -2007,11 +2012,6 @@ do_handle_sync (GstRtpJitterBuffer * jitterbuffer) ...@@ -2007,11 +2012,6 @@ do_handle_sync (GstRtpJitterBuffer * jitterbuffer)
priv = jitterbuffer->priv; priv = jitterbuffer->priv;
if (priv->last_sr == NULL) {
GST_DEBUG_OBJECT (jitterbuffer, "dropping, no SR RTCP");
return;
}
/* get the last values from the jitterbuffer */ /* get the last values from the jitterbuffer */
rtp_jitter_buffer_get_sync (priv->jbuf, &base_rtptime, &base_time, rtp_jitter_buffer_get_sync (priv->jbuf, &base_rtptime, &base_time,
&clock_rate, &last_rtptime); &clock_rate, &last_rtptime);
...@@ -2065,6 +2065,7 @@ do_handle_sync (GstRtpJitterBuffer * jitterbuffer) ...@@ -2065,6 +2065,7 @@ do_handle_sync (GstRtpJitterBuffer * jitterbuffer)
"sr-buffer", GST_TYPE_BUFFER, priv->last_sr, NULL); "sr-buffer", GST_TYPE_BUFFER, priv->last_sr, NULL);
GST_DEBUG_OBJECT (jitterbuffer, "signaling sync"); GST_DEBUG_OBJECT (jitterbuffer, "signaling sync");
gst_buffer_replace (&priv->last_sr, NULL);
JBUF_UNLOCK (priv); JBUF_UNLOCK (priv);
g_signal_emit (jitterbuffer, g_signal_emit (jitterbuffer,
gst_rtp_jitter_buffer_signals[SIGNAL_HANDLE_SYNC], 0, s); gst_rtp_jitter_buffer_signals[SIGNAL_HANDLE_SYNC], 0, s);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment