diff options
author | wm4 <wm4@nowhere> | 2017-01-24 08:43:22 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-01-24 08:46:17 +0100 |
commit | 7be495b369fa9924d0595a2ef0d2a0d1f662ba76 (patch) | |
tree | 5a048117da57217cef0f180cee3d6a90c43af13e /stream | |
parent | f762fc42308590c609a42d23c1f2d75091acdcee (diff) | |
download | mpv-7be495b369fa9924d0595a2ef0d2a0d1f662ba76.tar.bz2 mpv-7be495b369fa9924d0595a2ef0d2a0d1f662ba76.tar.xz |
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.
Diffstat (limited to 'stream')
-rw-r--r-- | stream/stream.c | 2 |
1 files changed, 2 insertions, 0 deletions
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) |