[vlc-commits] faad: always drop byte of padding (fixes #5257)

Tristan Matthews git at videolan.org
Wed Dec 17 17:52:11 CET 2014


vlc/vlc-2.2 | branch: master | Tristan Matthews <tmatth at videolan.org> | Sun Dec 14 22:33:57 2014 -0500| [418ff2ed80fd8f67514eeac88d21c1158088ed39] | committer: Jean-Baptiste Kempf

faad: always drop byte of padding (fixes #5257)

Also covers #2575 and #11514

(cherry picked from commit c14f9cdfb7e9e66eb16bb6f81982a07ada6d865a)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=418ff2ed80fd8f67514eeac88d21c1158088ed39
---

 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