[vlc-devel] commit: Simplify and fix the block flag test in dirac packetizer. ( Laurent Aimar )

git version control git at videolan.org
Fri May 8 00:28:26 CEST 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Thu May  7 23:13:32 2009 +0200| [f7a8bc79b12a3f2a673d0b6a2a6bf4ef4b5e1d2d] | committer: Laurent Aimar 

Simplify and fix the block flag test in dirac packetizer.

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

 modules/packetizer/dirac.c |   29 +++++++++++++----------------
 1 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/modules/packetizer/dirac.c b/modules/packetizer/dirac.c
index 5376ceb..2737e3b 100644
--- a/modules/packetizer/dirac.c
+++ b/modules/packetizer/dirac.c
@@ -1230,21 +1230,11 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
     block_t *p_block = NULL;
     int i_flushing = 0;
 
-    while( pp_block && *pp_block )
+    if( pp_block && *pp_block )
     {
         p_block = *pp_block;
-        *pp_block = p_block->p_next;
-        p_block->p_next = NULL;
+        *pp_block = NULL;
 
-        if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
-        {
-            /* silently discard corruption sentinels,
-             * synchronizer will then discard affected data units.
-             * do not produce an EOS data unit as this is very
-             * disruptive to the stream (and may make a larger error). */
-            block_Release( p_block );
-            continue;
-        }
         if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
         {
             /* pre-emptively insert an EOS at a discontinuity, protects
@@ -1258,7 +1248,17 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
                  * duplicates get discarded in forming encapsulation unit */
             }
         }
-        block_BytestreamPush( &p_sys->bytestream, p_block );
+        else if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
+        {
+            /* silently discard corruption sentinels,
+             * synchronizer will then discard affected data units.
+             * do not produce an EOS data unit as this is very
+             * disruptive to the stream (and may make a larger error). */
+            block_Release( p_block );
+            p_block = NULL;
+        }
+        if( p_block )
+            block_BytestreamPush( &p_sys->bytestream, p_block );
     }
 
     /* form as many encapsulation units as possible, give up
@@ -1438,9 +1438,6 @@ static void Close( vlc_object_t *p_this )
     decoder_t     *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys = p_dec->p_sys;
 
-    if( !p_sys )
-        return;
-
     block_BytestreamRelease( &p_sys->bytestream );
     if( p_sys->p_outqueue )
         block_ChainRelease( p_sys->p_outqueue );




More information about the vlc-devel mailing list