mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-18 13:25:56 +00:00
baseparse: avoid loop in frame locating interpolation
This commit is contained in:
parent
eafcdf67b9
commit
ce23c62f58
1 changed files with 4 additions and 3 deletions
|
@ -3032,6 +3032,7 @@ gst_base_parse_locate_time (GstBaseParse * parse, GstClockTime * _time,
|
||||||
gst_util_uint64_scale (hpos - lpos, time - ltime, htime - ltime) +
|
gst_util_uint64_scale (hpos - lpos, time - ltime, htime - ltime) +
|
||||||
lpos - chunk;
|
lpos - chunk;
|
||||||
} else {
|
} else {
|
||||||
|
/* should mean lpos == hpos, since lpos <= hpos is invariant */
|
||||||
newpos = lpos;
|
newpos = lpos;
|
||||||
/* we check this case once, but not forever, so break loop */
|
/* we check this case once, but not forever, so break loop */
|
||||||
cont = FALSE;
|
cont = FALSE;
|
||||||
|
@ -3065,8 +3066,7 @@ gst_base_parse_locate_time (GstBaseParse * parse, GstClockTime * _time,
|
||||||
break;
|
break;
|
||||||
} else if (newtime > time) {
|
} else if (newtime > time) {
|
||||||
/* overshoot */
|
/* overshoot */
|
||||||
newpos -= newpos == hpos ? chunk : 0;
|
hpos = (newpos >= hpos) ? MAX (lpos, hpos - chunk) : MAX (lpos, newpos);
|
||||||
hpos = CLAMP (newpos, lpos, hpos);
|
|
||||||
htime = newtime;
|
htime = newtime;
|
||||||
} else if (newtime + tolerance > time) {
|
} else if (newtime + tolerance > time) {
|
||||||
/* close enough undershoot */
|
/* close enough undershoot */
|
||||||
|
@ -3076,9 +3076,10 @@ gst_base_parse_locate_time (GstBaseParse * parse, GstClockTime * _time,
|
||||||
} else if (newtime < ltime) {
|
} else if (newtime < ltime) {
|
||||||
/* so a position beyond lpos resulted in earlier time than ltime ... */
|
/* so a position beyond lpos resulted in earlier time than ltime ... */
|
||||||
GST_DEBUG_OBJECT (parse, "non-ascending time; aborting");
|
GST_DEBUG_OBJECT (parse, "non-ascending time; aborting");
|
||||||
|
break;
|
||||||
} else {
|
} else {
|
||||||
/* undershoot too far */
|
/* undershoot too far */
|
||||||
newpos += newpos == hpos ? chunk : 0;
|
newpos += newpos == lpos ? chunk : 0;
|
||||||
lpos = CLAMP (newpos, lpos, hpos);
|
lpos = CLAMP (newpos, lpos, hpos);
|
||||||
ltime = newtime;
|
ltime = newtime;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue