[vlc-commits] demux: h26x: fix packetizer flushing

Francois Cartegnie git at videolan.org
Fri Feb 17 19:13:06 CET 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Feb 17 18:10:34 2017 +0100| [611dac2b16a0c62374afc00e940d39221274dcd6] | committer: Francois Cartegnie

demux: h26x: fix packetizer flushing

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

 modules/demux/mpeg/h26x.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/modules/demux/mpeg/h26x.c b/modules/demux/mpeg/h26x.c
index 25a6ca0..9c2992b 100644
--- a/modules/demux/mpeg/h26x.c
+++ b/modules/demux/mpeg/h26x.c
@@ -406,14 +406,16 @@ static int Demux( demux_t *p_demux)
 {
     demux_sys_t *p_sys = p_demux->p_sys;
     block_t *p_block_in, *p_block_out;
+    bool b_eof = false;
 
     p_block_in = vlc_stream_Block( p_demux->s, H26X_PACKET_SIZE );
     if( p_block_in == NULL )
     {
-        return VLC_DEMUXER_EOF;
+        b_eof = true;
     }
 
-    while( (p_block_out = p_sys->p_packetizer->pf_packetize( p_sys->p_packetizer, &p_block_in )) )
+    while( (p_block_out = p_sys->p_packetizer->pf_packetize( p_sys->p_packetizer,
+                                                             p_block_in ? &p_block_in : NULL )) )
     {
         while( p_block_out )
         {
@@ -421,8 +423,11 @@ static int Demux( demux_t *p_demux)
 
             p_block_out->p_next = NULL;
 
-            p_block_in->i_dts = date_Get( &p_sys->dts );
-            p_block_in->i_pts = VLC_TS_INVALID;
+            if( p_block_in )
+            {
+                p_block_in->i_dts = date_Get( &p_sys->dts );
+                p_block_in->i_pts = VLC_TS_INVALID;
+            }
 
             if( p_sys->p_es == NULL )
             {
@@ -466,7 +471,7 @@ static int Demux( demux_t *p_demux)
             p_block_out = p_next;
         }
     }
-    return VLC_DEMUXER_SUCCESS;
+    return (b_eof) ? VLC_DEMUXER_EOF : VLC_DEMUXER_SUCCESS;
 }
 
 /*****************************************************************************



More information about the vlc-commits mailing list