aboutsummaryrefslogtreecommitdiff
path: root/libs/gst/base/gstbasesink.c
diff options
context:
space:
mode:
Diffstat (limited to 'libs/gst/base/gstbasesink.c')
-rw-r--r--libs/gst/base/gstbasesink.c49
1 files changed, 25 insertions, 24 deletions
diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c
index 18f1d83..390a677 100644
--- a/libs/gst/base/gstbasesink.c
+++ b/libs/gst/base/gstbasesink.c
@@ -4247,14 +4247,36 @@ gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
rate = segment->rate * segment->applied_rate;
latency = basesink->priv->latency;
+ if (in_paused) {
+ /* in paused, use start_time */
+ base_time = GST_ELEMENT_START_TIME (basesink);
+ GST_DEBUG_OBJECT (basesink, "in paused, using start time %" GST_TIME_FORMAT,
+ GST_TIME_ARGS (base_time));
+ } else if (with_clock) {
+ /* else use clock when needed */
+ base_time = GST_ELEMENT_CAST (basesink)->base_time;
+ GST_DEBUG_OBJECT (basesink, "using clock and base time %" GST_TIME_FORMAT,
+ GST_TIME_ARGS (base_time));
+ } else {
+ /* else, no sync or clock -> no base time */
+ GST_DEBUG_OBJECT (basesink, "no sync or no clock");
+ base_time = -1;
+ }
+
+ /* no base_time, we can't calculate running_time, use last seem timestamp to report
+ * time */
+ if (base_time == -1)
+ last_seen = TRUE;
+
if (oformat == GST_FORMAT_TIME) {
gint64 start, stop;
start = basesink->priv->current_sstart;
stop = basesink->priv->current_sstop;
- if (in_paused) {
- /* in paused we use the last position as a lower bound */
+ if (in_paused || last_seen) {
+ /* in paused or when we don't use the clock, we use the last position
+ * as a lower bound */
if (stop == -1 || segment->rate > 0.0)
last = start;
else
@@ -4273,33 +4295,12 @@ gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
GST_TIME_ARGS (last));
}
} else {
- /* convert last stop to stream time */
+ /* convert position to stream time */
last = gst_segment_to_stream_time (segment, oformat, segment->position);
GST_DEBUG_OBJECT (basesink, "in using last %" G_GINT64_FORMAT, last);
}
- if (in_paused) {
- /* in paused, use start_time */
- base_time = GST_ELEMENT_START_TIME (basesink);
- GST_DEBUG_OBJECT (basesink, "in paused, using start time %" GST_TIME_FORMAT,
- GST_TIME_ARGS (base_time));
- } else if (with_clock) {
- /* else use clock when needed */
- base_time = GST_ELEMENT_CAST (basesink)->base_time;
- GST_DEBUG_OBJECT (basesink, "using clock and base time %" GST_TIME_FORMAT,
- GST_TIME_ARGS (base_time));
- } else {
- /* else, no sync or clock -> no base time */
- GST_DEBUG_OBJECT (basesink, "no sync or no clock");
- base_time = -1;
- }
-
- /* no base_time, we can't calculate running_time, use last seem timestamp to report
- * time */
- if (base_time == -1)
- last_seen = TRUE;
-
/* need to release the object lock before we can get the time,
* a clock might take the LOCK of the provider, which could be
* a basesink subclass. */