修复内存泄露
This commit is contained in:
parent
4d82e2b0a5
commit
5e794cf825
@ -61,7 +61,8 @@ bool MediaQueue<T>::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--;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user