[vlc-devel] [PATCH 3/3] packetizer:avparser: handle the BLOCK_FLAG_DISCONTINUITY

Steve Lhomme robux4 at videolabs.io
Tue Nov 17 10:18:13 CET 2015


reopen the packetizer object to reinit avparser
---
 modules/packetizer/avparser.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/modules/packetizer/avparser.c b/modules/packetizer/avparser.c
index 450b450..a79a79d 100644
--- a/modules/packetizer/avparser.c
+++ b/modules/packetizer/avparser.c
@@ -139,6 +139,16 @@ 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) )
+    {
+        /* reopen as there's no clean way to flush avparser */
+        ClosePacketizer( p_dec );
+        if ( OpenPacketizer( p_dec ) != VLC_SUCCESS )
+        {
+            block_Release( *pp_block );
+            return NULL;
+        }
+    }
     if( (*pp_block)->i_flags&(BLOCK_FLAG_CORRUPTED) )
     {
         block_Release( *pp_block );
-- 
2.6.2



More information about the vlc-devel mailing list