[vlc-commits] avcodec: don't try recover from align issue

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


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

avcodec: don't try recover from align issue

It's unlikely to recover. This saves a pair of picture new/release
in error case.

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

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

 modules/codec/avcodec/video.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index a4fc843e9f..cdc63a5083 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -1401,6 +1401,9 @@ static int lavc_dr_GetFrame(struct AVCodecContext *ctx, AVFrame *frame)
     decoder_t *dec = ctx->opaque;
     decoder_sys_t *sys = dec->p_sys;
 
+    if (sys->b_dr_failure)
+        return -1;
+
     if (ctx->pix_fmt == AV_PIX_FMT_PAL8)
         return -1;
 
@@ -1422,16 +1425,14 @@ static int lavc_dr_GetFrame(struct AVCodecContext *ctx, AVFrame *frame)
     {
         if (pic->p[i].i_pitch % aligns[i])
         {
-            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]);
+            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 (sys->b_dr_failure == false)
-                msg_Warn(dec, "plane %d not aligned: disabling direct rendering", i);
+            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