gst_util_uint64_scale (hpos - lpos, time - ltime, htime - ltime) +
lpos - chunk;
} else {
+ /* should mean lpos == hpos, since lpos <= hpos is invariant */
newpos = lpos;
/* we check this case once, but not forever, so break loop */
cont = FALSE;
break;
} else if (newtime > time) {
/* overshoot */
- newpos -= newpos == hpos ? chunk : 0;
- hpos = CLAMP (newpos, lpos, hpos);
+ hpos = (newpos >= hpos) ? MAX (lpos, hpos - chunk) : MAX (lpos, newpos);
htime = newtime;
} else if (newtime + tolerance > time) {
/* close enough undershoot */
} else if (newtime < ltime) {
/* so a position beyond lpos resulted in earlier time than ltime ... */
GST_DEBUG_OBJECT (parse, "non-ascending time; aborting");
+ break;
} else {
/* undershoot too far */
- newpos += newpos == hpos ? chunk : 0;
+ newpos += newpos == lpos ? chunk : 0;
lpos = CLAMP (newpos, lpos, hpos);
ltime = newtime;
}