From f3db15b2824e67de849d3c96016576bd18756975 Mon Sep 17 00:00:00 2001 From: radius Date: Tue, 18 Sep 2018 00:34:25 -0500 Subject: [PATCH 1/2] [record] further cleanups of the workflow --- record/drivers/record_ffmpeg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/record/drivers/record_ffmpeg.c b/record/drivers/record_ffmpeg.c index 9763ceee7b..79c39ee228 100644 --- a/record/drivers/record_ffmpeg.c +++ b/record/drivers/record_ffmpeg.c @@ -1375,6 +1375,7 @@ static bool ffmpeg_finalize(void *data) /* Write final data. */ av_write_trailer(handle->muxer.ctx); + avio_close(&ctx->pb); return true; } From 5a1bfe2cfde0dbdf98781e0fbaab5ef4d4b85cd4 Mon Sep 17 00:00:00 2001 From: radius Date: Tue, 18 Sep 2018 00:43:19 -0500 Subject: [PATCH 2/2] [record] release file handles --- record/drivers/record_ffmpeg.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/record/drivers/record_ffmpeg.c b/record/drivers/record_ffmpeg.c index 79c39ee228..397e40b846 100644 --- a/record/drivers/record_ffmpeg.c +++ b/record/drivers/record_ffmpeg.c @@ -227,6 +227,8 @@ typedef struct ffmpeg volatile bool can_sleep; } ffmpeg_t; +AVFormatContext *ctx; + static bool ffmpeg_codec_has_sample_format(enum AVSampleFormat fmt, const enum AVSampleFormat *fmts) { @@ -617,8 +619,7 @@ static bool ffmpeg_init_config(struct ff_config_param *params, static bool ffmpeg_init_muxer_pre(ffmpeg_t *handle) { - AVFormatContext *ctx = avformat_alloc_context(); - + ctx = avformat_alloc_context(); av_strlcpy(ctx->filename, handle->params.filename, sizeof(ctx->filename)); if (*handle->config.format) @@ -1362,7 +1363,6 @@ static void ffmpeg_flush_buffers(ffmpeg_t *handle) static bool ffmpeg_finalize(void *data) { ffmpeg_t *handle = (ffmpeg_t*)data; - if (!handle) return false; @@ -1375,7 +1375,8 @@ static bool ffmpeg_finalize(void *data) /* Write final data. */ av_write_trailer(handle->muxer.ctx); - avio_close(&ctx->pb); + + avio_close(ctx->pb); return true; }