aboutsummaryrefslogtreecommitdiffhomepage
path: root/stream
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2016-10-01 18:19:57 +0200
committerGravatar wm4 <wm4@nowhere>2016-10-01 18:19:57 +0200
commite3a57272a712542e739b97db31efebc4cc17c53a (patch)
treef9deb5ab82a2797e376e836fc55f7e574142f89d /stream
parent486b3ce6f839f59f28b7b3d5add92e397b156f95 (diff)
stream_libarchive: add some more points at which reading can be stopped
Diffstat (limited to 'stream')
-rw-r--r--stream/stream_libarchive.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/stream/stream_libarchive.c b/stream/stream_libarchive.c
index 50177028ea..a840de706b 100644
--- a/stream/stream_libarchive.c
+++ b/stream/stream_libarchive.c
@@ -274,7 +274,7 @@ bool mp_archive_next_entry(struct mp_archive *mpa)
talloc_free(mpa->entry_filename);
mpa->entry_filename = NULL;
- for (;;) {
+ while (!mp_cancel_test(mpa->primary_src->cancel)) {
struct archive_entry *entry;
int r = archive_read_next_header(mpa->arch, &entry);
if (r == ARCHIVE_EOF)
@@ -367,6 +367,9 @@ static int archive_entry_seek(stream_t *s, int64_t newpos)
// skip function either).
char buffer[4096];
while (newpos > s->pos) {
+ if (mp_cancel_test(s->cancel))
+ return -1;
+
int size = MPMIN(newpos - s->pos, sizeof(buffer));
int r = archive_read_data(p->mpa->arch, buffer, size);
if (r < 0) {