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 and then use it
for decoding.  Once the decoder finishes, however, the per-thread
context is not freed normally, so this reference leaks.
---
I assume there is a good reason why the per-thread contexts are not freed 
normally with avcodec_free_context()?

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

diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 210ee69..a71035a 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -560,6 +560,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);
     }
-- 
2.10.1

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

Reply via email to