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

Laurent Aimar fenrir at elivagar.org
Mon Jul 18 13:53:13 CEST 2011


Hi,

On Fri, Jul 15, 2011 at 10:30:08PM -0400, Rafaël Carré wrote:
> There might be a buffer still stored in packetizer buffers
> 
> refs: #3178
> ---
>  src/input/decoder.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/src/input/decoder.c b/src/input/decoder.c
> index bf09978..fb274e0 100644
> --- a/src/input/decoder.c
> +++ b/src/input/decoder.c
> @@ -352,6 +352,10 @@ void input_DecoderDelete( decoder_t *p_dec )
>  
>      vlc_cancel( p_owner->thread );
>  
> +    /* process last packet */
> +    if( !p_dec->b_error )
> +        DecoderProcess( p_dec, NULL );
> +
>      /* Make sure we aren't paused/buffering/waiting/decoding anymore */
>      vlc_mutex_lock( &p_owner->lock );
>      const bool b_was_paused = p_owner->b_paused;
 It's not valid as the thread can still be running after
vlc_cancel() (and before vlc_join()).

 Now, always calling DecoderProcess() when stopping an encoder is also
not acceptable because it will make it slower. It is wanted when playing
a file up to EOF, but it is not wanted at all when switching audio/subs track
or when stopping on an user request.
 Also, I am not sure if it is safe to call DecoderProcess() outside the
decoder thread.

 I don't think you can avoid changing/extending decoders/es_out/input
communications to do it cleanly.

-- 
fenrir



More information about the vlc-devel mailing list