Fix memory leak with AVPacket, OpenCL logs
This commit is contained in:
parent
efe6b4ff18
commit
cac72a0cdf
2 changed files with 5 additions and 0 deletions
|
@ -11,6 +11,7 @@ OpenCLContext::Ptr OpenCLContext::instance_ = {};
|
|||
OpenCLContext::OpenCLHandle::OpenCLHandle() : opencl_ptr_(), kernels_() {}
|
||||
|
||||
OpenCLContext::OpenCLHandle::~OpenCLHandle() {
|
||||
std::cout << "Destructing OpenCLHandle..." << std::endl;
|
||||
CleanupAllKernels();
|
||||
OpenCLContext::CleanupInstance();
|
||||
}
|
||||
|
@ -769,6 +770,7 @@ OpenCLContext::OpenCLContext() : context_(nullptr), queue_(nullptr) {
|
|||
}
|
||||
|
||||
OpenCLContext::~OpenCLContext() {
|
||||
std::cout << "Destructing OpenCLContext..." << std::endl;
|
||||
if (queue_) {
|
||||
clReleaseCommandQueue(queue_);
|
||||
}
|
||||
|
|
|
@ -295,6 +295,7 @@ bool Video::DitherVideo(const std::string &output_filename, Image *blue_noise,
|
|||
avcodec_close(enc_codec_context);
|
||||
avformat_free_context(avf_enc_context);
|
||||
av_frame_free(&frame);
|
||||
av_packet_unref(pkt);
|
||||
av_packet_free(&pkt);
|
||||
avcodec_free_context(&codec_ctx);
|
||||
avformat_close_input(&avf_dec_context);
|
||||
|
@ -307,6 +308,7 @@ bool Video::DitherVideo(const std::string &output_filename, Image *blue_noise,
|
|||
avcodec_close(enc_codec_context);
|
||||
avformat_free_context(avf_enc_context);
|
||||
av_frame_free(&frame);
|
||||
av_packet_unref(pkt);
|
||||
av_packet_free(&pkt);
|
||||
avcodec_free_context(&codec_ctx);
|
||||
avformat_close_input(&avf_dec_context);
|
||||
|
@ -316,6 +318,7 @@ bool Video::DitherVideo(const std::string &output_filename, Image *blue_noise,
|
|||
}
|
||||
}
|
||||
}
|
||||
av_packet_unref(pkt);
|
||||
}
|
||||
|
||||
// flush decoders
|
||||
|
|
Loading…
Reference in a new issue