basesink: clamp reported position based on direction

When using a negative rate (rate being segment.rate * segment.applied_rate),
we will end up reporting decreasing positions, therefore adjust the clamping
against last reported value accordingly.

Fixes positions getting properly reported with applied_rate < 0.0

https://bugzilla.gnome.org/show_bug.cgi?id=738092
This commit is contained in:
Edward Hervey 2014-10-07 16:44:45 +02:00
parent 154eefecc9
commit 05092eda8e

View file

@ -4581,8 +4581,12 @@ gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
*cur = time + gst_guint64_to_gdouble (now - base_time) * rate;
/* never report more than last seen position */
if (last != -1)
*cur = MIN (last, *cur);
if (last != -1) {
if (rate > 0.0)
*cur = MIN (last, *cur);
else
*cur = MAX (last, *cur);
}
GST_DEBUG_OBJECT (basesink,
"now %" GST_TIME_FORMAT " - base_time %" GST_TIME_FORMAT " - base %"