[vlc-commits] faad: drop byte of padding for raw streams

Tristan Matthews git at videolan.org
Sun Jun 1 05:28:12 CEST 2014


vlc | branch: master | Tristan Matthews <le.businessman at gmail.com> | Sat May 31 17:07:34 2014 -0400| [937911d559051522554ac6f0d6d35fc0836d541a] | committer: Tristan Matthews

faad: drop byte of padding for raw streams

Fixes #2575, #11514

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=937911d559051522554ac6f0d6d35fc0836d541a
---

 modules/codec/faad.c |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/modules/codec/faad.c b/modules/codec/faad.c
index bf1b004..9aaaed6 100644
--- a/modules/codec/faad.c
+++ b/modules/codec/faad.c
@@ -491,8 +491,19 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
         p_sys->i_buffer -= frame.bytesconsumed;
         if( p_sys->i_buffer > 0 )
         {
-            memmove( p_sys->p_buffer, &p_sys->p_buffer[frame.bytesconsumed],
-                     p_sys->i_buffer );
+            /* drop byte of raw AAC padding (if present) */
+            if ( frame.header_type == RAW &&
+                 p_sys->i_buffer == 1 &&
+                 p_sys->p_buffer[0] == 0x21 &&
+                 p_sys->p_buffer[frame.bytesconsumed] == 0 )
+            {
+                p_sys->i_buffer = 0;
+            }
+            else
+            {
+                memmove( p_sys->p_buffer, &p_sys->p_buffer[frame.bytesconsumed],
+                         p_sys->i_buffer );
+            }
         }
 
         return p_out;



More information about the vlc-commits mailing list