[MPlayer-dev-eng] [PATCH] Ignore 0-len packets for muxer prebuffering

Ivan Kalvachev ikalvachev at gmail.com
Sun Jun 26 16:21:16 CEST 2011


On 6/24/11, Tobias Diedrich <ranma at tdiedrich.de> wrote:
> Reimar Döffinger wrote:
>> The thing that is unclear is why we should change mencoder when it is
>> libavformat that crashes with a division by 0.
>> Also the description if "ignore packets of len 0" doesn't quite
>> match what it does, it seems _all_ code is actually being run for
>> them, only the muxbuf_seen flag (whatever that may do) is not set.
>> In particular I suspect this means there's only a change of behaviour
>> for initial 0-len packets.
>
> I updated the patch description.
> Even if the crash is fixed the muxer will still be missing necessary
> information to write a useful header.
> The problem was investigated because of the crashing problem, but
> the fix is for the rootcause.  We shouldn't try to write the header
> before we really have seen data for all the streams.

The functional part of the patch is OK.
I've lost few hours yesterday to debug same problem.

In short, if for some reason mencoder tries to duplicate frame from
the start, it will do this before the encoder is config()-ured, thus a
lot of critical information is not set. avformat_write_header() errors
out (aka "dimensions not set"), but mencoder doesn't handle the error
code, goes on with writing packets and causes a crash.

Tobias, I see you in authors file. Will you be able to commit this on your own?

I wouldn't mind even more improved comment, but I'd like the
functional part committed asap.
My try in improving it:

/* If mencoder inserts "repeat last frame" chunks with len == 0
 * before the encoder is configured and first real frame is output
 * then muxer won't find needed info for writing initial header.
 * Wait until the first real frame is seen. */


More information about the MPlayer-dev-eng mailing list