# HG changeset patch # User reimar # Date 1286031820 0 # Node ID c1a2c51bed1c4f48e34060a42ac7f2114008cc03 # Parent 09dd92639e7b38ded469710809931d7000c69ed8 Fix ds_get_packet_sub to actually respect the pts-based read-ahead limit. diff -r 09dd92639e7b -r c1a2c51bed1c libmpdemux/demuxer.c --- a/libmpdemux/demuxer.c Sat Oct 02 14:22:03 2010 +0000 +++ b/libmpdemux/demuxer.c Sat Oct 02 15:03:40 2010 +0000 @@ -826,11 +826,14 @@ int ds_get_packet_sub(demux_stream_t *ds, unsigned char **start, double *pts, double *endpts) { + double max_pts = MP_NOPTS_VALUE; int len; *start = NULL; // initialize pts - if (pts) + if (pts) { + max_pts = *pts; *pts = MP_NOPTS_VALUE; + } if (endpts) *endpts = MP_NOPTS_VALUE; if (ds->buffer_pos >= ds->buffer_size) { @@ -846,8 +849,8 @@ if (pts) { *pts = ds->current->pts; // check if we are too early - if (*pts != MP_NOPTS_VALUE && ds->current->pts != MP_NOPTS_VALUE && - ds->current->pts > *pts) + if (*pts != MP_NOPTS_VALUE && max_pts != MP_NOPTS_VALUE && + *pts > max_pts) return -1; } }