[FFmpeg-cvslog] pthread_frame: Unreference hw_frames_ctx on per-thread codec contexts

Mark Thompson git at videolan.org
Fri Mar 31 21:53:44 EEST 2017


ffmpeg | branch: master | Mark Thompson <sw at jkqxz.net> | Thu Nov  3 00:13:35 2016 +0000| [fd0fae60372cddbe0bec8830d07e760195f80bad] | committer: Mark Thompson

pthread_frame: Unreference hw_frames_ctx on per-thread codec contexts

When decoding with threads enabled, the get_format callback will be
called with one of the per-thread codec contexts rather than with the
outer context.  If a hwaccel is in use too, this will add a reference
to the hardware frames context on that codec context, which will then
propagate to all of the other per-thread contexts for decoding.  Once
the decoder finishes, however, the per-thread contexts are not freed
normally, so these references leak.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fd0fae60372cddbe0bec8830d07e760195f80bad
---

 libavcodec/pthread_frame.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 671c551..2736a81 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -571,6 +571,8 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
             av_freep(&p->avctx->slice_offset);
         }
 
+        av_buffer_unref(&p->avctx->hw_frames_ctx);
+
         av_freep(&p->avctx->internal);
         av_freep(&p->avctx);
     }



More information about the ffmpeg-cvslog mailing list