From 6485716fb4734d5fc25ba12d849e2dedab63707d Mon Sep 17 00:00:00 2001 From: Roman Arutyunyan Date: Sat, 22 Sep 2012 16:42:43 +0400 Subject: [PATCH] fixed push & pull in auto-push mode --- ngx_rtmp.h | 1 + ngx_rtmp_auto_push_module.c | 2 +- ngx_rtmp_relay_module.c | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ngx_rtmp.h b/ngx_rtmp.h index 947c85c..ab598c4 100644 --- a/ngx_rtmp.h +++ b/ngx_rtmp.h @@ -209,6 +209,7 @@ typedef struct { /* auto-pushed? */ unsigned auto_pushed:1; + unsigned relay:1; /* input stream 0 (reserved by RTMP spec) * is used as free chain link */ diff --git a/ngx_rtmp_auto_push_module.c b/ngx_rtmp_auto_push_module.c index e7079b9..421b6ef 100644 --- a/ngx_rtmp_auto_push_module.c +++ b/ngx_rtmp_auto_push_module.c @@ -400,7 +400,7 @@ ngx_rtmp_auto_push_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v) ngx_rtmp_auto_push_conf_t *apcf; ngx_rtmp_auto_push_ctx_t *ctx; - if (s->auto_pushed) { + if (s->auto_pushed || s->relay) { goto next; } diff --git a/ngx_rtmp_relay_module.c b/ngx_rtmp_relay_module.c index a6b50fc..405bac5 100644 --- a/ngx_rtmp_relay_module.c +++ b/ngx_rtmp_relay_module.c @@ -396,6 +396,7 @@ ngx_rtmp_relay_create_remote_ctx(ngx_rtmp_session_t *s, ngx_str_t* name, return NULL; } rs->app_conf = s->app_conf; + rs->relay = 1; rctx->session = rs; ngx_rtmp_set_ctx(rs, rctx, ngx_rtmp_relay_module); ngx_str_set(&rs->flashver, "ngx-local-relay"); @@ -536,6 +537,10 @@ ngx_rtmp_relay_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v) size_t n; ngx_rtmp_relay_ctx_t *ctx; + if (s->auto_pushed) { + goto next; + } + ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_relay_module); if (ctx && ctx->relay) { goto next;