From 9c330b53e375d1a1886be5b7fd3e0e22331b3384 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 10 Nov 2017 03:18:45 +0100 Subject: 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). --- demux/demux.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'demux') 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"); -- cgit v1.2.3