mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 07:47:17 +00:00
gstsegment: Actually start==stop==segment_start is inside the segment
Still the old code was wrong as it claimed that start==stop<segment_start would be inside the segment and returned insane clipping differences.
This commit is contained in:
parent
868538945b
commit
276a55fd24
2 changed files with 13 additions and 4 deletions
|
@ -737,8 +737,11 @@ gst_segment_clip (GstSegment * segment, GstFormat format, gint64 start,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* if a stop position is given and is before the segment start,
|
/* if a stop position is given and is before the segment start,
|
||||||
* we're outside of the segment */
|
* we're outside of the segment. Special case is were start
|
||||||
if (G_UNLIKELY (stop != -1 && stop <= segment->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;
|
return FALSE;
|
||||||
|
|
||||||
if (clip_start) {
|
if (clip_start) {
|
||||||
|
|
|
@ -73,10 +73,16 @@ GST_START_TEST (segment_seek_nosize)
|
||||||
fail_unless (cstart == 100);
|
fail_unless (cstart == 100);
|
||||||
fail_unless (cstop == 150);
|
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,
|
res = gst_segment_clip (&segment, GST_FORMAT_BYTES,
|
||||||
100, 100, &cstart, &cstop);
|
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 */
|
/* special case, 0 duration and inside the segment */
|
||||||
res = gst_segment_clip (&segment, GST_FORMAT_BYTES,
|
res = gst_segment_clip (&segment, GST_FORMAT_BYTES,
|
||||||
|
|
Loading…
Reference in a new issue