diff options
author | Andrew <nifigase@gmail.com> | 2017-02-08 13:36:00 +0000 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2017-02-27 18:23:43 +0200 |
commit | ec1769b0480e60ee42ecf4a1f95ee33c94d0a3af (patch) | |
tree | 8eb003a66531d4697f40c6b9b6f1dee2553db53d | |
parent | 5896854c03bc850dfea94ec630ab3bcd97374390 (diff) | |
download | gstreamer-plugins-good-ec1769b0480e60ee42ecf4a1f95ee33c94d0a3af.tar.gz |
rtpjitterbuffer: Don't always reset PTS to 0 after a gap
In function rtp_jitter_buffer_calculate_pts: If gap in incoming RTP
timestamps is more than (3 * jbuf->clock_rate) we call
rtp_jitter_buffer_reset_skew which resets pts to 0. So components down
the pipeline (playes, mixers) just skip frames/samples until pts becomes
equal to pts before gap.
In version 1.10.2 and before this checking was bypassed for packets with
"estimated dts", and gaps were handled correctly.
https://bugzilla.gnome.org/show_bug.cgi?id=778341
-rw-r--r-- | gst/rtpmanager/gstrtpjitterbuffer.c | 11 | ||||
-rw-r--r-- | gst/rtpmanager/rtpjitterbuffer.c | 4 | ||||
-rw-r--r-- | gst/rtpmanager/rtpjitterbuffer.h | 2 |
3 files changed, 10 insertions, 7 deletions
diff --git a/gst/rtpmanager/gstrtpjitterbuffer.c b/gst/rtpmanager/gstrtpjitterbuffer.c index 2ca9fe742..64f05dc41 100644 --- a/gst/rtpmanager/gstrtpjitterbuffer.c +++ b/gst/rtpmanager/gstrtpjitterbuffer.c @@ -2929,8 +2929,9 @@ gst_rtp_jitter_buffer_chain (GstPad * pad, GstObject * parent, GST_DEBUG_OBJECT (jitterbuffer, "First buffer #%d", seqnum); /* calculate a pts based on rtptime and arrival time (dts) */ - pts = rtp_jitter_buffer_calculate_pts (priv->jbuf, dts, rtptime, - gst_element_get_base_time (GST_ELEMENT_CAST (jitterbuffer))); + pts = + rtp_jitter_buffer_calculate_pts (priv->jbuf, dts, estimated_dts, + rtptime, gst_element_get_base_time (GST_ELEMENT_CAST (jitterbuffer))); /* we don't know what the next_in_seqnum should be, wait for the last * possible moment to push this buffer, maybe we get an earlier seqnum @@ -2981,8 +2982,10 @@ gst_rtp_jitter_buffer_chain (GstPad * pad, GstObject * parent, g_queue_clear (&priv->gap_packets); /* calculate a pts based on rtptime and arrival time (dts) */ - pts = rtp_jitter_buffer_calculate_pts (priv->jbuf, dts, rtptime, - gst_element_get_base_time (GST_ELEMENT_CAST (jitterbuffer))); + /* If we estimated the DTS, don't consider it in the clock skew calculations */ + pts = + rtp_jitter_buffer_calculate_pts (priv->jbuf, dts, estimated_dts, + rtptime, gst_element_get_base_time (GST_ELEMENT_CAST (jitterbuffer))); if (G_LIKELY (gap == 0)) { /* packet is expected */ diff --git a/gst/rtpmanager/rtpjitterbuffer.c b/gst/rtpmanager/rtpjitterbuffer.c index 03b7ebc1e..a706d6283 100644 --- a/gst/rtpmanager/rtpjitterbuffer.c +++ b/gst/rtpmanager/rtpjitterbuffer.c @@ -690,7 +690,7 @@ queue_do_insert (RTPJitterBuffer * jbuf, GList * list, GList * item) GstClockTime rtp_jitter_buffer_calculate_pts (RTPJitterBuffer * jbuf, GstClockTime dts, - guint32 rtptime, GstClockTime base_time) + gboolean estimated_dts, guint32 rtptime, GstClockTime base_time) { guint64 ext_rtptime; GstClockTime gstrtptime, pts; @@ -703,7 +703,7 @@ rtp_jitter_buffer_calculate_pts (RTPJitterBuffer * jbuf, GstClockTime dts, * Only reset if valid input time, which is likely for UDP input * where we expect this might happen due to async thread effects * (in seek and state change cycles), but not so much for TCP input */ - if (GST_CLOCK_TIME_IS_VALID (dts) && + if (GST_CLOCK_TIME_IS_VALID (dts) && !estimated_dts && jbuf->mode != RTP_JITTER_BUFFER_MODE_SLAVE && jbuf->base_time != -1 && jbuf->last_rtptime != -1) { GstClockTime ext_rtptime = jbuf->ext_rtptime; diff --git a/gst/rtpmanager/rtpjitterbuffer.h b/gst/rtpmanager/rtpjitterbuffer.h index d04b5fd96..4d3c6fe16 100644 --- a/gst/rtpmanager/rtpjitterbuffer.h +++ b/gst/rtpmanager/rtpjitterbuffer.h @@ -189,7 +189,7 @@ void rtp_jitter_buffer_get_sync (RTPJitterBuffer *jbuf, guint64 *timestamp, guint32 *clock_rate, guint64 *last_rtptime); -GstClockTime rtp_jitter_buffer_calculate_pts (RTPJitterBuffer * jbuf, GstClockTime dts, +GstClockTime rtp_jitter_buffer_calculate_pts (RTPJitterBuffer * jbuf, GstClockTime dts, gboolean estimated_dts, guint32 rtptime, GstClockTime base_time); #endif /* __RTP_JITTER_BUFFER_H__ */ |