[MPlayer-cvslog] r33733 - trunk/libmpdemux/muxer.c

ranma subversion at mplayerhq.hu
Sun Jun 26 16:55:51 CEST 2011


Author: ranma
Date: Sun Jun 26 16:55:51 2011
New Revision: 33733

Log:
The muxer prebuffers packets until each stream has been seen so a proper header
can be written.  However if mencoder inserts "repeat last frame" chunks with
len == 0 before the encoder is configured and first real frame is output or a
broken file starts a stream with such frames, then muxer won't find needed
info for writing initial header.

Modified:
   trunk/libmpdemux/muxer.c

Modified: trunk/libmpdemux/muxer.c
==============================================================================
--- trunk/libmpdemux/muxer.c	Sun Jun 26 16:42:35 2011	(r33732)
+++ trunk/libmpdemux/muxer.c	Sun Jun 26 16:55:51 2011	(r33733)
@@ -121,7 +121,7 @@ void muxer_flush(muxer_t *m) {
 }
 
 /* buffer frames until we either:
- * (a) have at least one frame from each stream
+ * (a) have at least one non-empty frame from each stream
  * (b) run out of memory */
 void muxer_write_chunk(muxer_stream_t *s, size_t len, unsigned int flags, double dts, double pts) {
     if(dts == MP_NOPTS_VALUE) dts= s->timer;
@@ -154,7 +154,14 @@ void muxer_write_chunk(muxer_stream_t *s
         return;
       }
       memcpy(buf->buffer, s->buffer, buf->len);
-      s->muxbuf_seen = 1;
+
+      /* If mencoder inserts "repeat last frame" chunks with len == 0
+       * before the encoder is configured and first real frame is output
+       * or a broken file starts a stream with such frames, then muxer
+       * won't find needed info for writing initial header.
+       * Wait until the first real frame is seen. */
+      if (len > 0)
+          s->muxbuf_seen = 1;
 
       /* see if we need to keep buffering */
       s->muxer->muxbuf_skip_buffer = 1;


More information about the MPlayer-cvslog mailing list