jitterbuffer: reset element base_time upon flush

... to arrange for properly scheduled timeout (following seek).
This commit is contained in:
Mark Nauwelaerts 2011-03-07 11:01:06 +01:00
parent 1a8aa16612
commit f84b8a69cb

View file

@ -881,6 +881,8 @@ static void
gst_rtp_jitter_buffer_flush_stop (GstRtpJitterBuffer * jitterbuffer)
{
GstRtpJitterBufferPrivate *priv;
GstClock *clock;
GstClockTime ts;
priv = jitterbuffer->priv;
@ -902,6 +904,18 @@ gst_rtp_jitter_buffer_flush_stop (GstRtpJitterBuffer * jitterbuffer)
GST_DEBUG_OBJECT (jitterbuffer, "flush and reset jitterbuffer");
rtp_jitter_buffer_flush (priv->jbuf);
rtp_jitter_buffer_reset_skew (priv->jbuf);
/* sync_time for scheduling timeouts needs proper element base_time
* However, following a seek new base_time only trickles down upon PLAYING
* upon which time quite some processing has already passed
* (which also needs correct base time) */
clock = gst_element_get_clock (GST_ELEMENT_CAST (jitterbuffer));
if (clock) {
ts = gst_clock_get_time (clock);
GST_DEBUG_OBJECT (jitterbuffer, "new base time %" GST_TIME_FORMAT,
GST_TIME_ARGS (ts));
gst_object_unref (clock);
gst_element_set_base_time (GST_ELEMENT_CAST (jitterbuffer), ts);
}
JBUF_UNLOCK (priv);
}