[vlc-devel] [PATCH] [RFC] decoder: flush the packtizer when we flush the decoders
Steve Lhomme
robux4 at videolabs.io
Tue Nov 17 08:52:31 CET 2015
Wrong code, fix incoming.
On Tue, Nov 17, 2015 at 8:48 AM, Steve Lhomme <robux4 at videolabs.io> wrote:
> Some packetizers may buffer some block_t, resulting in unneeded blocks
> when there's a discontinuity, eg when seeking.
>
> --
> Most packetizers already handle the BLOCK_FLAG_DISCONTINUITY, I'll submit
> patches for the others
> ---
> src/input/decoder.c | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
>
> diff --git a/src/input/decoder.c b/src/input/decoder.c
> index cacf7f2..64ec3a7 100644
> --- a/src/input/decoder.c
> +++ b/src/input/decoder.c
> @@ -705,6 +705,23 @@ static int DecoderPlaySout( decoder_t *p_dec, block_t *p_sout_block )
> return sout_InputSendBuffer( p_owner->p_sout_input, p_sout_block );
> }
>
> +static void FlushPacketizer( decoder_t *p_dec )
> +{
> + /* Flush the packetizer using the special flush block_t */
> + block_t *p_null = DecoderBlockFlushNew();
> + if( p_null )
> + {
> + block_t *p_sout_block = p_dec->pf_packetize( p_dec, &p_null );
> + while ( p_sout_block != NULL )
> + {
> + block_t *p_next = p_sout_block->p_next;
> + p_sout_block->p_next = NULL;
> + block_ChainRelease(p_sout_block);
> + p_sout_block = p_next;
> + }
> + }
> +}
> +
> /* This function process a block for sout
> */
> static void DecoderProcessSout( decoder_t *p_dec, block_t *p_block )
> @@ -950,6 +967,9 @@ static void DecoderProcessVideo( decoder_t *p_dec, block_t *p_block, bool b_flus
> block_t *p_packetized_block;
> decoder_t *p_packetizer = p_owner->p_packetizer;
>
> + if( b_flush )
> + FlushPacketizer( p_dec );
> +
> while( (p_packetized_block =
> p_packetizer->pf_packetize( p_packetizer, p_block ? &p_block : NULL )) )
> {
> @@ -1105,6 +1125,9 @@ static void DecoderProcessAudio( decoder_t *p_dec, block_t *p_block, bool b_flus
> block_t *p_packetized_block;
> decoder_t *p_packetizer = p_owner->p_packetizer;
>
> + if( b_flush )
> + FlushPacketizer( p_dec );
> +
> while( (p_packetized_block =
> p_packetizer->pf_packetize( p_packetizer, p_block ? &p_block : NULL )) )
> {
> --
> 2.6.2
>
More information about the vlc-devel
mailing list