Packetizers should trash all blocks with DISCONTINUITY or CORRUPTED flag set.
authorLaurent Aimar <fenrir@videolan.org>
Fri, 2 Mar 2007 19:51:20 +0000 (19:51 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Fri, 2 Mar 2007 19:51:20 +0000 (19:51 +0000)
As a side effect, this workaround the AAC decoding problem after pause/seek
when going through our packetizer (eg: pause/seek with vlc VOD).

But the bug is still there : faad will stop decoding audio forever after
receiving a buffer full of 0 (at least with faad2-2.5 from
audiocoding.com, faad2 from mplayer svn does not show this problem)

modules/packetizer/copy.c
modules/packetizer/h264.c
modules/packetizer/mpeg4audio.c
modules/packetizer/mpeg4video.c
modules/packetizer/vc1.c

index c509c48..3bb7ada 100644 (file)
@@ -256,9 +256,13 @@ static block_t *Packetize ( decoder_t *p_dec, block_t **pp_block )
     block_t *p_ret = p_dec->p_sys->p_block;
 
     if( pp_block == NULL || *pp_block == NULL )
+        return NULL;
+    if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
     {
+        block_Release( *pp_block );
         return NULL;
     }
+
     p_block = *pp_block;
     *pp_block = NULL;
 
@@ -291,9 +295,13 @@ static block_t *PacketizeSub( decoder_t *p_dec, block_t **pp_block )
     block_t *p_block;
 
     if( pp_block == NULL || *pp_block == NULL )
+        return NULL;
+    if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
     {
+        block_Release( *pp_block );
         return NULL;
     }
+
     p_block = *pp_block;
     *pp_block = NULL;
 
index efb0e2c..0825ae9 100644 (file)
@@ -311,7 +311,14 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
     decoder_sys_t *p_sys = p_dec->p_sys;
     block_t       *p_pic;
 
-    if( !pp_block || !*pp_block ) return NULL;
+    if( !pp_block || !*pp_block )
+        return NULL;
+    if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
+    {
+        p_sys->i_state = STATE_NOSYNC;
+        block_Release( *pp_block );
+        return NULL;
+    }
 
     block_BytestreamPush( &p_sys->bytestream, *pp_block );
 
@@ -400,7 +407,13 @@ static block_t *PacketizeAVC1( decoder_t *p_dec, block_t **pp_block )
     block_t       *p_ret = NULL;
     uint8_t       *p;
 
-    if( !pp_block || !*pp_block ) return NULL;
+    if( !pp_block || !*pp_block )
+        return NULL;
+    if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
+    {
+        block_Release( *pp_block );
+        return NULL;
+    }
 
     p_block = *pp_block;
     *pp_block = NULL;
index 9f38f70..8aeb39e 100644 (file)
@@ -216,6 +216,12 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
 
     if( !pp_block || !*pp_block ) return NULL;
 
+    if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
+    {
+        block_Release( *pp_block );
+        return NULL;
+    }
+
     p_block = *pp_block;
     *pp_block = NULL; /* Don't reuse this block */
 
@@ -257,10 +263,11 @@ static block_t *ADTSPacketizeBlock( decoder_t *p_dec, block_t **pp_block )
         block_Release( *pp_block );
         return NULL;
     }
-
-    if( (*pp_block)->i_flags&BLOCK_FLAG_DISCONTINUITY )
+    if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
     {
         p_sys->i_state = STATE_NOSYNC;
+        block_Release( *pp_block );
+        return NULL;
     }
 
     block_BytestreamPush( &p_sys->bytestream, *pp_block );
index a5930d9..c5b3839 100644 (file)
@@ -224,7 +224,7 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
 
     if( pp_block == NULL || *pp_block == NULL ) return NULL;
 
-    if( (*pp_block)->i_flags & BLOCK_FLAG_DISCONTINUITY )
+    if( (*pp_block)->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
     {
         p_sys->i_state = STATE_NOSYNC;
         if( p_sys->p_frame ) block_ChainRelease( p_sys->p_frame );
index 449dfc1..4511ef1 100644 (file)
@@ -194,12 +194,7 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
     if( pp_block == NULL || *pp_block == NULL )
         return NULL;
 
-    if( (*pp_block)->i_flags & BLOCK_FLAG_DISCONTINUITY )
-    {
-        block_Release( *pp_block );
-        return NULL;
-    }
-    if( (*pp_block)->i_flags & BLOCK_FLAG_CORRUPTED )
+    if( (*pp_block)->i_flags & (BLOCK_FLAG_CORRUPTED|BLOCK_FLAG_DISCONTINUITY) )
     {
         p_sys->i_state = STATE_NOSYNC;
         if( p_sys->p_frame )