GstClockTime last_out_time;
GstClockTime last_out_dts;
GstClockTime last_out_pts;
+ /* last valid input timestamp and rtptime pair */
+ GstClockTime last_in_dts;
+ GstClockTime last_in_rtptime;
+ GstClockTime packet_spacing;
/* the next expected seqnum we receive */
guint32 next_in_seqnum;
priv->last_out_dts = -1;
priv->last_out_pts = -1;
priv->next_seqnum = -1;
+ priv->last_in_rtptime = -1;
+ priv->last_in_dts = GST_CLOCK_TIME_NONE;
+ priv->packet_spacing = 0;
priv->next_in_seqnum = -1;
priv->clock_rate = -1;
priv->eos = FALSE;
GstRtpJitterBuffer *jitterbuffer;
GstRtpJitterBufferPrivate *priv;
guint16 seqnum;
+ guint32 rtptime;
GstFlowReturn ret = GST_FLOW_OK;
GstClockTime dts, pts;
guint64 latency_ts;
pt = gst_rtp_buffer_get_payload_type (&rtp);
seqnum = gst_rtp_buffer_get_seq (&rtp);
+ rtptime = gst_rtp_buffer_get_timestamp (&rtp);
gst_rtp_buffer_unmap (&rtp);
/* make sure we have PTS and DTS set */
priv->last_popped_seqnum = -1;
priv->next_seqnum = seqnum;
}
+ /* reset spacing estimation when gap */
+ priv->last_in_rtptime = -1;
+ priv->last_in_dts = -1;
+ } else {
+ /* packet is expected, we need consecutive seqnums with a different
+ * rtptime to estimate the packet spacing. */
+ if (priv->last_in_rtptime != rtptime) {
+ /* rtptime changed, check dts diff */
+ if (priv->last_in_dts != -1 && dts != -1 && dts > priv->last_in_dts) {
+ priv->packet_spacing = dts - priv->last_in_dts;
+ GST_DEBUG_OBJECT (jitterbuffer,
+ "new packet spacing %" GST_TIME_FORMAT,
+ GST_TIME_ARGS (priv->packet_spacing));
+ }
+ priv->last_in_rtptime = rtptime;
+ priv->last_in_dts = dts;
+ }
}
}
priv->next_in_seqnum = (seqnum + 1) & 0xffff;