mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-05-20 18:01:08 +02:00
added publish/play silent mode to escape sending unrelated replies to when using relays
This commit is contained in:
parent
30924a47ae
commit
3fb41195a5
|
@ -445,9 +445,13 @@ ngx_rtmp_cmd_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)
|
||||||
out_inf, sizeof(out_inf) },
|
out_inf, sizeof(out_inf) },
|
||||||
};
|
};
|
||||||
|
|
||||||
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
ngx_log_debug3(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
||||||
"publish: name='%s' type=%s",
|
"publish: name='%s' type=%s silent=%d",
|
||||||
v->name, v->type);
|
v->name, v->type, v->silent);
|
||||||
|
|
||||||
|
if (v->silent) {
|
||||||
|
return NGX_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/* send onStatus reply */
|
/* send onStatus reply */
|
||||||
memset(&h, 0, sizeof(h));
|
memset(&h, 0, sizeof(h));
|
||||||
|
@ -717,10 +721,14 @@ ngx_rtmp_cmd_play(ngx_rtmp_session_t *s, ngx_rtmp_play_t *v)
|
||||||
out4_inf, sizeof(out4_inf) },
|
out4_inf, sizeof(out4_inf) },
|
||||||
};
|
};
|
||||||
|
|
||||||
ngx_log_debug4(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
ngx_log_debug5(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
||||||
"play: name='%s' start=%uD duration=%uD reset=%d",
|
"play: name='%s' start=%uD duration=%uD reset=%d silent=%d",
|
||||||
v->name, (uint32_t)v->start,
|
v->name, (uint32_t)v->start,
|
||||||
(uint32_t)v->duration, v->reset);
|
(uint32_t)v->duration, v->reset, v->silent);
|
||||||
|
|
||||||
|
if (v->silent) {
|
||||||
|
return NGX_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/* send onStatus reply */
|
/* send onStatus reply */
|
||||||
memset(&h, 0, sizeof(h));
|
memset(&h, 0, sizeof(h));
|
||||||
|
|
|
@ -43,6 +43,7 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u_char name[256];
|
u_char name[256];
|
||||||
u_char type[16];
|
u_char type[16];
|
||||||
|
int silent;
|
||||||
} ngx_rtmp_publish_t;
|
} ngx_rtmp_publish_t;
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,6 +62,7 @@ typedef struct {
|
||||||
double start;
|
double start;
|
||||||
double duration;
|
double duration;
|
||||||
int reset;
|
int reset;
|
||||||
|
int silent;
|
||||||
} ngx_rtmp_play_t;
|
} ngx_rtmp_play_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -514,6 +514,7 @@ ngx_rtmp_relay_play_local(ngx_rtmp_session_t *s)
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_memzero(&v, sizeof(ngx_rtmp_play_t));
|
ngx_memzero(&v, sizeof(ngx_rtmp_play_t));
|
||||||
|
v.silent = 1;
|
||||||
*(ngx_cpymem(v.name, ctx->name.data,
|
*(ngx_cpymem(v.name, ctx->name.data,
|
||||||
ngx_min(sizeof(v.name) - 1, ctx->name.len))) = 0;
|
ngx_min(sizeof(v.name) - 1, ctx->name.len))) = 0;
|
||||||
|
|
||||||
|
@ -533,6 +534,7 @@ ngx_rtmp_relay_publish_local(ngx_rtmp_session_t *s)
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_memzero(&v, sizeof(ngx_rtmp_publish_t));
|
ngx_memzero(&v, sizeof(ngx_rtmp_publish_t));
|
||||||
|
v.silent = 1;
|
||||||
*(ngx_cpymem(v.name, ctx->name.data,
|
*(ngx_cpymem(v.name, ctx->name.data,
|
||||||
ngx_min(sizeof(v.name) - 1, ctx->name.len))) = 0;
|
ngx_min(sizeof(v.name) - 1, ctx->name.len))) = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue