diff options
author | wm4 <wm4@nowhere> | 2014-11-03 21:54:49 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-11-03 21:54:49 +0100 |
commit | 7c2c1dbe8005b2d2f9aac7f5f10b46715f27addd (patch) | |
tree | eec183213e3eb4b7e12faa4fd1481e50ccee0e5c | |
parent | 71d5dd091643a7a9ce76a528e2b4563ab165ca36 (diff) | |
download | mpv-7c2c1dbe8005b2d2f9aac7f5f10b46715f27addd.tar.bz2 mpv-7c2c1dbe8005b2d2f9aac7f5f10b46715f27addd.tar.xz |
demux: fix PTS comparison
This was relying on the fact that timestamps will always be numerically
larger than MP_NOPTS_VALUE, but the trick didn't actually work for
MP_PTS_MIN. Be a bit more sincere, and don't rely on this anymore. This
fixes the comparison, and avoids the readahead amount displaying as
"???" in some situations (since one of the values was NOPTS).
-rw-r--r-- | demux/demux.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/demux/demux.c b/demux/demux.c index 5e7268d622..73bc6247c2 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -148,9 +148,11 @@ struct demux_stream { struct demux_packet *tail; }; +// Return "a", or if that is NOPTS, return "def". +#define PTS_OR_DEF(a, def) ((a) == MP_NOPTS_VALUE ? (def) : (a)) // If one of the values is NOPTS, always pick the other one. -#define MP_PTS_MIN(a, b) ((a) == MP_NOPTS_VALUE || ((a) > (b)) ? (b) : (a)) -#define MP_PTS_MAX(a, b) ((a) == MP_NOPTS_VALUE || ((a) < (b)) ? (b) : (a)) +#define MP_PTS_MIN(a, b) MPMIN(PTS_OR_DEF(a, b), PTS_OR_DEF(b, a)) +#define MP_PTS_MAX(a, b) MPMAX(PTS_OR_DEF(a, b), PTS_OR_DEF(b, a)) static void demuxer_sort_chapters(demuxer_t *demuxer); static void *demux_thread(void *pctx); |