[vlc-devel] [PATCH 1/3] decoder: process the last block when closing

Rafaël Carré rafael.carre at gmail.com
Tue Aug 2 15:43:49 CEST 2011


Le Tue, 02 Aug 2011 08:35:06 +0200,
Rémi Denis-Courmont <remi at remlab.net> a écrit :

> On Mon,  1 Aug 2011 23:17:36 -0400, Rafaël Carré
> <rafael.carre at gmail.com> wrote:
> > There might be a buffer still stored in packetizer buffers
> > refs: #3178
> > ---
> >  src/input/decoder.c        |   10 +++++++++-
> >  src/input/decoder.h        |    1 +
> >  src/input/es_out.c         |   14 ++++++++++++++
> >  src/input/input.c          |    1 +
> >  src/input/input_internal.h |    2 ++
> >  5 files changed, 27 insertions(+), 1 deletions(-)
> > 
> > diff --git a/src/input/decoder.c b/src/input/decoder.c
> > index 992ec9f..9f80efe 100644
> > --- a/src/input/decoder.c
> > +++ b/src/input/decoder.c
> > @@ -922,13 +922,21 @@ static void *DecoderThread( void *p_data )
> >      /* The decoder's main loop */
> >      for( ;; )
> >      {
> > +        bool eos = false;
> >          block_t *p_block = block_FifoGet( p_owner->p_fifo );
> >  
> >          /* Make sure there is no cancellation point other than this
> one^^.
> >           * If you need one, be sure to push cleanup of p_block. */
> >          DecoderSignalBuffering( p_dec, p_block == NULL );
> >  
> > -        if( p_block )
> > +        if( p_block && p_block->i_flags & BLOCK_FLAG_EOS )
> > +        {
> > +            eos = true;
> > +            block_Release( p_block );
> > +            p_block = NULL;
> > +        }
> 
> It might be better to not assume that the EOS block is empty? It
> could be useful later.

What do you have in mind?

If we receive a block with data AND EOS flag we'd have to call
DecoderProcess() twice, because calling DecoderProcess() with NULL
p_block means "no more data will ever come, gimme all the data you have
left".

We can't do that in one call because the packetizer could return 2
packets.

-- 
Rafaël Carré



More information about the vlc-devel mailing list