[vlc-devel] [PATCH 1/2] avcodec: use bool type for b_dr_failure

Steve Lhomme robux4 at ycbcr.xyz
Mon Nov 2 16:48:52 CET 2020


Merged both patches. Thanks.

On 2020-10-08 18:18, Zhao Zhili wrote:
> Since it's been protected by lock again.
> ---
>   modules/codec/avcodec/video.c | 10 ++++++----
>   1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
> index 89a216bf76..5633f41807 100644
> --- a/modules/codec/avcodec/video.c
> +++ b/modules/codec/avcodec/video.c
> @@ -92,7 +92,7 @@ typedef struct
>   
>       /* for direct rendering */
>       bool        b_direct_rendering;
> -    atomic_bool b_dr_failure;
> +    bool        b_dr_failure; /* Protected by lock */
>   
>       /* Hack to force display of still pictures */
>       bool b_first_frame;
> @@ -498,7 +498,7 @@ int InitVideoDec( vlc_object_t *obj )
>   
>       /* ***** libavcodec direct rendering ***** */
>       p_sys->b_direct_rendering = false;
> -    atomic_init(&p_sys->b_dr_failure, false);
> +    p_sys->b_dr_failure = false;
>       if( var_CreateGetBool( p_dec, "avcodec-dr" ) &&
>          (p_codec->capabilities & AV_CODEC_CAP_DR1) &&
>           /* No idea why ... but this fixes flickering on some TSCC streams */
> @@ -1422,15 +1422,17 @@ static int lavc_dr_GetFrame(struct AVCodecContext *ctx, AVFrame *frame)
>       {
>           if (pic->p[i].i_pitch % aligns[i])
>           {
> -            if (!atomic_exchange(&sys->b_dr_failure, true))
> +            if (sys->b_dr_failure == false)
>                   msg_Warn(dec, "plane %d: pitch not aligned (%d%%%d): disabling direct rendering",
>                            i, pic->p[i].i_pitch, aligns[i]);
> +            sys->b_dr_failure = true;
>               goto error;
>           }
>           if (((uintptr_t)pic->p[i].p_pixels) % aligns[i])
>           {
> -            if (!atomic_exchange(&sys->b_dr_failure, true))
> +            if (sys->b_dr_failure == false)
>                   msg_Warn(dec, "plane %d not aligned: disabling direct rendering", i);
> +            sys->b_dr_failure = true;
>               goto error;
>           }
>       }
> -- 
> 2.25.1
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> 


More information about the vlc-devel mailing list