ffmpeg/avframe-queue: Unreference frames that may have a ref-counted obj

This commit is contained in:
Michael Fabian 'Xaymar' Dirks
2019-07-24 21:22:35 +02:00
parent 24bc913f53
commit 97a68404c0
+7 -5
View File
@@ -24,11 +24,13 @@
std::shared_ptr<AVFrame> ffmpeg::avframe_queue::create_frame() std::shared_ptr<AVFrame> ffmpeg::avframe_queue::create_frame()
{ {
std::shared_ptr<AVFrame> frame = std::shared_ptr<AVFrame> frame = std::shared_ptr<AVFrame>(av_frame_alloc(), [](AVFrame* frame) {
std::shared_ptr<AVFrame>(av_frame_alloc(), [](AVFrame* frame) { av_frame_free(&frame); }); av_frame_unref(frame);
frame->width = this->resolution.first; av_frame_free(&frame);
frame->height = this->resolution.second; });
frame->format = this->format; frame->width = this->resolution.first;
frame->height = this->resolution.second;
frame->format = this->format;
int res = av_frame_get_buffer(frame.get(), 32); int res = av_frame_get_buffer(frame.get(), 32);
if (res < 0) { if (res < 0) {