libs/gst/base/gstbasesink.c: Don't try to preroll non-async elements after a flush.

Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_event),
(gst_base_sink_get_position):
Don't try to preroll non-async elements after a flush.
Subtract latency form clock times when reporting position.
This commit is contained in:
Wim Taymans 2007-10-08 10:21:15 +00:00
parent 731f14c4b9
commit 71f92e2b3e
2 changed files with 12 additions and 1 deletions

View file

@ -1,3 +1,10 @@
2007-10-08 Wim Taymans <wim.taymans@gmail.com>
* libs/gst/base/gstbasesink.c: (gst_base_sink_event),
(gst_base_sink_get_position):
Don't try to preroll non-async elements after a flush.
Subtract latency form clock times when reporting position.
2007-10-05 Wim Taymans <wim.taymans@gmail.com>
* gst/gstpad.c: (gst_pad_pause_task):

View file

@ -2216,6 +2216,7 @@ gst_base_sink_event (GstPad * pad, GstEvent * event)
gst_element_lost_state (GST_ELEMENT_CAST (basesink));
} else {
basesink->priv->have_latency = TRUE;
basesink->need_preroll = FALSE;
}
GST_PAD_STREAM_UNLOCK (pad);
@ -2809,7 +2810,7 @@ gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
/* we can answer time format */
case GST_FORMAT_TIME:
{
GstClockTime now, base;
GstClockTime now, base, latency;
gint64 time, accum, duration;
gdouble rate;
gint64 last;
@ -2854,6 +2855,7 @@ gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
accum = basesink->segment.accum;
rate = basesink->segment.rate * basesink->segment.applied_rate;
gst_base_sink_get_position_last (basesink, &last);
latency = basesink->priv->latency;
gst_object_ref (clock);
/* need to release the object lock before we can get the time,
@ -2862,11 +2864,13 @@ gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
GST_OBJECT_UNLOCK (basesink);
now = gst_clock_get_time (clock);
/* subtract base time and accumulated time from the clock time.
* Make sure we don't go negative. This is the current time in
* the segment which we need to scale with the combined
* rate and applied rate. */
base += accum;
base += latency;
base = MIN (now, base);
/* for negative rates we need to count back from from the segment