if (stop != -1) {
if (start > stop) {
g_return_val_if_fail (start <= stop, FALSE);
+ GST_WARNING ("segment update failed: start(%" G_GUINT64_FORMAT
+ ") > stop(%" G_GUINT64_FORMAT ")", start, stop);
return FALSE;
}
}
} else {
/* remember the elapsed time */
base = gst_segment_to_running_time (segment, format, position);
+ GST_DEBUG ("updated segment.base: %" G_GUINT64_FORMAT, base);
}
if (update_start && rate > 0.0) {
segment->time = start;
segment->position = position;
+ GST_INFO ("segment updated: %" GST_SEGMENT_FORMAT, segment);
+
return TRUE;
}
guint64 start, stop;
gdouble abs_rate;
- if (G_UNLIKELY (position == -1))
+ if (G_UNLIKELY (position == -1)) {
+ GST_WARNING ("invalid position (-1)");
return -1;
+ }
g_return_val_if_fail (segment != NULL, -1);
g_return_val_if_fail (segment->format == format, -1);
start += segment->offset;
/* before the segment boundary */
- if (G_UNLIKELY (position < start))
+ if (G_UNLIKELY (position < start)) {
+ GST_WARNING ("position(%" G_GUINT64_FORMAT ") < start(%" G_GUINT64_FORMAT
+ ")", position, start);
return -1;
+ }
stop = segment->stop;
if (G_LIKELY (segment->rate > 0.0)) {
- /* outside of the segment boundary stop */
- if (G_UNLIKELY (stop != -1 && position > stop))
+ /* after of the segment boundary */
+ if (G_UNLIKELY (stop != -1 && position > stop)) {
+ GST_WARNING ("position(%" G_GUINT64_FORMAT ") > stop(%" G_GUINT64_FORMAT
+ ")", position, stop);
return -1;
+ }
/* bring to uncorrected position in segment */
result = position - start;
} else {
/* cannot continue if no stop position set or outside of
* the segment. */
- if (G_UNLIKELY (stop == -1))
+ if (G_UNLIKELY (stop == -1)) {
+ GST_WARNING ("invalid stop (-1)");
return -1;
+ }
stop -= segment->offset;
- if (G_UNLIKELY (position > stop))
+ if (G_UNLIKELY (position > stop)) {
+ GST_WARNING ("position(%" G_GUINT64_FORMAT ") > stop(%" G_GUINT64_FORMAT
+ ")", position, stop);
return -1;
+ }
/* bring to uncorrected position in segment */
result = stop - position;
/* FIXME: Casting to GstClockEntry only works because the types
* are the same */
if (G_LIKELY (sink->priv->cached_clock_id != NULL
- && GST_CLOCK_ENTRY_CLOCK ((GstClockEntry *) sink->
- priv->cached_clock_id) == clock)) {
+ && GST_CLOCK_ENTRY_CLOCK ((GstClockEntry *) sink->priv->
+ cached_clock_id) == clock)) {
if (!gst_clock_single_shot_id_reinit (clock, sink->priv->cached_clock_id,
time)) {
gst_clock_id_unref (sink->priv->cached_clock_id);
/* the newsegment event is needed to bring the buffer timestamps to the
* stream time and to drop samples outside of the playback segment. */
gst_event_copy_segment (event, &basesink->segment);
- GST_DEBUG_OBJECT (basesink, "configured SEGMENT %" GST_SEGMENT_FORMAT,
+ GST_DEBUG_OBJECT (basesink, "configured segment %" GST_SEGMENT_FORMAT,
&basesink->segment);
basesink->have_newsegment = TRUE;
GST_OBJECT_UNLOCK (basesink);
res = gst_base_sink_default_do_seek (sink, &seeksegment);
}
-
if (flush) {
GST_DEBUG_OBJECT (sink, "stop flushing upstream");
gst_pad_push_event (pad, gst_event_new_flush_stop (TRUE));
res = FALSE;
}
+ GST_INFO_OBJECT (sink, "seeking done %d: %" GST_SEGMENT_FORMAT, res,
+ &seeksegment);
+
/* if successful seek, we update our real segment and push
* out the new segment. */
if (res) {