From 61a51c57a9aae865930b4cc69a1480218e374404 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 21 Oct 2016 15:54:57 +0200 Subject: demux: don't try to refresh unselected streams This could cause nonsensical queue overflow warnings, but was otherwise probably harmless. --- demux/demux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demux/demux.c') diff --git a/demux/demux.c b/demux/demux.c index 3af0651dae..6041ada753 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -503,7 +503,7 @@ static double get_refresh_seek_pts(struct demux_internal *in) // Streams which didn't have any packets yet will return all packets, // other streams return packets only starting from the last position. if (ds->last_pos != -1 || ds->last_dts != MP_NOPTS_VALUE) - ds->refreshing = true; + ds->refreshing |= ds->selected; } // Seek back to player's current position, with a small offset added. -- cgit v1.2.3 From 3a78eefc88ecb354d1415f43bbf19d57caa31918 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 22 Oct 2016 17:17:04 +0200 Subject: demux_mkv: don't recursively resolve timeline for opened reference files Instead, resolve all references and so on in the top-level timeline. --- demux/demux.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'demux/demux.c') diff --git a/demux/demux.c b/demux/demux.c index 6041ada753..5072eb9f05 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -1287,16 +1287,18 @@ static struct demuxer *open_given_type(struct mpv_global *global, demux_changed(in->d_thread, DEMUX_EVENT_ALL); demux_update(demuxer); stream_control(demuxer->stream, STREAM_CTRL_SET_READAHEAD, &(int){false}); - struct timeline *tl = timeline_load(global, log, demuxer); - if (tl) { - struct demuxer_params params2 = {0}; - params2.timeline = tl; - struct demuxer *sub = open_given_type(global, log, - &demuxer_desc_timeline, stream, - ¶ms2, DEMUX_CHECK_FORCE); - if (sub) - return sub; - timeline_destroy(tl); + if (!(params && params->disable_timeline)) { + struct timeline *tl = timeline_load(global, log, demuxer); + if (tl) { + struct demuxer_params params2 = {0}; + params2.timeline = tl; + struct demuxer *sub = + open_given_type(global, log, &demuxer_desc_timeline, stream, + ¶ms2, DEMUX_CHECK_FORCE); + if (sub) + return sub; + timeline_destroy(tl); + } } return demuxer; } -- cgit v1.2.3 From 58383229756a8871fb312c0897914e45e5824fc1 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 1 Nov 2016 14:28:36 +0100 Subject: demux: improve buffer estimation in a corner case This deals with the estimation of buffered packets, which is used mostly for display, but also things like pausing on low buffer levels. If a stream is fully EOF (no more packets), we don't want to include it in the total buffer amount. This also means we should make ds->eof less flaky and more stable, so don't reset it in ds_get_packets() (this function reset ds->eof just to retrigger a packet read attempt - we can have this slightly simpler). This somewhat fixes buffering display when e.g. issuing a refresh seek after re-enabling audio/video when playing with subtitles only. --- demux/demux.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'demux/demux.c') diff --git a/demux/demux.c b/demux/demux.c index 5072eb9f05..8aa9989de3 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -681,8 +681,7 @@ static void ds_get_packets(struct demux_stream *ds) struct demux_internal *in = ds->in; MP_DBG(in, "reading packet for %s\n", t); in->eof = false; // force retry - ds->eof = false; - while (ds->selected && !ds->head && !ds->eof) { + while (ds->selected && !ds->head) { ds->active = true; // Note: the following code marks EOF if it can't continue if (in->threading) { @@ -692,6 +691,8 @@ static void ds_get_packets(struct demux_stream *ds) } else { read_packet(in); } + if (ds->eof) + break; } } @@ -1662,7 +1663,7 @@ static int cached_demux_control(struct demux_internal *in, int cmd, void *arg) int num_packets = 0; for (int n = 0; n < in->num_streams; n++) { struct demux_stream *ds = in->streams[n]->ds; - if (ds->active) { + if (ds->active && !(!ds->head && ds->eof)) { r->underrun |= !ds->head && !ds->eof; r->ts_range[0] = MP_PTS_MAX(r->ts_range[0], ds->base_ts); r->ts_range[1] = MP_PTS_MIN(r->ts_range[1], ds->last_ts); -- cgit v1.2.3