mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-05-05 13:01:08 +02:00
Merge pull request #50 from sergey-dryabzhinsky/on-done-events-send-bytes
On done events send bytes stats
This commit is contained in:
commit
c80342e0ab
|
@ -487,9 +487,11 @@ ngx_rtmp_notify_disconnect_create(ngx_rtmp_session_t *s, void *arg,
|
|||
}
|
||||
|
||||
b = ngx_create_temp_buf(pool,
|
||||
sizeof("&call=disconnect") +
|
||||
sizeof("&app=") + s->app.len * 3 +
|
||||
1 + s->args.len);
|
||||
sizeof("&call=disconnect") +
|
||||
sizeof("&app=") + s->app.len * 3 +
|
||||
sizeof("&bytes_in=") - 1 + NGX_INT32_LEN +
|
||||
sizeof("&bytes_out=") - 1 + NGX_INT32_LEN +
|
||||
1 + s->args.len);
|
||||
if (b == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -504,6 +506,12 @@ ngx_rtmp_notify_disconnect_create(ngx_rtmp_session_t *s, void *arg,
|
|||
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*) "&bytes_in=", sizeof("&bytes_in=") -1);
|
||||
b->last = ngx_sprintf(b->last, "%ui", (ngx_uint_t) s->in_bytes);
|
||||
|
||||
b->last = ngx_cpymem(b->last, (u_char*) "&bytes_out=", sizeof("&bytes_out=") -1);
|
||||
b->last = ngx_sprintf(b->last, "%ui", (ngx_uint_t) s->out_bytes);
|
||||
|
||||
if (s->args.len) {
|
||||
*b->last++ = '&';
|
||||
b->last = (u_char *) ngx_cpymem(b->last, s->args.data, s->args.len);
|
||||
|
@ -666,10 +674,13 @@ ngx_rtmp_notify_done_create(ngx_rtmp_session_t *s, void *arg,
|
|||
args_len = ctx ? ngx_strlen(ctx->args) : 0;
|
||||
|
||||
b = ngx_create_temp_buf(pool,
|
||||
sizeof("&call=") + cbname_len +
|
||||
sizeof("&app=") + s->app.len * 3 +
|
||||
sizeof("&name=") + name_len * 3 +
|
||||
1 + args_len);
|
||||
sizeof("&call=") + cbname_len +
|
||||
sizeof("&app=") + s->app.len * 3 +
|
||||
sizeof("&name=") + name_len * 3 +
|
||||
sizeof("&bytes_in=") - 1 + NGX_INT32_LEN +
|
||||
sizeof("&bytes_out=") - 1 + NGX_INT32_LEN +
|
||||
1 + args_len);
|
||||
|
||||
if (b == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -690,6 +701,12 @@ ngx_rtmp_notify_done_create(ngx_rtmp_session_t *s, void *arg,
|
|||
NGX_ESCAPE_ARGS);
|
||||
}
|
||||
|
||||
b->last = ngx_cpymem(b->last, (u_char*) "&bytes_in=", sizeof("&bytes_in=") -1);
|
||||
b->last = ngx_sprintf(b->last, "%ui", (ngx_uint_t) s->in_bytes);
|
||||
|
||||
b->last = ngx_cpymem(b->last, (u_char*) "&bytes_out=", sizeof("&bytes_out=") -1);
|
||||
b->last = ngx_sprintf(b->last, "%ui", (ngx_uint_t) s->out_bytes);
|
||||
|
||||
if (args_len) {
|
||||
*b->last++ = '&';
|
||||
b->last = (u_char *) ngx_cpymem(b->last, ctx->args, args_len);
|
||||
|
@ -794,12 +811,15 @@ ngx_rtmp_notify_record_done_create(ngx_rtmp_session_t *s, void *arg,
|
|||
args_len = ngx_strlen(ctx->args);
|
||||
|
||||
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 +
|
||||
1 + args_len);
|
||||
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 +
|
||||
sizeof("&bytes_in=") - 1 + NGX_INT32_LEN +
|
||||
sizeof("&bytes_out=") - 1 + NGX_INT32_LEN +
|
||||
1 + args_len);
|
||||
|
||||
if (b == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -827,6 +847,12 @@ ngx_rtmp_notify_record_done_create(ngx_rtmp_session_t *s, void *arg,
|
|||
b->last = (u_char*) ngx_escape_uri(b->last, v->path.data, v->path.len,
|
||||
NGX_ESCAPE_ARGS);
|
||||
|
||||
b->last = ngx_cpymem(b->last, (u_char*) "&bytes_in=", sizeof("&bytes_in=") -1);
|
||||
b->last = ngx_sprintf(b->last, "%ui", (ngx_uint_t) s->in_bytes);
|
||||
|
||||
b->last = ngx_cpymem(b->last, (u_char*) "&bytes_out=", sizeof("&bytes_out=") -1);
|
||||
b->last = ngx_sprintf(b->last, "%ui", (ngx_uint_t) s->out_bytes);
|
||||
|
||||
if (args_len) {
|
||||
*b->last++ = '&';
|
||||
b->last = (u_char *) ngx_cpymem(b->last, ctx->args, args_len);
|
||||
|
|
Loading…
Reference in a new issue