[FFmpeg-devel] [PATCH 6/6] avcodec/pthread_frame: Properly unref frame in case of decoding failure

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Mon Feb 7 02:58:08 EET 2022


Use ff_thread_release_buffer() instead of av_frame_unref(),
as the former handles the case of non-thread-safe callbacks
properly. (This is possible now that ff_thread_release_buffer()
no longer requires a ThreadFrame.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/pthread_frame.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 75b70a17ec..27ed0b2cc4 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -223,7 +223,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
             if (avctx->codec->caps_internal & FF_CODEC_CAP_ALLOCATE_PROGRESS)
                 av_log(avctx, AV_LOG_ERROR, "A frame threaded decoder did not "
                        "free the frame on failure. This is a bug, please report it.\n");
-            av_frame_unref(p->frame);
+            ff_thread_release_buffer(avctx, p->frame);
         }
 
         if (atomic_load(&p->state) == STATE_SETTING_UP)
-- 
2.32.0



More information about the ffmpeg-devel mailing list