[vlc-devel] [PATCH] avcodec: check return of avcodec_send_packet/avcodec_receive_frame

Rémi Denis-Courmont remi at remlab.net
Wed Sep 7 13:06:25 CEST 2016


I don't know if this is right, but it does not address my regression

Le mercredi 7 septembre 2016, 12:36:00 Thomas Guillem a écrit :
> Don't treat EAGAIN as an error
> ---
>  modules/codec/avcodec/video.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
> index f236224..dd35dff 100644
> --- a/modules/codec/avcodec/video.c
> +++ b/modules/codec/avcodec/video.c
> @@ -833,11 +833,23 @@ static picture_t *DecodeVideo( decoder_t *p_dec,
> block_t **pp_block ) p_block->i_dts = VLC_TS_INVALID;
>          }
> 
> -        int not_able_to_send_packet = avcodec_send_packet( p_context, &pkt
> ); +        int ret = avcodec_send_packet( p_context, &pkt );
>          i_used = pkt.size;
>          av_packet_unref( &pkt );
> 
> -        int not_received_frame = avcodec_receive_frame( p_context, frame);
> +        if( ret != 0 && ret != AVERROR(EAGAIN) )
> +        {
> +            p_dec->b_error = true;
> +            break;
> +        }
> +
> +        ret = avcodec_receive_frame( p_context, frame);
> +        if( ret != 0 && ret != AVERROR(EAGAIN) )
> +        {
> +            p_dec->b_error = true;
> +            break;
> +        }
> +        int not_received_frame = ret;
> 
>          wait_mt( p_sys );

-- 
Rémi Denis-Courmont
http://www.remlab.net/



More information about the vlc-devel mailing list