[vlc-devel] [PATCH 1/1] twolame: add error checking

Tristan Matthews le.businessman at gmail.com
Sat Sep 27 21:00:27 CEST 2014


On Sat, Sep 27, 2014 at 2:57 PM, Rémi Denis-Courmont <remi at remlab.net>
wrote:

> Le samedi 27 septembre 2014, 14:29:36 Tristan Matthews a écrit :
> > This patch handles allocation failures and encoding failure.
> >
> > ---
> >  modules/codec/twolame.c | 15 +++++++++++++++
> >  1 file changed, 15 insertions(+)
> >
> > diff --git a/modules/codec/twolame.c b/modules/codec/twolame.c
> > index 20ef952..3255e9b 100644
> > --- a/modules/codec/twolame.c
> > +++ b/modules/codec/twolame.c
> > @@ -274,6 +274,8 @@ static block_t *Encode( encoder_t *p_enc, block_t
> > *p_aout_buf ) return NULL;
> >
> >          p_block = block_Alloc( i_used );
> > +        if( !p_block )
> > +            return NULL;
> >          memcpy( p_block->p_buffer, p_sys->p_out_buffer, i_used );
> >          p_block->i_length = CLOCK_FREQ *
> >                  (mtime_t)MPEG_FRAME_SIZE /
> > (mtime_t)p_enc->fmt_out.audio.i_rate; @@ -302,8 +304,21 @@ static block_t
> > *Encode( encoder_t *p_enc, block_t *p_aout_buf ) i_used =
> > twolame_encode_buffer_interleaved( p_sys->p_twolame, p_sys->p_buffer,
> > MPEG_FRAME_SIZE,
> >                                 p_sys->p_out_buffer,
> MAX_CODED_FRAME_SIZE );
> > +        /* On error, bufferize samples and return what was already
> encoded
> > */
>
> Is bufferize even a word?
>

It's a function ("Bufferize") in this file, but yes I see your point.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20140927/08daaa56/attachment.html>


More information about the vlc-devel mailing list