[vlc-devel] [PATCH 2/8] decoder: fail earlier if the category is unknown

Rémi Denis-Courmont remi at remlab.net
Wed Feb 8 20:17:30 CET 2017


Le keskiviikkona 8. helmikuuta 2017, 19.53.49 EET Thomas Guillem a écrit :
> ---
>  src/input/decoder.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/src/input/decoder.c b/src/input/decoder.c
> index a9a3bcdd14..bed21b3003 100644
> --- a/src/input/decoder.c
> +++ b/src/input/decoder.c
> @@ -1450,10 +1450,7 @@ static void DecoderProcess( decoder_t *p_dec, block_t
> *p_block ) case VIDEO_ES: DecoderProcessVideo( p_dec, p_block ); return;
> case AUDIO_ES: DecoderProcessAudio( p_dec, p_block ); return; case  
> SPU_ES: DecoderProcessSpu( p_dec, p_block ); return; -
> -        default:
> -            msg_Err( p_dec, "unknown ES format" );
> -            p_dec->b_error = true;
> +        default:       vlc_assert_unreachable();
>      }
> 
>  error:
> @@ -1740,6 +1737,10 @@ static decoder_t * CreateDecoder( vlc_object_t
> *p_parent, case SPU_ES:
>              p_dec->pf_queue_sub = DecoderQueueSpu;
>              break;
> +        default:
> +            msg_Err( p_dec, "unknown ES format" );
> +            UnloadDecoder( p_dec );
> +            return p_dec;
>      }
>      /* Copy ourself the input replay gain */
>      if( fmt->i_cat == AUDIO_ES )

OK, though I´d maybe improve the error message.

-- 
雷米‧德尼-库尔蒙
https://www.remlab.net/



More information about the vlc-devel mailing list