Skip to content

Instantly share code, notes, and snippets.

@kode54
Created October 3, 2025 22:47
Show Gist options
  • Save kode54/d24f9b58863aea121f58afad2ae877dd to your computer and use it in GitHub Desktop.
Save kode54/d24f9b58863aea121f58afad2ae877dd to your computer and use it in GitHub Desktop.
janus-gateway FFmpeg 8 patch
diff --git a/src/postprocessing/pp-g722.c b/src/postprocessing/pp-g722.c
index 116f1508..831eac94 100644
--- a/src/postprocessing/pp-g722.c
+++ b/src/postprocessing/pp-g722.c
@@ -239,9 +239,7 @@ int janus_pp_g722_process(FILE *file, janus_pp_frame_packet *list, int *working)
void janus_pp_g722_close(void) {
/* Close decoder */
- avcodec_close(dec_ctx);
- av_free(dec_ctx);
- dec_ctx = NULL;
+ avcodec_free_context(&dec_ctx);
/* Flush and close file */
if(wav_file != NULL) {
/* Update the header */
diff --git a/src/postprocessing/pp-h264.c b/src/postprocessing/pp-h264.c
index 63d68f2c..cae049d4 100644
--- a/src/postprocessing/pp-h264.c
+++ b/src/postprocessing/pp-h264.c
@@ -549,10 +549,10 @@ void janus_pp_h264_close(void) {
av_write_trailer(fctx);
#ifdef USE_CODECPAR
if(vEncoder != NULL)
- avcodec_close(vEncoder);
+ avcodec_free_context(&vEncoder);
#else
if(vStream != NULL && vStream->codec != NULL)
- avcodec_close(vStream->codec);
+ avcodec_free_context(&(vStream->codec));
#endif
avio_close(fctx->pb);
avformat_free_context(fctx);
diff --git a/src/postprocessing/pp-h265.c b/src/postprocessing/pp-h265.c
index eacdd5c5..a50e0ce1 100644
--- a/src/postprocessing/pp-h265.c
+++ b/src/postprocessing/pp-h265.c
@@ -638,10 +638,10 @@ void janus_pp_h265_close(void) {
av_write_trailer(fctx);
#ifdef USE_CODECPAR
if(vEncoder != NULL)
- avcodec_close(vEncoder);
+ avcodec_free_context(&vEncoder);
#else
if(vStream != NULL && vStream->codec != NULL)
- avcodec_close(vStream->codec);
+ avcodec_free_context(&(vStream->codec));
#endif
avio_close(fctx->pb);
avformat_free_context(fctx);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment