[FFmpeg-devel] [PATCH] misc libvorbis.c fixes

Pascal Massimino pascal.massimino
Sun Jul 11 17:53:02 CEST 2010


Aurelien,

On Sun, Jul 11, 2010 at 5:21 AM, Aurelien Jacobs <aurel at gnuage.org> wrote:

> On Sun, Jul 11, 2010 at 12:07:53AM -0700, Pascal Massimino wrote:
> > David,
> >
> > On Sat, Jul 3, 2010 at 12:35 AM, David Conrad <lessen42 at gmail.com>
> wrote:
> >
> > > Sorry for the delays...
> > >
> > > On Jun 29, 2010, at 3:44 AM, Pascal Massimino wrote:
> > >
> > > > Index: libavcodec/libvorbis.c
> > > > ===================================================================
> > > > --- libavcodec/libvorbis.c    (revision 23816)
> > > > +++ libavcodec/libvorbis.c    (working copy)
> > > > @@ -84,11 +84,14 @@
> > > >      return vorbis_encode_setup_init(vi);
> > > >  }
> > > >
> > > > +/* How many bytes are needed for a buffer of length 'l' */
> > > > +static int xiph_len(int l) { return (1 + l / 255 + l); }
> > > > +
> > > >  static av_cold int oggvorbis_encode_init(AVCodecContext *avccontext)
> {
> > > >      OggVorbisContext *context = avccontext->priv_data ;
> > > >      ogg_packet header, header_comm, header_code;
> > > >      uint8_t *p;
> > > > -    unsigned int offset, len;
> > > > +    unsigned int offset;
> > > >
> > > >      vorbis_info_init(&context->vi) ;
> > > >      if(oggvorbis_init_encoder(&context->vi, avccontext) < 0) {
> > > > @@ -104,9 +107,10 @@
> > > >      vorbis_analysis_headerout(&context->vd, &context->vc, &header,
> > > >                                  &header_comm, &header_code);
> > > >
> > > > -    len = header.bytes + header_comm.bytes +  header_code.bytes;
> > > > -    avccontext->extradata_size= 64 + len + len/255;
> > > > -    p = avccontext->extradata=
> av_mallocz(avccontext->extradata_size);
> > > > +    avccontext->extradata_size=
> > > > +        1 + xiph_len(header.bytes) + xiph_len(header_comm.bytes) +
> > > > +        header_code.bytes;
> > > > +    p = avccontext->extradata =
> av_malloc(avccontext->extradata_size);
> > >
> > > Might as well add in the missing FF_INPUT_BUFFER_PADDING_SIZE while
> you're
> > > at it
> > >
> >
> > ok, as in the new patch attached?
>
> No...
>
> > Index: libvorbis.c
> > ===================================================================
> > --- libvorbis.c       (revision 24184)
> > +++ libvorbis.c       (working copy)
> > @@ -105,9 +108,10 @@
> >      vorbis_analysis_headerout(&context->vd, &context->vc, &header,
> >                                  &header_comm, &header_code);
> >
> > -    len = header.bytes + header_comm.bytes +  header_code.bytes;
> > -    avccontext->extradata_size= 64 + len + len/255;
> > -    p = avccontext->extradata= av_mallocz(avccontext->extradata_size);
> > +    len= 1 + xiph_len(header.bytes) + xiph_len(header_comm.bytes) +
> > +                header_code.bytes;
> > +    avccontext->extradata_size= len + FF_INPUT_BUFFER_PADDING_SIZE;
> > +    p = avccontext->extradata = av_malloc(avccontext->extradata_size);
>
> extradata must be allocated with FF_INPUT_BUFFER_PADDING_SIZE, but
> FF_INPUT_BUFFER_PADDING_SIZE must not be added to extradata_size.
>

oh! i see. New attempt attached...


> Aurel
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vorbis-2.patch
Type: application/octet-stream
Size: 1781 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100711/a2f5dd0d/attachment.obj>



More information about the ffmpeg-devel mailing list