vlc | branch: master | Francois Cartegnie <[email protected]> | Thu Sep 7 13:47:47 2017 +0200| [28b52fef2550e737ba27c5fcfc58e6b50f4c5020] | committer: Francois Cartegnie
codec: faad: fix buffer consumption > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=28b52fef2550e737ba27c5fcfc58e6b50f4c5020 --- modules/codec/faad.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/modules/codec/faad.c b/modules/codec/faad.c index f134f4e320..95ae03298f 100644 --- a/modules/codec/faad.c +++ b/modules/codec/faad.c @@ -327,7 +327,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block ) } /* Decode all data */ - if( p_sys->p_block && p_sys->p_block->i_buffer > 1 ) + while( p_sys->p_block && p_sys->p_block->i_buffer > 0 ) { void *samples; NeAACDecFrameInfo frame; @@ -387,25 +387,23 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block ) Flush( p_dec ); p_sys->b_discontinuity = true; - return VLCDEC_SUCCESS; + continue; } if( frame.channels == 0 || frame.channels >= 64 ) { msg_Warn( p_dec, "invalid channels count: %i", frame.channels ); - FlushBuffer( p_sys, frame.bytesconsumed ); if( frame.channels == 0 ) - { p_sys->b_discontinuity = true; - return VLCDEC_SUCCESS; - } + FlushBuffer( p_sys, frame.bytesconsumed ? frame.bytesconsumed : SIZE_MAX ); + continue; } if( frame.samples == 0 ) { msg_Warn( p_dec, "decoded zero sample" ); - FlushBuffer( p_sys, frame.bytesconsumed ); - return VLCDEC_SUCCESS; + FlushBuffer( p_sys, frame.bytesconsumed ? frame.bytesconsumed : SIZE_MAX ); + continue; } /* We decoded a valid frame */ @@ -563,14 +561,15 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block ) date_Increment( &p_sys->date, frame.samples / frame.channels ); } - FlushBuffer( p_sys, frame.bytesconsumed ); + FlushBuffer( p_sys, frame.bytesconsumed ? frame.bytesconsumed : SIZE_MAX ); - return VLCDEC_SUCCESS; - } - else - { - /* Drop byte of padding */ - FlushBuffer( p_sys, 0 ); + if( p_sys->p_block && p_sys->p_block->i_buffer == 1 ) + { + /* Drop byte of padding */ + FlushBuffer( p_sys, 0 ); + } + + continue; } return VLCDEC_SUCCESS; _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
