Free up hwFrame, preventing memleak

This commit is contained in:
Isaac Connor 2019-07-17 10:06:30 -04:00
parent 52e7cde66d
commit ef9fe2dbd6
1 changed files with 11 additions and 0 deletions

View File

@ -137,6 +137,7 @@ FfmpegCamera::FfmpegCamera(
hwaccel = false;
hwFrame = NULL;
hw_device_ctx = NULL;
mFormatContext = NULL;
mVideoStreamId = -1;
@ -648,6 +649,10 @@ int FfmpegCamera::Close() {
av_frame_free(&mRawFrame);
mRawFrame = NULL;
}
if ( hwFrame ) {
av_frame_free(&hwFrame);
hwFrame = NULL;
}
#if HAVE_LIBSWSCALE
if ( mConvertContext ) {
@ -675,6 +680,12 @@ int FfmpegCamera::Close() {
#endif
mAudioCodecContext = NULL; // Freed by av_close_input_file
}
#if 0
if ( hw_device_ctx ) {
hwdevice_ctx_free
}
#endif
if ( mFormatContext ) {
#if !LIBAVFORMAT_VERSION_CHECK(53, 17, 0, 25, 0)