[vlc-devel] [PATCH] demux: don't drain packetizers midstream

Thomas Guillem thomas at gllm.fr
Fri Dec 20 11:38:07 CET 2019


cf. pf_packetize documentation on vlc_codec.h

This should not have any incidences since packetizers modules can be drained
and feed again.
---
 modules/demux/mpeg/es.c   | 3 ++-
 modules/demux/mpeg/h26x.c | 3 ++-
 modules/demux/mpeg/mpgv.c | 3 ++-
 modules/demux/vc1.c       | 3 ++-
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/modules/demux/mpeg/es.c b/modules/demux/mpeg/es.c
index 6a58e7dcc06..0b550173d64 100644
--- a/modules/demux/mpeg/es.c
+++ b/modules/demux/mpeg/es.c
@@ -655,7 +655,8 @@ static bool Parse( demux_t *p_demux, block_t **pp_output )
     }
     p_sys->b_initial_sync_failed = p_sys->b_start; /* Only try to resync once */
 
-    while( ( p_block_out = p_sys->p_packetizer->pf_packetize( p_sys->p_packetizer, p_block_in ? &p_block_in : NULL ) ) )
+    block_t **pp_block_in = p_block_in ? &p_block_in : NULL;
+    while( ( p_block_out = p_sys->p_packetizer->pf_packetize( p_sys->p_packetizer, pp_block_in ) ) )
     {
         p_sys->b_initial_sync_failed = false;
         while( p_block_out )
diff --git a/modules/demux/mpeg/h26x.c b/modules/demux/mpeg/h26x.c
index bf0be713950..6ca17766fac 100644
--- a/modules/demux/mpeg/h26x.c
+++ b/modules/demux/mpeg/h26x.c
@@ -425,8 +425,9 @@ static int Demux( demux_t *p_demux)
         p_block_in->i_dts = date_Get( &p_sys->dts );
     }
 
+    block_t **pp_block_in = p_block_in ? &p_block_in : NULL;
     while( (p_block_out = p_sys->p_packetizer->pf_packetize( p_sys->p_packetizer,
-                                                             p_block_in ? &p_block_in : NULL )) )
+                                                             pp_block_in ) ) )
     {
         while( p_block_out )
         {
diff --git a/modules/demux/mpeg/mpgv.c b/modules/demux/mpeg/mpgv.c
index 234235e1430..a8c9f084787 100644
--- a/modules/demux/mpeg/mpgv.c
+++ b/modules/demux/mpeg/mpgv.c
@@ -179,8 +179,9 @@ static int Demux( demux_t *p_demux )
         p_block_in->i_dts = ( p_sys->b_start ) ? VLC_TICK_0 : VLC_TICK_INVALID;
     }
 
+    block_t **pp_block_in = p_block_in ? &p_block_in : NULL;
     while( (p_block_out = p_sys->p_packetizer->pf_packetize( p_sys->p_packetizer,
-                                                             p_block_in ? &p_block_in : NULL )) )
+                                                             pp_block_in ) ) )
     {
         p_sys->b_start = false;
 
diff --git a/modules/demux/vc1.c b/modules/demux/vc1.c
index 6cdbf409935..e631963ce6b 100644
--- a/modules/demux/vc1.c
+++ b/modules/demux/vc1.c
@@ -154,8 +154,9 @@ static int Demux( demux_t *p_demux)
         p_block_in->i_pts = p_block_in->i_dts;
     }
 
+    block_t **pp_block_in = p_block_in ? &p_block_in : NULL;
     while( (p_block_out = p_sys->p_packetizer->pf_packetize( p_sys->p_packetizer,
-                                                             p_block_in ? &p_block_in : NULL )) )
+                                                             pp_block_in ) ) )
     {
         while( p_block_out )
         {
-- 
2.20.1



More information about the vlc-devel mailing list