mirror of https://github.com/mpv-player/mpv
player: hack against --keep-open misbehaving with broken files
If a file (or a demuxer) is broken, seeking close to the end of the file
doesn't work, and seek_to_last_frame() will be called over and over
again, burning CPU for no reason.
Observed with incomplete mp4 files. That this can happen was already
mentioned in commit 090f6cfc
, but I guess now I'll do something against
it.
hrseek_lastframe is cleared by reset_playback_state(), so it's only set
if seek_to_last_frame() was called, and no other seek happened since
then. If finding the last frame succeeds, no EOF will happen (unless the
user unpauses, but then it will simply remain at the last frame). If it
fails, then it will return immediately, without retrying.
This commit is contained in:
parent
7593a1f638
commit
fdb379109f
|
@ -783,6 +783,8 @@ void seek_to_last_frame(struct MPContext *mpctx)
|
||||||
{
|
{
|
||||||
if (!mpctx->d_video)
|
if (!mpctx->d_video)
|
||||||
return;
|
return;
|
||||||
|
if (mpctx->hrseek_lastframe) // exit if we already tried this
|
||||||
|
return;
|
||||||
MP_VERBOSE(mpctx, "seeking to last frame...\n");
|
MP_VERBOSE(mpctx, "seeking to last frame...\n");
|
||||||
// Approximately seek close to the end of the file.
|
// Approximately seek close to the end of the file.
|
||||||
// Usually, it will seek some seconds before end.
|
// Usually, it will seek some seconds before end.
|
||||||
|
|
Loading…
Reference in New Issue