added publish/play silent mode to escape sending unrelated replies to when using relays

This commit is contained in:
Roman Arutyunyan 2012-05-22 22:53:35 +04:00
parent 30924a47ae
commit 3fb41195a5
3 changed files with 18 additions and 6 deletions

View file

@ -445,9 +445,13 @@ ngx_rtmp_cmd_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)
out_inf, sizeof(out_inf) },
};
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"publish: name='%s' type=%s",
v->name, v->type);
ngx_log_debug3(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"publish: name='%s' type=%s silent=%d",
v->name, v->type, v->silent);
if (v->silent) {
return NGX_OK;
}
/* send onStatus reply */
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) },
};
ngx_log_debug4(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"play: name='%s' start=%uD duration=%uD reset=%d",
ngx_log_debug5(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"play: name='%s' start=%uD duration=%uD reset=%d silent=%d",
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 */
memset(&h, 0, sizeof(h));

View file

@ -43,6 +43,7 @@ typedef struct {
typedef struct {
u_char name[256];
u_char type[16];
int silent;
} ngx_rtmp_publish_t;
@ -61,6 +62,7 @@ typedef struct {
double start;
double duration;
int reset;
int silent;
} ngx_rtmp_play_t;

View file

@ -514,6 +514,7 @@ ngx_rtmp_relay_play_local(ngx_rtmp_session_t *s)
}
ngx_memzero(&v, sizeof(ngx_rtmp_play_t));
v.silent = 1;
*(ngx_cpymem(v.name, ctx->name.data,
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));
v.silent = 1;
*(ngx_cpymem(v.name, ctx->name.data,
ngx_min(sizeof(v.name) - 1, ctx->name.len))) = 0;