Commit b2046045 authored by Wim Taymans's avatar Wim Taymans

gst/base/gstbasesink.c: Don't use invalid stream_time.

Original commit message from CVS:
* 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.
parent 4a0802eb
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:
......
......@@ -1406,6 +1406,7 @@ gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
GST_LOCK (basesink);
if ((clock = GST_ELEMENT_CLOCK (basesink))) {
GstClockTime now;
gint64 segment_time;
gst_object_ref (clock);
GST_UNLOCK (basesink);
......@@ -1413,14 +1414,17 @@ gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
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);
......
......@@ -398,8 +398,9 @@ gst_event_new_eos (void)
* 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.
......@@ -429,6 +430,9 @@ gst_event_new_newsegment (gboolean update, gdouble rate, GstFormat format,
"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);
......
......@@ -1406,6 +1406,7 @@ gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
GST_LOCK (basesink);
if ((clock = GST_ELEMENT_CLOCK (basesink))) {
GstClockTime now;
gint64 segment_time;
gst_object_ref (clock);
GST_UNLOCK (basesink);
......@@ -1413,14 +1414,17 @@ gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment