changeset 32337:c1a2c51bed1c

Fix ds_get_packet_sub to actually respect the pts-based read-ahead limit.
author reimar
date Sat, 02 Oct 2010 15:03:40 +0000
parents 09dd92639e7b
children 5572e926e027
files libmpdemux/demuxer.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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;
         }
     }