[MPlayer-dev-eng] [PATCH] muxer frame buffering for mencoder [patch version 4]

Corey Hickey bugfood-ml at fatooh.org
Sat Nov 19 12:06:13 CET 2005


Nico Sabbi wrote:
>>muxer_mpeg: The mpeg muxer didn't update the timer when passed an empty
>>frame; my buffering function updates the timer regardless. As far as I
>>know the behavior of my patched version is more correct. Files that
>>encoded/played correctly with the unpatched version still seem to
>>encode/play.
> 
> in all my tests I didn't find a single case when s->buffer was null,
> but anyway......

s->buffer is null and len is 0 for one or more frames when using -ovc
copy on an avi file previously created with mencoder. I'm not sure, but
I suspect that when the first video frame (or frames) of a file are
empty, s->buffer isn't allocated until a non-empty frame is encountered.
I don't have time to track it down and confirm that right now, but I
might later.

You can reproduce it with the attached tiny file.
mencoder b.avi -ovc copy -nosound -of mpeg

>>+      s->muxer->muxbuf = realloc(s->muxer->muxbuf, (num+1) * sizeof(muxbuf_t));
> 
> this is a possible memleak: if s->muxer->muxbuf != NULL before realloc()
> but realloc() fails you will lose track of the previously allocated buffer.
> Don't bother fixing it, I will do it myself if my tests succeed

Ok; I missed that. Thanks.

>>-static int parse_audio(muxer_stream_t *s, int finalize, int *nf, double *timer)
>>+static int parse_audio(muxer_stream_t *s, int finalize)
> 
> I don't like this. Don't remove useful infos like those: they may be 
> needed in the future.

I can't remember why I removed nf from that function. Probably I didn't
need to do so but saw that it was unused. I was never really comfortable
with any of my changes to muxer_mpeg.c.

I didn't think timer was relevant at that point, though, since it was
handled in the wrapper function.

> The rest looks ok to me, at least reading the code. If my tests succeed 
> and no one complains
> I'll commit your patch in the next days.

Great! Thank you. If stuff comes up that ought to be fixed I'll try to
do so.

-Corey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: b.avi.bz2
Type: application/octet-stream
Size: 10500 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20051119/205b10be/attachment.obj>


More information about the MPlayer-dev-eng mailing list