1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-26 09:02:38 +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:
wm4 2013-06-06 20:39:55 +02:00
parent 6832bf3060
commit 7fefad7a8f

View File

@ -298,10 +298,10 @@ static int stream_reconnect(stream_t *s)
int64_t pos = s->pos; int64_t pos = s->pos;
for (int retry = 0; retry < MAX_RECONNECT_RETRIES; retry++) { for (int retry = 0; retry < MAX_RECONNECT_RETRIES; retry++) {
mp_msg(MSGT_STREAM, MSGL_WARN, mp_msg(MSGT_STREAM, MSGL_WARN,
"Connection lost! Attempting to reconnect...\n"); "Connection lost! Attempting to reconnect (%d)...\n", retry + 1);
if (retry) if (stream_check_interrupt(retry ? RECONNECT_SLEEP_MS : 0))
mp_sleep_us(RECONNECT_SLEEP_MS * 1000); return 0;
s->eof = 1; s->eof = 1;
stream_reset(s); stream_reset(s);