From 70d056bf925abcc1dc2edc1b211dcc262bb62e7f Mon Sep 17 00:00:00 2001 From: Sergey Dryabzhinsky Date: Sun, 5 Jul 2015 04:15:43 +0300 Subject: [PATCH] Add application name into params for all notify - append application name into all notify events data --- ngx_rtmp_notify_module.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ngx_rtmp_notify_module.c b/ngx_rtmp_notify_module.c index 2fcfffb..1fb4007 100644 --- a/ngx_rtmp_notify_module.c +++ b/ngx_rtmp_notify_module.c @@ -537,6 +537,7 @@ ngx_rtmp_notify_publish_create(ngx_rtmp_session_t *s, void *arg, b = ngx_create_temp_buf(pool, sizeof("&call=publish") + + sizeof("&app=") + s->app.len * 3 + sizeof("&name=") + name_len * 3 + sizeof("&type=") + type_len * 3 + 1 + args_len); @@ -550,6 +551,10 @@ ngx_rtmp_notify_publish_create(ngx_rtmp_session_t *s, void *arg, b->last = ngx_cpymem(b->last, (u_char*) "&call=publish", sizeof("&call=publish") - 1); + b->last = ngx_cpymem(b->last, (u_char*) "&app=", sizeof("&app=") - 1); + b->last = (u_char*) ngx_escape_uri(b->last, s->app.data, s->app.len, + NGX_ESCAPE_ARGS); + b->last = ngx_cpymem(b->last, (u_char*) "&name=", sizeof("&name=") - 1); b->last = (u_char*) ngx_escape_uri(b->last, v->name, name_len, NGX_ESCAPE_ARGS); @@ -587,6 +592,7 @@ ngx_rtmp_notify_play_create(ngx_rtmp_session_t *s, void *arg, b = ngx_create_temp_buf(pool, sizeof("&call=play") + + sizeof("&app=") + s->app.len * 3 + sizeof("&name=") + name_len * 3 + sizeof("&start=&duration=&reset=") + NGX_INT32_LEN * 3 + 1 + args_len); @@ -600,6 +606,10 @@ ngx_rtmp_notify_play_create(ngx_rtmp_session_t *s, void *arg, b->last = ngx_cpymem(b->last, (u_char*) "&call=play", sizeof("&call=play") - 1); + b->last = ngx_cpymem(b->last, (u_char*) "&app=", sizeof("&app=") - 1); + b->last = (u_char*) ngx_escape_uri(b->last, s->app.data, s->app.len, + NGX_ESCAPE_ARGS); + b->last = ngx_cpymem(b->last, (u_char*) "&name=", sizeof("&name=") - 1); b->last = (u_char*) ngx_escape_uri(b->last, v->name, name_len, NGX_ESCAPE_ARGS); @@ -642,6 +652,7 @@ ngx_rtmp_notify_done_create(ngx_rtmp_session_t *s, void *arg, b = ngx_create_temp_buf(pool, sizeof("&call=") + cbname_len + + sizeof("&app=") + s->app.len * 3 + sizeof("&name=") + name_len * 3 + 1 + args_len); if (b == NULL) { @@ -654,6 +665,10 @@ ngx_rtmp_notify_done_create(ngx_rtmp_session_t *s, void *arg, b->last = ngx_cpymem(b->last, (u_char*) "&call=", sizeof("&call=") - 1); b->last = ngx_cpymem(b->last, ds->cbname, cbname_len); + b->last = ngx_cpymem(b->last, (u_char*) "&app=", sizeof("&app=") - 1); + b->last = (u_char*) ngx_escape_uri(b->last, s->app.data, s->app.len, + NGX_ESCAPE_ARGS); + if (name_len) { b->last = ngx_cpymem(b->last, (u_char*) "&name=", sizeof("&name=") - 1); b->last = (u_char*) ngx_escape_uri(b->last, ctx->name, name_len, @@ -701,6 +716,7 @@ ngx_rtmp_notify_update_create(ngx_rtmp_session_t *s, void *arg, sizeof("&call=update") + sfx.len + sizeof("&time=") + NGX_TIME_T_LEN + sizeof("×tamp=") + NGX_INT32_LEN + + sizeof("&app=") + s->app.len * 3 + sizeof("&name=") + name_len * 3 + 1 + args_len); if (b == NULL) { @@ -722,6 +738,10 @@ ngx_rtmp_notify_update_create(ngx_rtmp_session_t *s, void *arg, sizeof("×tamp=") - 1); b->last = ngx_sprintf(b->last, "%D", s->current_time); + b->last = ngx_cpymem(b->last, (u_char*) "&app=", sizeof("&app=") - 1); + b->last = (u_char*) ngx_escape_uri(b->last, s->app.data, s->app.len, + NGX_ESCAPE_ARGS); + if (name_len) { b->last = ngx_cpymem(b->last, (u_char*) "&name=", sizeof("&name=") - 1); b->last = (u_char*) ngx_escape_uri(b->last, ctx->name, name_len, @@ -760,6 +780,7 @@ ngx_rtmp_notify_record_done_create(ngx_rtmp_session_t *s, void *arg, b = ngx_create_temp_buf(pool, sizeof("&call=record_done") + + sizeof("&app=") + s->app.len * 3 + sizeof("&recorder=") + v->recorder.len + sizeof("&name=") + name_len * 3 + sizeof("&path=") + v->path.len * 3 + @@ -774,6 +795,10 @@ ngx_rtmp_notify_record_done_create(ngx_rtmp_session_t *s, void *arg, b->last = ngx_cpymem(b->last, (u_char*) "&call=record_done", sizeof("&call=record_done") - 1); + b->last = ngx_cpymem(b->last, (u_char*) "&app=", sizeof("&app=") - 1); + b->last = (u_char*) ngx_escape_uri(b->last, s->app.data, s->app.len, + NGX_ESCAPE_ARGS); + b->last = ngx_cpymem(b->last, (u_char *) "&recorder=", sizeof("&recorder=") - 1); b->last = (u_char*) ngx_escape_uri(b->last, v->recorder.data,