From 19c5a6c769fe8cb0d77db48554594a2ddf030d39 Mon Sep 17 00:00:00 2001 From: igorshevach Date: Sun, 15 Sep 2024 22:31:39 +0300 Subject: [PATCH] fix order of events called; we must have rtmp_codec first --- nginx-rtmp-module/src/ngx_rtmp_codec_module.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nginx-rtmp-module/src/ngx_rtmp_codec_module.c b/nginx-rtmp-module/src/ngx_rtmp_codec_module.c index c4525dc7..5a71bef9 100644 --- a/nginx-rtmp-module/src/ngx_rtmp_codec_module.c +++ b/nginx-rtmp-module/src/ngx_rtmp_codec_module.c @@ -1456,6 +1456,7 @@ ngx_rtmp_codec_postconfiguration(ngx_conf_t *cf) ngx_rtmp_core_main_conf_t *cmcf; ngx_rtmp_handler_pt *h; ngx_rtmp_amf_handler_t *ch; + ngx_uint_t nelts; cmcf = ngx_rtmp_conf_get_module_main_conf(cf, ngx_rtmp_core_module); @@ -1464,6 +1465,11 @@ ngx_rtmp_codec_postconfiguration(ngx_conf_t *cf) return NGX_ERROR; } + nelts = cmcf->events[NGX_RTMP_MSG_AUDIO].nelts; + for(;nelts > 1;nelts--, h--) { + *h = h[-1]; + } + *h = ngx_rtmp_codec_av; h = ngx_array_push(&cmcf->events[NGX_RTMP_MSG_VIDEO]); @@ -1471,6 +1477,11 @@ ngx_rtmp_codec_postconfiguration(ngx_conf_t *cf) return NGX_ERROR; } + nelts = cmcf->events[NGX_RTMP_MSG_VIDEO].nelts; + for(;nelts > 1;nelts--, h--) { + *h = h[-1]; + } + *h = ngx_rtmp_codec_av; h = ngx_array_push(&cmcf->events[NGX_RTMP_DISCONNECT]);