diff --git a/gst/gstsegment.c b/gst/gstsegment.c index c1527c0f00..5b10a913d8 100644 --- a/gst/gstsegment.c +++ b/gst/gstsegment.c @@ -555,12 +555,12 @@ gst_segment_to_stream_time (GstSegment * segment, GstFormat format, gint64 result, start, stop, time; gdouble abs_applied_rate; - g_return_val_if_fail (segment != NULL, -1); - /* format does not matter for -1 */ if (G_UNLIKELY (position == -1)) return -1; + g_return_val_if_fail (segment != NULL, -1); + if (G_UNLIKELY (segment->format == GST_FORMAT_UNDEFINED)) segment->format = format; @@ -641,11 +641,11 @@ gst_segment_to_running_time (GstSegment * segment, GstFormat format, gint64 result; gint64 start, stop, accum; - g_return_val_if_fail (segment != NULL, -1); - if (G_UNLIKELY (position == -1)) return -1; + g_return_val_if_fail (segment != NULL, -1); + if (G_UNLIKELY (segment->format == GST_FORMAT_UNDEFINED)) segment->format = format;