[MPlayer-cvslog] r35486 - in trunk/libmpdemux: demuxer.c demuxer.h

reimar subversion at mplayerhq.hu
Mon Nov 26 20:30:58 CET 2012


Author: reimar
Date: Mon Nov 26 20:30:58 2012
New Revision: 35486

Log:
Try to improve seeking in files with only few video packets,
in particular files with cover art.

This might cause issues with badly interleaved files, particularly
together with -audio-delay, even though I did not see issues
in my very limited testing.

Modified:
   trunk/libmpdemux/demuxer.c
   trunk/libmpdemux/demuxer.h

Modified: trunk/libmpdemux/demuxer.c
==============================================================================
--- trunk/libmpdemux/demuxer.c	Mon Nov 26 12:32:50 2012	(r35485)
+++ trunk/libmpdemux/demuxer.c	Mon Nov 26 20:30:58 2012	(r35486)
@@ -663,6 +663,7 @@ int ds_fill_buffer(demux_stream_t *ds)
             demux_packet_t *p = ds->first;
             // obviously not yet EOF after all
             ds->eof = 0;
+            ds->fill_count = 0;
 #if 0
             if (demux->reference_clock != MP_NOPTS_VALUE) {
                 if (   p->pts != MP_NOPTS_VALUE
@@ -697,6 +698,11 @@ int ds_fill_buffer(demux_stream_t *ds)
             --ds->packs;
             return 1;
         }
+        // avoid buffering too far ahead in e.g. badly interleaved files
+        // or when one stream is shorter, without breaking large audio
+        // delay with well interleaved files.
+        if (ds->fill_count++ > 20)
+            break;
         // avoid printing the "too many ..." message over and over
         if (ds->eof)
             break;

Modified: trunk/libmpdemux/demuxer.h
==============================================================================
--- trunk/libmpdemux/demuxer.h	Mon Nov 26 12:32:50 2012	(r35485)
+++ trunk/libmpdemux/demuxer.h	Mon Nov 26 20:30:58 2012	(r35486)
@@ -144,6 +144,7 @@ typedef struct {
   int non_interleaved;     // 1 if this stream is not properly interleaved,
                            // so e.g. subtitle handling must do explicit reads.
 //---------------
+  int fill_count;         // number of unsuccessful tries to get a packet
   int packs;              // number of packets in buffer
   int bytes;              // total bytes of packets in buffer
   demux_packet_t *first;  // read to first buffer after the current buffer from here


More information about the MPlayer-cvslog mailing list