[FFmpeg-devel] [PATCH] Patches to fix issue453 in libdiracschroedinger

Anuradha Suraparaju anuradha
Mon May 26 03:45:26 CEST 2008


On Fri, 2008-05-23 at 22:15 +0200, Michael Niedermayer wrote:
> On Thu, May 22, 2008 at 12:26:16PM +1000, Anuradha Suraparaju wrote:
> > Hi,
> > 
> > I've included 2 patches to fix the bug reported in issue453. More
> > details of the bug can be found in
> > 
> > http://roundup.mplayerhq.hu/roundup/ffmpeg/issue453
> > 
> > The same issue applies to libdirac too. So I included a patch for
> > libdirac as well.
> > 
> > Non-frame data is either prepended (sequence headers) or appended (end
> > of sequence info to the last frame) to frame data to ensure that the
> > codec outputs frame data in every packet and the pts is monotonous. So a
> > packet output by the encoder will contain one encoded frame and header
> > or sequence end info when applicable. 
> > 
> > 1. issue453_fix_pts_bug_common_libdirac_libschroedinger.diff
> > 
> >    Contains patched files common to libdirac and libschroedinger.
> > 
> >    libavcodec/libdirac_libschro.c{.h}
> > 
> >    libavcodec/dirac_parser.c - Since a packet can now contain more than 
> >    one Dirac parse unit, a complete packet will still need to be parsed
> >    to extract a single Dirac parse unit.
> > 
> >    libavformat/riff.c   - Add a fourcc code for CODEC_ID_DIRAC to enable
> >    wrapping and playback of Dirac in AVI.
> > 
> > 2. issue453_fix_pts_bug_libschroedinger.diff
> > 
> >    Contains patch to libschroedingerenc.c to fix the non-monotone pts 
> >    bug
> > 
> > 3. fix_pts_bug_libdirac.diff
> > 
> >    Contains patch to libdiracenc.c to ensure that pts is monotnous.
> [...]

[...]

> 
> [...]
> 
> > +            if (p_schro_params->enc_buf_size == 0)
> > +                p_schro_params->enc_buf = av_malloc(schro_buf->length);
> > +            else {
> > +                p_schro_params->enc_buf = av_realloc (
> > +                             p_schro_params->enc_buf,
> > +                             p_schro_params->enc_buf_size + schro_buf->length
> > +                             );
> > +            }
> 
> This is the same as just
> p_schro_params->enc_buf = av_realloc (
>         p_schro_params->enc_buf,
>         p_schro_params->enc_buf_size + schro_buf->length
>         );
> 
> 

I can't just use av_realloc here because p_schro_params->enc_buf is used
to set the output frame pointer in the frame output queue.

(libschroedingerenc.c:336)
p_frame_output->p_encbuf = p_schro_params->enc_buf;

It gets released when a frame is popped from a queue. So it needs to be
allocated when we first start storing data to be written out to a frame.


[...]

Regards,
Anuradha





More information about the ffmpeg-devel mailing list