summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-04-21 22:36:46 +0200
committerwm4 <wm4@nowhere>2015-04-21 22:39:06 +0200
commitbcf3904a0de2856b73a13d6e45de28afd15e6b6b (patch)
treecd1b409be97eaef129cacfffb8a1e7ec06aa09ec
parent1299fbec05f80ab38b2335af1a6eea472eec62a8 (diff)
downloadmpv-bcf3904a0de2856b73a13d6e45de28afd15e6b6b.tar.bz2
mpv-bcf3904a0de2856b73a13d6e45de28afd15e6b6b.tar.xz
cache: exit early on cancellation
An approximate measure to make it exit possibly slightly earlier. Relatively speaking, some time will pass between cancellation and the cache actually being requested to exit, so it's good if the cache returns EOF immediately.
-rw-r--r--stream/cache.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/stream/cache.c b/stream/cache.c
index b7ed76c8fa..0ffa3927be 100644
--- a/stream/cache.c
+++ b/stream/cache.c
@@ -208,6 +208,9 @@ static bool cache_fill(struct priv *s)
goto done;
}
+ if (mp_cancel_test(s->cache->cancel))
+ goto done;
+
// number of buffer bytes which should be preserved in backwards direction
int64_t back = MPCLAMP(read - s->min_filepos, 0, s->back_size);