diff mbox series

[FFmpeg-devel,1/2] lavc/pngdec: fix updating reference frames for APNG_DISPOSE_OP_BACKGROUND

Message ID 20210508111303.27757-1-anton@khirnov.net
State Accepted
Commit aa726eaed9848bcf6f615d2d9e6e5dd6174ad570
Headers show
Series [FFmpeg-devel,1/2] lavc/pngdec: fix updating reference frames for APNG_DISPOSE_OP_BACKGROUND
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Anton Khirnov May 8, 2021, 11:13 a.m. UTC
They should be treated the same as APNG_DISPOSE_OP_NONE.

Broken in 5663301560.

Fixes #9184.
---
 libavcodec/pngdec.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index f2e6f689b0..16c4c3a283 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -1622,7 +1622,7 @@  static int decode_frame_apng(AVCodecContext *avctx,
     if (!(avctx->active_thread_type & FF_THREAD_FRAME)) {
         if (s->dispose_op == APNG_DISPOSE_OP_PREVIOUS) {
             ff_thread_release_buffer(avctx, &s->picture);
-        } else if (s->dispose_op == APNG_DISPOSE_OP_NONE) {
+        } else {
             ff_thread_release_buffer(avctx, &s->last_picture);
             FFSWAP(ThreadFrame, s->picture, s->last_picture);
         }
@@ -1671,8 +1671,8 @@  static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
         pdst->hdr_state |= psrc->hdr_state;
     }
 
-    src_frame = psrc->dispose_op == APNG_DISPOSE_OP_NONE ?
-                &psrc->picture : &psrc->last_picture;
+    src_frame = psrc->dispose_op == APNG_DISPOSE_OP_PREVIOUS ?
+                &psrc->last_picture : &psrc->picture;
 
     ff_thread_release_buffer(dst, &pdst->last_picture);
     if (src_frame && src_frame->f->data[0]) {