mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-05-10 06:21:09 +02:00
Add recording status to stat page
Update rtmp status page with streams and clients recording status
This commit is contained in:
parent
f62a083806
commit
dec648681d
|
@ -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);
|
||||
|
@ -414,6 +415,8 @@ 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_uint_t nclients, total_nclients;
|
||||
|
@ -422,6 +425,9 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
|
|||
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;
|
||||
}
|
||||
|
@ -435,6 +441,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("<stream>\r\n");
|
||||
|
||||
is_recording = 0;
|
||||
|
||||
NGX_RTMP_STAT_L("<name>");
|
||||
NGX_RTMP_STAT_ECS(stream->name);
|
||||
NGX_RTMP_STAT_L("</name>\r\n");
|
||||
|
@ -489,6 +497,18 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
|
|||
NGX_RTMP_STAT_L("<active/>");
|
||||
}
|
||||
|
||||
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) {
|
||||
NGX_RTMP_STAT_L("<recording/>");
|
||||
is_recording = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NGX_RTMP_STAT_L("</client>\r\n");
|
||||
}
|
||||
if (ctx->publishing) {
|
||||
|
@ -588,6 +608,10 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
|
|||
NGX_RTMP_STAT_L("<active/>\r\n");
|
||||
}
|
||||
|
||||
if (is_recording) {
|
||||
NGX_RTMP_STAT_L("<recording/>\r\n");
|
||||
}
|
||||
|
||||
NGX_RTMP_STAT_L("</stream>\r\n");
|
||||
}
|
||||
}
|
||||
|
|
16
stat.xsl
16
stat.xsl
|
@ -38,6 +38,7 @@
|
|||
<th>In bits/s</th>
|
||||
<th>Out bits/s</th>
|
||||
<th>State</th>
|
||||
<th>Record</th>
|
||||
<th>Time</th>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -75,6 +76,7 @@
|
|||
</xsl:call-template>
|
||||
</td>
|
||||
<td/>
|
||||
<td/>
|
||||
<td>
|
||||
<xsl:call-template name="showtime">
|
||||
<xsl:with-param name="time" select="/rtmp/uptime * 1000"/>
|
||||
|
@ -202,6 +204,7 @@
|
|||
</xsl:call-template>
|
||||
</td>
|
||||
<td><xsl:call-template name="streamstate"/></td>
|
||||
<td><xsl:call-template name="recordstate"/></td>
|
||||
<td>
|
||||
<xsl:call-template name="showtime">
|
||||
<xsl:with-param name="time" select="time"/>
|
||||
|
@ -217,6 +220,7 @@
|
|||
<tr>
|
||||
<th>Id</th>
|
||||
<th>State</th>
|
||||
<th>Recording</th>
|
||||
<th>Address</th>
|
||||
<th>Flash version</th>
|
||||
<th>Page URL</th>
|
||||
|
@ -299,6 +303,13 @@
|
|||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="recordstate">
|
||||
<xsl:choose>
|
||||
<xsl:when test="recording">yes</xsl:when>
|
||||
<xsl:otherwise>no</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="client">
|
||||
<tr>
|
||||
|
@ -310,6 +321,7 @@
|
|||
</xsl:attribute>
|
||||
<td><xsl:value-of select="id"/></td>
|
||||
<td><xsl:call-template name="clientstate"/></td>
|
||||
<td><xsl:call-template name="recordstate"/></td>
|
||||
<td>
|
||||
<a target="_blank">
|
||||
<xsl:attribute name="href">
|
||||
|
@ -348,6 +360,10 @@
|
|||
active
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="recording">
|
||||
recording
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="width">
|
||||
<xsl:value-of select="."/>x<xsl:value-of select="../height"/>
|
||||
</xsl:template>
|
||||
|
|
Loading…
Reference in a new issue