|author||wm4 <wm4@nowhere>||2017-01-24 08:43:22 +0100|
|committer||wm4 <wm4@nowhere>||2017-01-24 08:46:17 +0100|
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.
1 files changed, 2 insertions, 0 deletions
diff --git a/stream/stream.c b/stream/stream.c
index d2c2917d56..b4e4bd9c70 100644
@@ -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)