Skip to content

Commit

Permalink
Get changes from @arut arut@c0bf381
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-dryabzhinsky committed Nov 25, 2016
1 parent 4809496 commit 4bf6852
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
1 change: 1 addition & 0 deletions config
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
38 changes: 33 additions & 5 deletions ngx_rtmp_auto_push_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down
3 changes: 1 addition & 2 deletions ngx_rtmp_core_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 4bf6852

Please sign in to comment.