diff --git a/gst/rtpmanager/gstrtpjitterbuffer.c b/gst/rtpmanager/gstrtpjitterbuffer.c index 2ca9fe742f..64f05dc41f 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 11a5d723df..a706d6283a 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 d04b5fd96d..4d3c6fe16e 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__ */