Skip to content

Commit

Permalink
fix order of events called; we must have rtmp_codec first
Browse files Browse the repository at this point in the history
  • Loading branch information
igorshevach committed Sep 15, 2024
1 parent 49235cb commit 19c5a6c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions nginx-rtmp-module/src/ngx_rtmp_codec_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -1464,13 +1465,23 @@ 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]);
if (h == NULL) {
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]);
Expand Down

0 comments on commit 19c5a6c

Please sign in to comment.