From a1648508a66c1ddfd026d1e2bafb19a75ea990db Mon Sep 17 00:00:00 2001 From: CorthiClem Date: Tue, 26 Dec 2023 21:56:20 +0100 Subject: [PATCH 1/4] Fixed broken faststart when postprocessing AV1 recordings --- src/postprocessing/pp-av1.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/postprocessing/pp-av1.c b/src/postprocessing/pp-av1.c index 35f9f8a6f3..a3a04bb9bd 100644 --- a/src/postprocessing/pp-av1.c +++ b/src/postprocessing/pp-av1.c @@ -55,6 +55,10 @@ int janus_pp_av1_create(char *destination, char *metadata, gboolean faststart, c return -1; } + char filename[1024]; + snprintf(filename, sizeof(filename), "%s", destination); + fctx->url = g_strdup(filename); + vStream = janus_pp_new_video_avstream(fctx, AV_CODEC_ID_AV1, max_width, max_height); if(vStream == NULL) { JANUS_LOG(LOG_ERR, "Error adding stream\n"); From 6cb51bfb0536efcc34c61d1c5ac04d8d3cc1c4fb Mon Sep 17 00:00:00 2001 From: CorthiClem Date: Tue, 9 Jan 2024 19:38:33 +0100 Subject: [PATCH 2/4] Removed useless filename --- src/postprocessing/pp-av1.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/postprocessing/pp-av1.c b/src/postprocessing/pp-av1.c index a3a04bb9bd..33ab261888 100644 --- a/src/postprocessing/pp-av1.c +++ b/src/postprocessing/pp-av1.c @@ -55,9 +55,7 @@ int janus_pp_av1_create(char *destination, char *metadata, gboolean faststart, c return -1; } - char filename[1024]; - snprintf(filename, sizeof(filename), "%s", destination); - fctx->url = g_strdup(filename); + fctx->url = g_strdup(destination); vStream = janus_pp_new_video_avstream(fctx, AV_CODEC_ID_AV1, max_width, max_height); if(vStream == NULL) { From 1386b2c8645d2c1e3944c3859d970923d73158d5 Mon Sep 17 00:00:00 2001 From: CorthiClem Date: Mon, 22 Jan 2024 10:24:36 +0100 Subject: [PATCH 3/4] Added missing g_free --- src/postprocessing/pp-av1.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/postprocessing/pp-av1.c b/src/postprocessing/pp-av1.c index 33ab261888..c60c9774cf 100644 --- a/src/postprocessing/pp-av1.c +++ b/src/postprocessing/pp-av1.c @@ -529,5 +529,6 @@ void janus_pp_av1_close(void) { av_write_trailer(fctx); avio_close(fctx->pb); avformat_free_context(fctx); + g_free(fctx->url); } } From fe0a698f3f94831cc4e326c9650bd128c8904a84 Mon Sep 17 00:00:00 2001 From: CorthiClem Date: Mon, 22 Jan 2024 10:39:18 +0100 Subject: [PATCH 4/4] Set url to null --- src/postprocessing/pp-av1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/postprocessing/pp-av1.c b/src/postprocessing/pp-av1.c index c60c9774cf..bfb6b983d0 100644 --- a/src/postprocessing/pp-av1.c +++ b/src/postprocessing/pp-av1.c @@ -528,7 +528,8 @@ void janus_pp_av1_close(void) { if(fctx != NULL) { av_write_trailer(fctx); avio_close(fctx->pb); - avformat_free_context(fctx); g_free(fctx->url); + fctx->url = NULL; + avformat_free_context(fctx); } }