[MPlayer-cvslog] r32928 - trunk/libmpcodecs/ve_lavc.c

Tobias Diedrich ranma at tdiedrich.de
Sat Feb 19 16:52:29 CET 2011


Reimar Döffinger wrote:
> On Sat, Feb 19, 2011 at 10:17:38AM +0100, ranma wrote:
> > Author: ranma
> > Date: Sat Feb 19 10:17:38 2011
> > New Revision: 32928
> > 
> > Log:
> > For codecs that produce no data on the first pass, e.g.
> > libtheora/libvpx, the stats file will come out empty due to the fact
> > that the check for stats is after one on the output frame size.
> > The attached moves the stats check prior to this. I verified that the
> > stats file generated for x264 is unaffected by this change.
> > 
> > Patch by James Zern, jzern google com
> > 
> > Modified:
> >    trunk/libmpcodecs/ve_lavc.c
> > 
> > Modified: trunk/libmpcodecs/ve_lavc.c
> > ==============================================================================
> > --- trunk/libmpcodecs/ve_lavc.c	Fri Feb 18 23:14:47 2011	(r32927)
> > +++ trunk/libmpcodecs/ve_lavc.c	Sat Feb 19 10:17:38 2011	(r32928)
> > @@ -812,6 +812,10 @@ static int encode_frame(struct vf_instan
> >  	out_size = avcodec_encode_video(lavc_venc_context, mux_v->buffer, mux_v->buffer_size,
> >  	    pic);
> >  
> > +    /* store stats if there are any */
> > +    if(lavc_venc_context->stats_out && stats_file)
> > +        fprintf(stats_file, "%s", lavc_venc_context->stats_out);
> 
> Do you know if we need to free/NULL the stats_out so we do not write the
> same thing multiple times when e.g. due to encoder delay we are calling
> encode_video more often than the number of input frames?
> I know there was some discussion about this on the FFmpeg list but
> I do not remember a single detail...

I had a short look at the ffmpeg code and it's allocated using
av_mallocz in encode_init() (snow) or in vp8_encode when data is null
(vp8).
It is later freed in encode_end (snow) or vp8_free (vp8)

So we probably should null the first byte after writing it out to be
sure we don't write it multiple times by mistake.

-- 
Tobias						PGP: http://8ef7ddba.uguu.de


More information about the MPlayer-cvslog mailing list