summaryrefslogtreecommitdiff
path: root/gst/gstsegment.c
diff options
context:
space:
mode:
authorStefan Sauer <ensonic@users.sf.net>2013-02-27 22:15:48 +0100
committerStefan Sauer <ensonic@users.sf.net>2013-02-27 22:17:17 +0100
commit82f7bdd7bbaf9d8e94f55186959b07d46a1e03e0 (patch)
tree1a97ea8323cde5b1fafe42e63153e4082d057995 /gst/gstsegment.c
parentce1c1cf214bd0433a5913e670b1a140dc27f2097 (diff)
seeking: add more logging for seeking
Especially add logging to error code paths.
Diffstat (limited to 'gst/gstsegment.c')
-rw-r--r--gst/gstsegment.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/gst/gstsegment.c b/gst/gstsegment.c
index 9d4fee4d58..9890be563e 100644
--- a/gst/gstsegment.c
+++ b/gst/gstsegment.c
@@ -301,6 +301,8 @@ gst_segment_do_seek (GstSegment * segment, gdouble rate,
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;
}
}
@@ -311,6 +313,7 @@ gst_segment_do_seek (GstSegment * segment, gdouble rate,
} 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) {
@@ -361,6 +364,8 @@ gst_segment_do_seek (GstSegment * segment, gdouble rate,
segment->time = start;
segment->position = position;
+ GST_INFO ("segment updated: %" GST_SEGMENT_FORMAT, segment);
+
return TRUE;
}
@@ -469,8 +474,10 @@ gst_segment_to_running_time (const GstSegment * segment, GstFormat format,
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);
@@ -481,27 +488,38 @@ gst_segment_to_running_time (const GstSegment * segment, GstFormat format,
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;