From 91414b4fcef944765507112583787b887dd62966 Mon Sep 17 00:00:00 2001 From: tux3 Date: Thu, 16 Feb 2017 03:51:42 +0100 Subject: [PATCH] fix: Remove unnecessary calls to av_frame_unref If we immediately free it, the refcount goes to zero! --- src/video/videoframe.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/video/videoframe.cpp b/src/video/videoframe.cpp index d6d12c047..81bbf8ce9 100644 --- a/src/video/videoframe.cpp +++ b/src/video/videoframe.cpp @@ -599,7 +599,9 @@ AVFrame* VideoFrame::generateAVFrame(const QSize& dimensions, const int pixelFor if (!swsCtx) { av_freep(&ret->data[0]); +#if LIBAVCODEC_VERSION_INT < 3747941 av_frame_unref(ret); +#endif av_frame_free(&ret); return nullptr; } @@ -645,7 +647,9 @@ AVFrame* VideoFrame::storeAVFrame(AVFrame* frame, const QSize& dimensions, const // Free new frame av_freep(&frame->data[0]); +#if LIBAVCODEC_VERSION_INT < 3747941 av_frame_unref(frame); +#endif av_frame_free(&frame); return old_ret; @@ -676,11 +680,15 @@ void VideoFrame::deleteFrameBuffer() if (freeSourceFrame) { av_freep(&frame->data[0]); } +#if LIBAVCODEC_VERSION_INT < 3747941 av_frame_unref(frame); +#endif av_frame_free(&frame); } else { av_freep(&frame->data[0]); +#if LIBAVCODEC_VERSION_INT < 3747941 av_frame_unref(frame); +#endif av_frame_free(&frame); } }