[vlc-commits] packetizer: mpegvideo: perform secondary drain

Francois Cartegnie git at videolan.org
Thu Sep 26 12:16:27 CEST 2019


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Sep 26 11:02:35 2019 +0200| [873a6bc6b274043791d4e1d92ac24fc165a9ba34] | committer: Francois Cartegnie

packetizer: mpegvideo: perform secondary drain

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

 modules/packetizer/mpegvideo.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/modules/packetizer/mpegvideo.c b/modules/packetizer/mpegvideo.c
index 547a1d337e..4c97b89884 100644
--- a/modules/packetizer/mpegvideo.c
+++ b/modules/packetizer/mpegvideo.c
@@ -182,6 +182,7 @@ static block_t *GetCc( decoder_t *p_dec, decoder_cc_desc_t * );
 static void PacketizeReset( void *p_private, bool b_broken );
 static block_t *PacketizeParse( void *p_private, bool *pb_ts_used, block_t * );
 static int PacketizeValidate( void *p_private, block_t * );
+static block_t * PacketizeDrain( void *p_private );
 
 static block_t *ParseMPEGBlock( decoder_t *, block_t * );
 
@@ -211,7 +212,7 @@ static int Open( vlc_object_t *p_this )
     packetizer_Init( &p_sys->packetizer,
                      p_mp2v_startcode, sizeof(p_mp2v_startcode), startcode_FindAnnexB,
                      NULL, 0, 4,
-                     PacketizeReset, PacketizeParse, PacketizeValidate, NULL,
+                     PacketizeReset, PacketizeParse, PacketizeValidate, PacketizeDrain,
                      p_dec );
 
     p_sys->p_seq = NULL;
@@ -603,6 +604,23 @@ static block_t *PacketizeParse( void *p_private, bool *pb_ts_used, block_t *p_bl
     return p_block;
 }
 
+static block_t * PacketizeDrain( void *p_private )
+{
+    decoder_t *p_dec = p_private;
+    decoder_sys_t *p_sys = p_dec->p_sys;
+
+    if( p_sys->b_waiting_iframe || !p_sys->b_frame_slice )
+        return NULL;
+
+    block_t *p_out = OutputFrame( p_dec );
+    if( p_out )
+    {
+        p_out->i_flags |= p_sys->i_next_block_flags;
+        p_sys->i_next_block_flags = 0;
+    }
+
+    return p_out;
+}
 
 static int PacketizeValidate( void *p_private, block_t *p_au )
 {



More information about the vlc-commits mailing list