diff --git a/config b/config index 786b661..3e5a30b 100644 --- a/config +++ b/config @@ -14,6 +14,7 @@ RTMP_CORE_MODULES=" \ ngx_rtmp_relay_module \ ngx_rtmp_exec_module \ ngx_rtmp_auto_push_module \ + ngx_rtmp_auto_push_index_module \ ngx_rtmp_notify_module \ ngx_rtmp_log_module \ ngx_rtmp_limit_module \ diff --git a/ngx_rtmp_auto_push_module.c b/ngx_rtmp_auto_push_module.c index 2f3533d..60c85d7 100644 --- a/ngx_rtmp_auto_push_module.c +++ b/ngx_rtmp_auto_push_module.c @@ -93,6 +93,34 @@ ngx_module_t ngx_rtmp_auto_push_module = { }; +static ngx_rtmp_module_t ngx_rtmp_auto_push_index_module_ctx = { + NULL, /* preconfiguration */ + NULL, /* postconfiguration */ + NULL, /* create main configuration */ + NULL, /* init main configuration */ + NULL, /* create server configuration */ + NULL, /* merge server configuration */ + NULL, /* create app configuration */ + NULL /* merge app configuration */ +}; + + +ngx_module_t ngx_rtmp_auto_push_index_module = { + NGX_MODULE_V1, + &ngx_rtmp_auto_push_index_module_ctx, /* module context */ + NULL, /* module directives */ + NGX_RTMP_MODULE, /* module type */ + NULL, /* init master */ + NULL, /* init module */ + NULL, /* init process */ + NULL, /* init thread */ + NULL, /* exit thread */ + NULL, /* exit process */ + NULL, /* exit master */ + NGX_MODULE_V1_PADDING +}; + + #define NGX_RTMP_AUTO_PUSH_SOCKNAME "nginx-rtmp" @@ -324,7 +352,7 @@ ngx_rtmp_auto_push_reconnect(ngx_event_t *ev) apcf = (ngx_rtmp_auto_push_conf_t *) ngx_get_conf(ngx_cycle->conf_ctx, ngx_rtmp_auto_push_module); - ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_auto_push_module); + ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_auto_push_index_module); if (ctx == NULL) { return; } @@ -461,14 +489,14 @@ ngx_rtmp_auto_push_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v) goto next; } - ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_auto_push_module); + ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_auto_push_index_module); if (ctx == NULL) { ctx = ngx_palloc(s->connection->pool, sizeof(ngx_rtmp_auto_push_ctx_t)); if (ctx == NULL) { goto next; } - ngx_rtmp_set_ctx(s, ctx, ngx_rtmp_auto_push_module); + ngx_rtmp_set_ctx(s, ctx, ngx_rtmp_auto_push_index_module); } ngx_memzero(ctx, sizeof(*ctx)); @@ -508,7 +536,7 @@ ngx_rtmp_auto_push_delete_stream(ngx_rtmp_session_t *s, goto next; } - ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_auto_push_module); + ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_auto_push_index_module); if (ctx) { if (ctx->push_evt.timer_set) { ngx_del_timer(&ctx->push_evt); @@ -532,7 +560,7 @@ ngx_rtmp_auto_push_delete_stream(ngx_rtmp_session_t *s, slot, &rctx->app, &rctx->name); pctx = ngx_rtmp_get_module_ctx(rctx->publish->session, - ngx_rtmp_auto_push_module); + ngx_rtmp_auto_push_index_module); if (pctx == NULL) { goto next; } diff --git a/ngx_rtmp_core_module.c b/ngx_rtmp_core_module.c index 4f89374..1037f82 100644 --- a/ngx_rtmp_core_module.c +++ b/ngx_rtmp_core_module.c @@ -458,8 +458,7 @@ ngx_rtmp_core_application(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) module = modules[i]->ctx; if (module->create_app_conf) { - ctx->app_conf[modules[i]->ctx_index] = - module->create_app_conf(cf); + ctx->app_conf[modules[i]->ctx_index] = module->create_app_conf(cf); if (ctx->app_conf[modules[i]->ctx_index] == NULL) { return NGX_CONF_ERROR; }