[vlc-commits] avcodec: use bool type for b_dr_failure

Zhao Zhili git at videolan.org
Mon Nov 2 16:47:32 CET 2020


vlc | branch: master | Zhao Zhili <quinkblack at foxmail.com> | Thu Oct  8 18:18:00 2020 +0200| [71af7f552ce2f3198c4a3acd4f34229dcef3a45a] | committer: Steve Lhomme

avcodec: use bool type for b_dr_failure

Since it's been protected by lock again.

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=71af7f552ce2f3198c4a3acd4f34229dcef3a45a
---

 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 6a30ef8400..a4fc843e9f 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;
         }
     }



More information about the vlc-commits mailing list