diff mbox series

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

Message ID AM7PR03MB6660DDE65721AB806113D6438F2C9@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit e1edfe641609b08288090b77dc439861f75df5ea
Headers show
Series [FFmpeg-devel,1/6] avcodec/pthread_frame: Don't prematurily presume frame-threading | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished
andriy/make_aarch64_jetson success Make finished
andriy/make_fate_aarch64_jetson success Make fate finished
andriy/make_armv7_RPi4 success Make finished
andriy/make_fate_armv7_RPi4 success Make fate finished

Commit Message

Andreas Rheinhardt Feb. 7, 2022, 12:58 a.m. UTC
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@outlook.com>
---
 libavcodec/pthread_frame.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

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)