[vlc-devel] [PATCH 1/1] faad: always drop byte of padding (fixes #5257)

Tristan Matthews le.businessman at gmail.com
Mon Dec 15 05:55:15 CET 2014


On Sun, Dec 14, 2014 at 10:41 PM, Tristan Matthews
<le.businessman at gmail.com> wrote:
>
> ---
>  modules/codec/faad.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/modules/codec/faad.c b/modules/codec/faad.c
> index 9aaaed6..93b492e 100644
> --- a/modules/codec/faad.c
> +++ b/modules/codec/faad.c
> @@ -313,7 +313,7 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
>      }
>
>      /* Decode all data */
> -    if( p_sys->i_buffer )
> +    if( p_sys->i_buffer > 1)
>      {
>          void *samples;
>          faacDecFrameInfo frame;
> @@ -395,10 +395,12 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
>
>              /* Flush the buffer */
>              p_sys->i_buffer -= frame.bytesconsumed;
> -            if( p_sys->i_buffer > 0 )
> +            if( p_sys->i_buffer > 1 )
>              {
>                  memmove( p_sys->p_buffer,&p_sys->p_buffer[frame.bytesconsumed],
>                           p_sys->i_buffer );
> +            } else {
> +                p_sys->i_buffer = 0;
>              }
>              block_Release( p_block );
>              return NULL;
> @@ -507,6 +509,8 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
>          }
>
>          return p_out;
> +    } else {
> +        p_sys->i_buffer = 0;
>      }
>
>      block_Release( p_block );
> --
> 1.9.3
>

This patch also covers #2575 and #11514 so once applied, I can revert
commit 937911d559051522554ac6f0d6d35fc0836d541a



More information about the vlc-devel mailing list