From 5e794cf825dc0a8fbe08ba6cd76ec58b31456e2c Mon Sep 17 00:00:00 2001 From: jie Date: Fri, 23 Feb 2024 10:32:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=86=85=E5=AD=98=E6=B3=84?= =?UTF-8?q?=E9=9C=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/decodeParam.h | 3 ++- src/mediaDecoder.cc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/decodeParam.h b/include/decodeParam.h index 6904682..9f3207f 100644 --- a/include/decodeParam.h +++ b/include/decodeParam.h @@ -61,7 +61,8 @@ bool MediaQueue::pop(T* item, bool block, bool quit) { if (av_frame_ref(item, temp) < 0) { return false; } - av_frame_unref(temp); + av_frame_free(&temp); + delete temp; } queue.pop(); count--; diff --git a/src/mediaDecoder.cc b/src/mediaDecoder.cc index 1670ab2..aa99756 100644 --- a/src/mediaDecoder.cc +++ b/src/mediaDecoder.cc @@ -70,7 +70,6 @@ void RequestVideoFrame(MediaParam& param) { const auto& fmtCtx = param.videoParam.fmtCtx; const auto& codecCtx = param.videoParam.codecCtx; const auto& videoStreamIndex = param.videoParam.videoStreamIndex; - AVPacket* packet = av_packet_alloc(); AVFrame* frame = av_frame_alloc(); while (true) { @@ -99,6 +98,7 @@ void RequestVideoFrame(MediaParam& param) { } param.videoParam.frameQueue.push(frame); av_frame_unref(frame); + av_packet_unref(packet); } }