diff options
author | wm4 <wm4@nowhere> | 2017-10-25 15:51:39 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-10-25 16:39:33 +0200 |
commit | e6348504b3a0bb97383edbd1fefd7decfb0c24c4 (patch) | |
tree | 33e03cd8c1b142c85da236a723ec2c6fdfbdf9c8 | |
parent | 3d716515239e8486f36a0e4cf3c76870d08752e3 (diff) | |
download | mpv-e6348504b3a0bb97383edbd1fefd7decfb0c24c4.tar.bz2 mpv-e6348504b3a0bb97383edbd1fefd7decfb0c24c4.tar.xz |
demux: disallow seeking if there are streams with no timestamps
The seek range computation ignored streams with no timestamps. For
things like buffer estimation this is OK and wanted, but the seek range
needs to be conservative.
-rw-r--r-- | demux/demux.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/demux/demux.c b/demux/demux.c index 737ee68f23..bf0b53f939 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -1962,6 +1962,7 @@ static int cached_demux_control(struct demux_internal *in, int cmd, void *arg) .ts_duration = -1, }; bool any_packets = false; + bool seek_ok = true; for (int n = 0; n < in->num_streams; n++) { struct demux_stream *ds = in->streams[n]->ds; if (ds->active && !(!ds->queue_head && ds->eof) && !ds->ignore_eof) @@ -1976,6 +1977,9 @@ static int cached_demux_control(struct demux_internal *in, int cmd, void *arg) // there) r->ts_min = MP_PTS_MAX(r->ts_min, ds->back_pts); r->ts_max = MP_PTS_MAX(r->ts_max, ds->last_ts); + if (ds->back_pts == MP_NOPTS_VALUE || + ds->last_ts == MP_NOPTS_VALUE) + seek_ok = false; if (ds->queue_head) { any_packets = true; double ts = PTS_OR_DEF(ds->queue_head->dts, @@ -1993,10 +1997,10 @@ static int cached_demux_control(struct demux_internal *in, int cmd, void *arg) r->ts_max = MP_ADD_PTS(r->ts_max, in->ts_offset); if (r->ts_reader != MP_NOPTS_VALUE && r->ts_reader <= r->ts_max) r->ts_duration = r->ts_max - r->ts_reader; - if (in->seeking || !any_packets) { - r->ts_max = r->ts_min = MP_NOPTS_VALUE; + if (in->seeking || !any_packets) r->ts_duration = 0; - } + if (in->seeking || !seek_ok) + r->ts_max = r->ts_min = MP_NOPTS_VALUE; return CONTROL_OK; } } |