[vlc-commits] packetizer: h264: handle secondary drain
Francois Cartegnie
git at videolan.org
Fri Oct 11 17:28:33 CEST 2019
vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Sep 25 11:25:16 2019 +0200| [8920c0068fa8e32250772065b9541641ea2e4744] | committer: Francois Cartegnie
packetizer: h264: handle secondary drain
(cherry picked from commit 691578d410deac8ad89f331df5bb34a5db661eba)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=8920c0068fa8e32250772065b9541641ea2e4744
---
modules/packetizer/h264.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index b9a4597b7f..52043942d0 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -145,6 +145,7 @@ static void PacketizeFlush( decoder_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 *ParseNALBlock( decoder_t *, bool *pb_ts_used, block_t * );
@@ -334,7 +335,7 @@ static int Open( vlc_object_t *p_this )
packetizer_Init( &p_sys->packetizer,
p_h264_startcode, sizeof(p_h264_startcode), startcode_FindAnnexB,
p_h264_startcode, 1, 5,
- PacketizeReset, PacketizeParse, PacketizeValidate, NULL,
+ PacketizeReset, PacketizeParse, PacketizeValidate, PacketizeDrain,
p_dec );
p_sys->b_slice = false;
@@ -577,6 +578,24 @@ static int PacketizeValidate( void *p_private, block_t *p_au )
return VLC_SUCCESS;
}
+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_slice )
+ return NULL;
+
+ block_t *p_out = OutputPicture( p_dec );
+ if( p_out && (p_out->i_flags & BLOCK_FLAG_DROP) )
+ {
+ block_Release( p_out );
+ p_out = NULL;
+ }
+
+ return p_out;
+}
+
/*****************************************************************************
* ParseNALBlock: parses annexB type NALs
* All p_frag blocks are required to start with 0 0 0 1 4-byte startcode
More information about the vlc-commits
mailing list