]> git.sesse.net Git - vlc/commitdiff
faad: drop byte of padding for raw streams
authorTristan Matthews <le.businessman@gmail.com>
Sat, 31 May 2014 21:07:34 +0000 (17:07 -0400)
committerTristan Matthews <le.businessman@gmail.com>
Sat, 31 May 2014 22:47:22 +0000 (18:47 -0400)
Fixes #2575, #11514

modules/codec/faad.c

index bf1b004a75a8789cf056c1c44b451809244de6ab..9aaaed63e9977324bdccdbe1d6588f5a90e9637f 100644 (file)
@@ -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;