mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-05-17 00:51:09 +02:00
added 'time' argument to on_update notification to track time from beginning of playback/publish
This commit is contained in:
parent
8a332610bc
commit
6fa61c090e
|
@ -84,6 +84,7 @@ typedef struct {
|
|||
u_char name[NGX_RTMP_MAX_NAME];
|
||||
u_char args[NGX_RTMP_MAX_ARGS];
|
||||
ngx_event_t update_evt;
|
||||
time_t start;
|
||||
} ngx_rtmp_notify_ctx_t;
|
||||
|
||||
|
||||
|
@ -682,6 +683,7 @@ ngx_rtmp_notify_update_create(ngx_rtmp_session_t *s, void *arg,
|
|||
|
||||
b = ngx_create_temp_buf(pool,
|
||||
sizeof("&call=update") + sfx.len +
|
||||
sizeof("&time=") + NGX_TIME_T_LEN +
|
||||
sizeof("&name=") + name_len * 3 +
|
||||
1 + args_len);
|
||||
if (b == NULL) {
|
||||
|
@ -695,6 +697,10 @@ ngx_rtmp_notify_update_create(ngx_rtmp_session_t *s, void *arg,
|
|||
sizeof("&call=update") - 1);
|
||||
b->last = ngx_cpymem(b->last, sfx.data, sfx.len);
|
||||
|
||||
b->last = ngx_cpymem(b->last, (u_char *) "&time=",
|
||||
sizeof("&time=") - 1);
|
||||
b->last = ngx_sprintf(b->last, "%T", ngx_cached_time->sec - ctx->start);
|
||||
|
||||
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,
|
||||
|
@ -1132,6 +1138,8 @@ ngx_rtmp_notify_init(ngx_rtmp_session_t *s,
|
|||
return;
|
||||
}
|
||||
|
||||
ctx->start = ngx_cached_time->sec;
|
||||
|
||||
e = &ctx->update_evt;
|
||||
|
||||
e->data = s->connection;
|
||||
|
|
Loading…
Reference in a new issue