[vlc-commits] packetizer: don't drop blocks with DISCONTINUITY

Ilkka Ollakka git at videolan.org
Tue Oct 13 07:21:00 CEST 2015


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Sat Sep 19 18:00:41 2015 +0300| [a901a7884c49b4980a956d050a3866baf1e8eb5b] | committer: Ilkka Ollakka

packetizer: don't drop blocks with DISCONTINUITY

Do not drop blocks with BLOCK_FLAG_DISCONTINUITY, but do drop blocks with BLOCK_FLAG_CORRUPTED.

Signed-off-by: Jean-Paul Saman <jpsaman at videolan.org>

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

 modules/packetizer/avparser.c          |    2 +-
 modules/packetizer/copy.c              |    4 ++--
 modules/packetizer/flac.c              |    8 ++++----
 modules/packetizer/h264.c              |    2 +-
 modules/packetizer/mlp.c               |   14 +++++++-------
 modules/packetizer/mpeg4audio.c        |   22 ++++++++++++----------
 modules/packetizer/packetizer_helper.h |   13 ++++++-------
 7 files changed, 33 insertions(+), 32 deletions(-)

diff --git a/modules/packetizer/avparser.c b/modules/packetizer/avparser.c
index c5d2891..450b450 100644
--- a/modules/packetizer/avparser.c
+++ b/modules/packetizer/avparser.c
@@ -139,7 +139,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_FLAG_CORRUPTED) )
+    if( (*pp_block)->i_flags&(BLOCK_FLAG_CORRUPTED) )
     {
         block_Release( *pp_block );
         return NULL;
diff --git a/modules/packetizer/copy.c b/modules/packetizer/copy.c
index b5e0973..bc3a623 100644
--- a/modules/packetizer/copy.c
+++ b/modules/packetizer/copy.c
@@ -144,7 +144,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_FLAG_CORRUPTED) )
+    if( (*pp_block)->i_flags&(BLOCK_FLAG_CORRUPTED) )
     {
         block_Release( *pp_block );
         return NULL;
@@ -186,7 +186,7 @@ static block_t *PacketizeSub( 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_FLAG_CORRUPTED) )
+    if( (*pp_block)->i_flags&(BLOCK_FLAG_CORRUPTED) )
     {
         block_Release( *pp_block );
         return NULL;
diff --git a/modules/packetizer/flac.c b/modules/packetizer/flac.c
index e8e8298..4f5ee54 100644
--- a/modules/packetizer/flac.c
+++ b/modules/packetizer/flac.c
@@ -519,12 +519,12 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
         in = *pp_block;
 
         if (in->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED)) {
+            p_sys->i_state = STATE_NOSYNC;
+            block_BytestreamEmpty(&p_sys->bytestream);
             if (in->i_flags&BLOCK_FLAG_CORRUPTED) {
-                p_sys->i_state = STATE_NOSYNC;
-                block_BytestreamEmpty(&p_sys->bytestream);
+                block_Release(*pp_block);
+                return NULL;
             }
-            block_Release(*pp_block);
-            return NULL;
         }
     }
 
diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index 1a56440..c87a411 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -420,7 +420,7 @@ static block_t *PacketizeAVC1( 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) )
+    if( (*pp_block)->i_flags&(BLOCK_FLAG_CORRUPTED) )
     {
         block_Release( *pp_block );
         return NULL;
diff --git a/modules/packetizer/mlp.c b/modules/packetizer/mlp.c
index ffd57c4..ee35391 100644
--- a/modules/packetizer/mlp.c
+++ b/modules/packetizer/mlp.c
@@ -153,15 +153,15 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
     /* */
     if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
     {
-        if( (*pp_block)->i_flags&BLOCK_FLAG_CORRUPTED )
+        p_sys->b_mlp = false;
+        p_sys->i_state = STATE_NOSYNC;
+        block_BytestreamEmpty( &p_sys->bytestream );
+        date_Set( &p_sys->end_date, 0 );
+        if( (*pp_block)->i_flags&(BLOCK_FLAG_CORRUPTED) )
         {
-            p_sys->b_mlp = false;
-            p_sys->i_state = STATE_NOSYNC;
-            block_BytestreamEmpty( &p_sys->bytestream );
+            block_Release( *pp_block );
+            return NULL;
         }
-        date_Set( &p_sys->end_date, 0 );
-        block_Release( *pp_block );
-        return NULL;
     }
 
     if( !date_Get( &p_sys->end_date ) && !(*pp_block)->i_pts )
diff --git a/modules/packetizer/mpeg4audio.c b/modules/packetizer/mpeg4audio.c
index 3b660fb..e88e9bd 100644
--- a/modules/packetizer/mpeg4audio.c
+++ b/modules/packetizer/mpeg4audio.c
@@ -299,10 +299,12 @@ static block_t *PacketizeRawBlock(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)) {
+    if ((*pp_block)->i_flags & (BLOCK_FLAG_DISCONTINUITY | BLOCK_FLAG_CORRUPTED)) {
         date_Set(&p_sys->end_date, 0);
-        block_Release(*pp_block);
-        return NULL;
+        if ((*pp_block)->i_flags&(BLOCK_FLAG_CORRUPTED)) {
+            block_Release(*pp_block);
+            return NULL;
+        }
     }
 
     p_block = *pp_block;
@@ -942,14 +944,14 @@ static block_t *PacketizeStreamBlock(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)) {
-        if ((*pp_block)->i_flags&BLOCK_FLAG_CORRUPTED) {
-            p_sys->i_state = STATE_NOSYNC;
-            block_BytestreamEmpty(&p_sys->bytestream);
+    if ((*pp_block)->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED)) {
+        p_sys->i_state = STATE_NOSYNC;
+        block_BytestreamEmpty(&p_sys->bytestream);
+        date_Set(&p_sys->end_date, VLC_TS_INVALID);
+        if ((*pp_block)->i_flags & BLOCK_FLAG_CORRUPTED) {
+            block_Release(*pp_block);
+            return NULL;
         }
-        date_Set(&p_sys->end_date, 0);
-        block_Release(*pp_block);
-        return NULL;
     }
 
     if (!date_Get(&p_sys->end_date) && (*pp_block)->i_pts <= VLC_TS_INVALID) {
diff --git a/modules/packetizer/packetizer_helper.h b/modules/packetizer/packetizer_helper.h
index 33754b7..a6cc663 100644
--- a/modules/packetizer/packetizer_helper.h
+++ b/modules/packetizer/packetizer_helper.h
@@ -101,16 +101,15 @@ static inline block_t *packetizer_Packetize( packetizer_t *p_pack, block_t **pp_
     if( unlikely( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) ) )
     {
         const bool b_broken = ( (*pp_block)->i_flags&BLOCK_FLAG_CORRUPTED ) != 0;
+        p_pack->i_state = STATE_NOSYNC;
+        block_BytestreamEmpty( &p_pack->bytestream );
+        p_pack->i_offset = 0;
+        p_pack->pf_reset( p_pack->p_private, b_broken );
         if( b_broken )
         {
-            p_pack->i_state = STATE_NOSYNC;
-            block_BytestreamEmpty( &p_pack->bytestream );
-            p_pack->i_offset = 0;
+            block_Release( *pp_block );
+            return NULL;
         }
-        p_pack->pf_reset( p_pack->p_private, b_broken );
-
-        block_Release( *pp_block );
-        return NULL;
     }
 
     block_BytestreamPush( &p_pack->bytestream, *pp_block );



More information about the vlc-commits mailing list