diff --git a/ngx_rtmp_stat_module.c b/ngx_rtmp_stat_module.c index 5029fbd..db23bfc 100644 --- a/ngx_rtmp_stat_module.c +++ b/ngx_rtmp_stat_module.c @@ -13,6 +13,7 @@ #include "ngx_rtmp_live_module.h" #include "ngx_rtmp_play_module.h" #include "ngx_rtmp_codec_module.h" +#include "ngx_rtmp_record_module.h" static ngx_int_t ngx_rtmp_stat_init_process(ngx_cycle_t *cycle); @@ -433,14 +434,19 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll, ngx_rtmp_live_stream_t *stream; ngx_rtmp_codec_ctx_t *codec; ngx_rtmp_live_ctx_t *ctx; + ngx_rtmp_record_ctx_t *rctx; + ngx_rtmp_record_rec_ctx_t *recctx; ngx_rtmp_session_t *s; - ngx_int_t n; + ngx_int_t n, rn; ngx_uint_t nclients, total_nclients; u_char buf[NGX_INT_T_LEN]; u_char bbuf[NGX_INT32_LEN]; ngx_rtmp_stat_loc_conf_t *slcf; u_char *cname; + // Is any of stream clients (publisher) recording now + u_char is_recording = 0; + if (!lacf->live) { return; } @@ -454,6 +460,8 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll, for (stream = lacf->streams[n]; stream; stream = stream->next) { NGX_RTMP_STAT_L("\r\n"); + is_recording = 0; + NGX_RTMP_STAT_L(""); NGX_RTMP_STAT_ECS(stream->name); NGX_RTMP_STAT_L("\r\n"); @@ -510,6 +518,18 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll, NGX_RTMP_STAT_L(""); } + rctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_record_module); + if (rctx) { + recctx = rctx->rec.elts; + for (rn = 0; rn < rctx->rec.nelts; ++rn, ++recctx) { + if (recctx->initialized && recctx->file.fd != NGX_INVALID_FILE) { + NGX_RTMP_STAT_L(""); + is_recording = 1; + break; + } + } + } + NGX_RTMP_STAT_L("\r\n"); } if (ctx->publishing) { @@ -609,6 +629,10 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll, NGX_RTMP_STAT_L("\r\n"); } + if (is_recording) { + NGX_RTMP_STAT_L("\r\n"); + } + NGX_RTMP_STAT_L("\r\n"); } } diff --git a/stat.xsl b/stat.xsl index 04ba410..7411c5e 100644 --- a/stat.xsl +++ b/stat.xsl @@ -38,6 +38,7 @@ In bits/s Out bits/s State + Record Time @@ -75,6 +76,7 @@ + @@ -202,6 +204,7 @@ + @@ -217,6 +220,7 @@ Id State + Recording Address Flash version Page URL @@ -299,6 +303,13 @@ + + + yes + no + + + @@ -310,6 +321,7 @@ + @@ -348,6 +360,10 @@ active + + recording + + x