mirror of
https://github.com/mpv-player/mpv
synced 2024-12-25 16:33:02 +00:00
stream: check for interruption when trying to reconnect stream
This happens with something like "mpv https://www.youtube.com/watch". The URL is obviously not valid, but the stream layer tries to reconnect. This commit at least allows to use the terminal to abort gracefully. (Other than killing the process.)
This commit is contained in:
parent
6832bf3060
commit
7fefad7a8f
@ -298,10 +298,10 @@ static int stream_reconnect(stream_t *s)
|
||||
int64_t pos = s->pos;
|
||||
for (int retry = 0; retry < MAX_RECONNECT_RETRIES; retry++) {
|
||||
mp_msg(MSGT_STREAM, MSGL_WARN,
|
||||
"Connection lost! Attempting to reconnect...\n");
|
||||
"Connection lost! Attempting to reconnect (%d)...\n", retry + 1);
|
||||
|
||||
if (retry)
|
||||
mp_sleep_us(RECONNECT_SLEEP_MS * 1000);
|
||||
if (stream_check_interrupt(retry ? RECONNECT_SLEEP_MS : 0))
|
||||
return 0;
|
||||
|
||||
s->eof = 1;
|
||||
stream_reset(s);
|
||||
|
Loading…
Reference in New Issue
Block a user