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); } }