Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
fix: Remove unnecessary calls to av_frame_unref
Browse files Browse the repository at this point in the history
If we immediately free it, the refcount goes to zero!
  • Loading branch information
tux3 authored and Diadlo committed Mar 20, 2017
1 parent 9674bff commit 91414b4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/video/videoframe.cpp
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 91414b4

Please sign in to comment.