Signed-off-by: Paul B Mahol <one...@gmail.com>
---
 libavcodec/pngdec.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 61642b7cbe..f0e2a0cad4 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -1090,8 +1090,8 @@ static int handle_p_frame_apng(AVCodecContext *avctx, 
PNGDecContext *s,
 
 
     // Do the disposal operation specified by the last frame on the frame
+    ff_thread_await_progress(&s->last_picture, INT_MAX, 0);
     if (s->last_dispose_op != APNG_DISPOSE_OP_PREVIOUS) {
-        ff_thread_await_progress(&s->last_picture, INT_MAX, 0);
         memcpy(buffer, s->last_picture.f->data[0], s->image_linesize * 
s->height);
 
         if (s->last_dispose_op == APNG_DISPOSE_OP_BACKGROUND)
@@ -1101,8 +1101,7 @@ static int handle_p_frame_apng(AVCodecContext *avctx, 
PNGDecContext *s,
         memcpy(s->previous_picture.f->data[0], buffer, s->image_linesize * 
s->height);
         ff_thread_report_progress(&s->previous_picture, INT_MAX, 0);
     } else {
-        ff_thread_await_progress(&s->previous_picture, INT_MAX, 0);
-        memcpy(buffer, s->previous_picture.f->data[0], s->image_linesize * 
s->height);
+        memcpy(buffer, s->last_picture.f->data[0], s->image_linesize * 
s->height);
     }
 
     // Perform blending
-- 
2.17.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to