Mercurial > mplayer.hg
changeset 33645:4c3bee76ef3b
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.
author | ranma |
---|---|
date | Sun, 26 Jun 2011 14:55:51 +0000 |
parents | c15dabfa2380 |
children | f3300b0c38a9 |
files | libmpdemux/muxer.c |
diffstat | 1 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/muxer.c Sun Jun 26 14:42:35 2011 +0000 +++ b/libmpdemux/muxer.c Sun Jun 26 14:55:51 2011 +0000 @@ -121,7 +121,7 @@ } /* 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 @@ 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;