[vlc-commits] faad: always drop byte of padding (fixes #5257)
Tristan Matthews
git at videolan.org
Mon Dec 15 15:58:07 CET 2014
vlc | branch: master | Tristan Matthews <tmatth at videolan.org> | Sun Dec 14 22:33:57 2014 -0500| [c14f9cdfb7e9e66eb16bb6f81982a07ada6d865a] | committer: Tristan Matthews
faad: always drop byte of padding (fixes #5257)
Also covers #2575 and #11514
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c14f9cdfb7e9e66eb16bb6f81982a07ada6d865a
---
modules/codec/faad.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/modules/codec/faad.c b/modules/codec/faad.c
index 9aaaed6..54191bc 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,11 +395,16 @@ 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
+ {
+ /* Drop byte of padding */
+ p_sys->i_buffer = 0;
+ }
block_Release( p_block );
return NULL;
}
@@ -508,6 +513,11 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
return p_out;
}
+ else
+ {
+ /* Drop byte of padding */
+ p_sys->i_buffer = 0;
+ }
block_Release( p_block );
return NULL;
More information about the vlc-commits
mailing list