From 7be495b369fa9924d0595a2ef0d2a0d1f662ba76 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 24 Jan 2017 08:43:22 +0100 Subject: stream: check for playback aborts on reading too Benefits demux_mkv.c, or demux_lavf.c during probing. In particular demux_lavf.c can sometimes get "stuck" when reading from a slow/blocking source, and if probing needs more than a few iterations. Since this is a read of an atomic variable with relaxed semantics, this should have no impact on reading speed at all, not even theoretically. --- stream/stream.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stream/stream.c b/stream/stream.c index d2c2917d56..b4e4bd9c70 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -361,6 +361,8 @@ static int stream_read_unbuffered(stream_t *s, void *buf, int len) { int orig_len = len; s->buf_pos = s->buf_len = 0; + if (mp_cancel_test(s->cancel)) + return 0; // we will retry even if we already reached EOF previously. len = s->fill_buffer ? s->fill_buffer(s, buf, len) : -1; if (len < 0) -- cgit v1.2.3