+2005-10-25 Wim Taymans <wim@fluendo.com>
+
+ * gst/base/gstbasesink.c: (gst_base_sink_get_position):
+ Don't use invalid stream_time.
+
+ * gst/gstevent.c: (gst_event_new_newsegment):
+ stream_time in newsegment cannot be undefined.
+
2005-10-24 Wim Taymans <wim@fluendo.com>
* gst/gstbus.c:
GST_LOCK (basesink);
if ((clock = GST_ELEMENT_CLOCK (basesink))) {
GstClockTime now;
+ gint64 segment_time;
gst_object_ref (clock);
GST_UNLOCK (basesink);
now = gst_clock_get_time (clock);
GST_LOCK (basesink);
- *cur =
- now - GST_ELEMENT_CAST (basesink)->base_time +
- basesink->segment_time;
+ if (GST_CLOCK_TIME_IS_VALID (basesink->segment_time))
+ segment_time = basesink->segment_time;
+ else
+ segment_time = 0;
+
+ *cur = now - GST_ELEMENT_CAST (basesink)->base_time + segment_time;
GST_DEBUG_OBJECT (basesink,
"now %" GST_TIME_FORMAT " + segment_time %" GST_TIME_FORMAT " = %"
GST_TIME_FORMAT, GST_TIME_ARGS (now),
- GST_TIME_ARGS (basesink->segment_time), GST_TIME_ARGS (*cur));
+ GST_TIME_ARGS (segment_time), GST_TIME_ARGS (*cur));
gst_object_unref (clock);
* used intelligently by plugins to use more efficient methods of skipping
* unneeded packets.
*
- * The stream time of the segment is also used to convert the buffer timestamps
- * into the stream time again.
+ * The stream time of the segment is used to convert the buffer timestamps
+ * into the stream time again, this is usually done in sinks to report the
+ * current stream_time. @stream_time cannot be -1.
*
* The @start_value cannot be -1, the @stop_value can be -1. If there
* is a valid @stop_value given, it must be greater or equal than @start_value.
"start %lld, stop %lld, stream_time %lld",
update, rate, format, start_value, stop_value, stream_time);
}
+ if (stream_time == -1)
+ g_return_val_if_fail (stream_time != -1, NULL);
+
if (start_value == -1)
g_return_val_if_fail (start_value != -1, NULL);
GST_LOCK (basesink);
if ((clock = GST_ELEMENT_CLOCK (basesink))) {
GstClockTime now;
+ gint64 segment_time;
gst_object_ref (clock);
GST_UNLOCK (basesink);
now = gst_clock_get_time (clock);
GST_LOCK (basesink);
- *cur =
- now - GST_ELEMENT_CAST (basesink)->base_time +
- basesink->segment_time;
+ if (GST_CLOCK_TIME_IS_VALID (basesink->segment_time))
+ segment_time = basesink->segment_time;
+ else
+ segment_time = 0;
+
+ *cur = now - GST_ELEMENT_CAST (basesink)->base_time + segment_time;
GST_DEBUG_OBJECT (basesink,
"now %" GST_TIME_FORMAT " + segment_time %" GST_TIME_FORMAT " = %"
GST_TIME_FORMAT, GST_TIME_ARGS (now),
- GST_TIME_ARGS (basesink->segment_time), GST_TIME_ARGS (*cur));
+ GST_TIME_ARGS (segment_time), GST_TIME_ARGS (*cur));
gst_object_unref (clock);