diff --git a/ngx_rtmp_live_module.c b/ngx_rtmp_live_module.c index 1d6c900..5bebb9e 100644 --- a/ngx_rtmp_live_module.c +++ b/ngx_rtmp_live_module.c @@ -563,28 +563,28 @@ ngx_rtmp_live_join(ngx_rtmp_session_t *s, u_char *name, unsigned publisher) } -static void -ngx_rtmp_live_leave(ngx_rtmp_session_t *s) +static ngx_int_t +ngx_rtmp_live_close_stream(ngx_rtmp_session_t *s, ngx_rtmp_close_stream_t *v) { - ngx_rtmp_session_t *ss; - ngx_rtmp_live_ctx_t *ctx, **cctx, *pctx; - ngx_rtmp_live_stream_t **stream; - ngx_rtmp_live_app_conf_t *lacf; + ngx_rtmp_session_t *ss; + ngx_rtmp_live_ctx_t *ctx, **cctx, *pctx; + ngx_rtmp_live_stream_t **stream; + ngx_rtmp_live_app_conf_t *lacf; lacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_live_module); if (lacf == NULL) { - return; + goto next; } ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_live_module); if (ctx == NULL) { - return; + goto next; } if (ctx->stream == NULL) { ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0, - "live: leave: not joined"); - return; + "live: not joined"); + goto next; } ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0, @@ -622,7 +622,7 @@ ngx_rtmp_live_leave(ngx_rtmp_session_t *s) if (ctx->stream->ctx) { ctx->stream = NULL; - return; + goto next; } ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0, @@ -631,7 +631,7 @@ ngx_rtmp_live_leave(ngx_rtmp_session_t *s) stream = ngx_rtmp_live_get_stream(s, ctx->stream->name, 0); if (stream == NULL) { - return; + goto next; } *stream = (*stream)->next; @@ -643,15 +643,7 @@ ngx_rtmp_live_leave(ngx_rtmp_session_t *s) ngx_rtmp_send_status(s, "NetStream.Play.Stop", "status", "Stop live"); } - return; -} - - -static ngx_int_t -ngx_rtmp_live_close_stream(ngx_rtmp_session_t *s, ngx_rtmp_close_stream_t *v) -{ - ngx_rtmp_live_leave(s); - +next: return next_close_stream(s, v); } @@ -1121,27 +1113,6 @@ next: } -ngx_int_t -ngx_rtmp_live_redirect(ngx_rtmp_session_t *s, u_char *name) -{ - ngx_uint_t publishing; - ngx_rtmp_live_ctx_t *ctx; - - ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_live_module); - if (ctx == NULL) { - return NGX_ERROR; - } - - publishing = ctx->publishing; - - ngx_rtmp_live_leave(s); - - ngx_rtmp_live_join(s, name, publishing); - - return NGX_OK; -} - - static ngx_int_t ngx_rtmp_live_postconfiguration(ngx_conf_t *cf) { diff --git a/ngx_rtmp_live_module.h b/ngx_rtmp_live_module.h index 0d2b61a..71eca36 100644 --- a/ngx_rtmp_live_module.h +++ b/ngx_rtmp_live_module.h @@ -77,9 +77,6 @@ typedef struct { } ngx_rtmp_live_app_conf_t; -ngx_int_t ngx_rtmp_live_redirect(ngx_rtmp_session_t *s, u_char *name); - - extern ngx_module_t ngx_rtmp_live_module;