From 276a55fd24e2b8f8487616d8e2e981ce8f806312 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 11 Aug 2009 13:21:35 +0200 Subject: [PATCH] gstsegment: Actually start==stop==segment_start is inside the segment Still the old code was wrong as it claimed that start==stopstart)) + * we're outside of the segment. Special case is were start + * and stop are equal to the segment start. In that case we + * are inside the segment. */ + if (G_UNLIKELY (stop != -1 && (stop < segment->start || (start != stop + && stop == segment->start)))) return FALSE; if (clip_start) { diff --git a/tests/check/gst/gstsegment.c b/tests/check/gst/gstsegment.c index ec37065..2c7b42b 100644 --- a/tests/check/gst/gstsegment.c +++ b/tests/check/gst/gstsegment.c @@ -73,10 +73,16 @@ GST_START_TEST (segment_seek_nosize) fail_unless (cstart == 100); fail_unless (cstop == 150); - /* special case, 0 duration and touching lower bound */ + /* special case, 0 duration and outside segment */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 90, 90, &cstart, &cstop); + fail_unless (res == FALSE); + + /* special case, 0 duration and touching lower bound, i.e. inside segment */ res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 100, 100, &cstart, &cstop); - fail_unless (res == FALSE); + fail_unless (res == TRUE); + fail_unless (cstart == 100); + fail_unless (cstop == 100); /* special case, 0 duration and inside the segment */ res = gst_segment_clip (&segment, GST_FORMAT_BYTES, -- 2.7.4