player: temporize on EOS bursts
A mechanism was implemented to temporize on consecutive input errors, to mitigate infinite busy loops (see commit d0662265 from VLC3).
Although it avoided the most common issues, this mechanism was not triggered for other problematic cases:
- empty inputs;
- inputs with unreported errors from demuxers.
For example, as reported by #26733 (closed), this produces a busy loop:
echo 'this is not a mp3 file' > garbage.mp3
vlc --loop garbage.mp3
Therefore, to encompass these other cases, consider the number of consecutive stops in a small period of time instead of relying on reported errors:
- if a
VLC_PLAYER_STATE_STOPPED
occurs less than100ms250ms after the previous one, then increment the EOS burst count; - when more than 4 EOS burst count occur successively, start temporizing:
- 100ms for the 5th
- 200ms for the 6th
- 400ms for the 7th
- 800ms for the 8th
- 1.6s for the 9th
- 3.2s for the following
- Fixes #5901 (closed)
- Fixes #26733 (closed)
If this is accepted, I'll implement the same mechanism on VLC3.
Edited by Romain Vimont