added more data to stat

This commit is contained in:
Roman Arutyunyan 2013-12-21 12:16:46 +04:00
parent 0a5b06609b
commit f39d3f66a3
2 changed files with 40 additions and 18 deletions

View file

@ -486,18 +486,20 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
total_nclients += nclients;
if (codec) {
NGX_RTMP_STAT_L("<meta><width>");
NGX_RTMP_STAT_L("<meta>");
NGX_RTMP_STAT_L("<video>");
NGX_RTMP_STAT_L("<width>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
"%ui", codec->width) - buf);
NGX_RTMP_STAT_L("</width><height>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
"%ui", codec->height) - buf);
NGX_RTMP_STAT_L("</height><framerate>");
NGX_RTMP_STAT_L("</height><frame_rate>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
"%ui", codec->frame_rate) - buf);
NGX_RTMP_STAT_L("</framerate>");
NGX_RTMP_STAT_L("</frame_rate>");
NGX_RTMP_STAT_L("<video>");
cname = ngx_rtmp_get_video_codec_name(codec->video_codec_id);
if (*cname) {
NGX_RTMP_STAT_L("<codec>");
@ -544,6 +546,17 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
"%ui", codec->aac_chan_conf) - buf);
NGX_RTMP_STAT_L("</channels>");
} else if (codec->audio_channels) {
NGX_RTMP_STAT_L("<channels>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
"%ui", codec->audio_channels) - buf);
NGX_RTMP_STAT_L("</channels>");
}
if (codec->sample_rate) {
NGX_RTMP_STAT_L("<sample_rate>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
"%ui", codec->sample_rate) - buf);
NGX_RTMP_STAT_L("</sample_rate>");
}
NGX_RTMP_STAT_L("</audio>");

View file

@ -35,10 +35,8 @@
<th>Out bytes</th>
<th>Input bits/s</th>
<th>Output bits/s</th>
<th>Size</th>
<th>Frame Rate</th>
<th>Video</th>
<th>Audio</th>
<th colspan="3">Video</th>
<th colspan="3">Audio</th>
<th>State</th>
<th>Time</th>
</tr>
@ -68,7 +66,13 @@
<xsl:with-param name="persec" select="1"/>
</xsl:call-template>
</td>
<td colspan="5"/>
<th bgcolor="#999999">codec</th>
<th bgcolor="#999999">size</th>
<th bgcolor="#999999">fps</th>
<th bgcolor="#999999">codec</th>
<th bgcolor="#999999">freq</th>
<th bgcolor="#999999">chan</th>
<td/>
<td>
<xsl:call-template name="showtime">
<xsl:with-param name="time" select="/rtmp/uptime * 1000"/>
@ -163,18 +167,23 @@
<xsl:with-param name="persec" select="1"/>
</xsl:call-template>
</td>
<td>
<xsl:if test="meta/width &gt; 0">
<xsl:value-of select="meta/width"/>x<xsl:value-of select="meta/height"/>
</xsl:if>
</td>
<td align="middle"><xsl:value-of select="meta/framerate"/></td>
<td>
<xsl:value-of select="meta/video/codec"/>&#160;<xsl:value-of select="meta/video/profile"/>&#160;<xsl:value-of select="meta/video/level"/>
</td>
<td>
<xsl:apply-templates select="meta/video/width"/>
</td>
<td>
<xsl:value-of select="meta/video/frame_rate"/>
</td>
<td>
<xsl:value-of select="meta/audio/codec"/>&#160;<xsl:value-of select="meta/audio/profile"/>
<xsl:apply-templates select="meta/audio/channels"/>
</td>
<td>
<xsl:apply-templates select="meta/audio/sample_rate"/>
</td>
<td>
<xsl:value-of select="meta/audio/channels"/>
</td>
<td><xsl:call-template name="streamstate"/></td>
<td>
@ -323,8 +332,8 @@
active
</xsl:template>
<xsl:template match="channels">
x<xsl:value-of select="."/>
<xsl:template match="width">
<xsl:value-of select="."/>x<xsl:value-of select="../height"/>
</xsl:template>
</xsl:stylesheet>