return FALSE;
/* if a stop position is given and is before the segment start,
- * we're outside of the segment */
- if (G_UNLIKELY (stop != -1 && stop <= segment->start))
+ * 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) {
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,