summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-11-10 03:18:45 +0100
committerwm4 <wm4@nowhere>2017-11-10 03:19:25 +0100
commit9c330b53e375d1a1886be5b7fd3e0e22331b3384 (patch)
tree1fb79ce9e71b5fb6883a905be4ba83b979355ca3
parentc494049e766a169c2abd25c99c3cdeff33cdc532 (diff)
downloadmpv-9c330b53e375d1a1886be5b7fd3e0e22331b3384.tar.bz2
mpv-9c330b53e375d1a1886be5b7fd3e0e22331b3384.tar.xz
demux: avoid broken readahead when joining ranges
Setting ds->refreshing for unselected streams could lead to a nonsensical queue overflow warning, because read_packet() took it as a reason to continue reading. Also add some more information to the queue overflow warning (even if that one doesn't have anything to do with this bug - it was for unselected streams only).
-rw-r--r--demux/demux.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/demux/demux.c b/demux/demux.c
index ae7ac7afe3..2e4d63bce5 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -1005,7 +1005,7 @@ static void attempt_range_joining(struct demux_internal *in)
in->fw_bytes += ds->fw_bytes;
// For moving demuxer position.
- ds->refreshing = true;
+ ds->refreshing = ds->selected;
}
next->seek_start = in->current_range->seek_start;
@@ -1203,10 +1203,11 @@ static bool read_packet(struct demux_internal *in)
for (int n = 0; n < in->num_streams; n++) {
struct demux_stream *ds = in->streams[n]->ds;
if (ds->selected) {
- MP_WARN(in, " %s/%d: %zd packets, %zd bytes%s\n",
+ MP_WARN(in, " %s/%d: %zd packets, %zd bytes%s%s\n",
stream_type_name(ds->type), n,
ds->fw_packs, ds->fw_bytes,
- ds->eager ? "" : " (lazy)");
+ ds->eager ? "" : " (lazy)",
+ ds->refreshing ? " (refreshing)" : "");
}
}
}
@@ -2288,7 +2289,7 @@ static bool try_seek_cache(struct demux_internal *in, double pts, int flags)
for (int n = 0; n < in->num_streams; n++) {
struct demux_stream *ds = in->streams[n]->ds;
- ds->refreshing = true;
+ ds->refreshing = ds->selected;
}
MP_VERBOSE(in, "resuming demuxer to end of cached range\n");