Skip to content

Commit 0958e4f

Browse files
committed
Merge commit '1a0dd69f3466e37c6b13555d79728308ef4759a4' into new-stat
2 parents 76f433f + 1a0dd69 commit 0958e4f

File tree

1 file changed

+91
-18
lines changed

1 file changed

+91
-18
lines changed

stat.xsl

Lines changed: 91 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
<th>#clients</th>
2727
<th>In bytes</th>
2828
<th>Out bytes</th>
29-
<th>In Kbps</th>
30-
<th>Out Kbps</th>
29+
<th>In Bandwidth</th>
30+
<th>Out Bandwidth</th>
3131
<th>Size</th>
3232
<th>Frame Rate</th>
3333
<th>Video</th>
@@ -36,21 +36,46 @@
3636
<th>Time</th>
3737
</tr>
3838
<tr>
39-
<td>@<xsl:value-of select="naccepted"/></td>
40-
<td/>
41-
<td><xsl:value-of select="in"/></td>
42-
<td><xsl:value-of select="out"/></td>
43-
<td><xsl:value-of select="round(bwin div 1024)"/></td>
44-
<td><xsl:value-of select="round(bwout div 1024)"/></td>
45-
<td colspan="5"/>
39+
<td colspan="2">Accepted: <xsl:value-of select="naccepted"/></td>
4640
<td>
47-
<xsl:call-template name="showtime">
48-
<xsl:with-param name="time" select="/rtmp/uptime * 1000"/>
41+
<xsl:call-template name="showsize">
42+
<xsl:with-param name="size" select="in"/>
4943
</xsl:call-template>
5044
</td>
51-
</tr>
52-
<xsl:apply-templates select="server"/>
53-
</table>
45+
<td>
46+
<xsl:call-template name="showsize">
47+
<xsl:with-param name="size" select="out"/>
48+
</xsl:call-template>
49+
</td>
50+
<td>
51+
<xsl:call-template name="showsize">
52+
<xsl:with-param name="size" select="bwin div 8"/>
53+
</xsl:call-template>/s
54+
<br />
55+
<xsl:call-template name="showsize">
56+
<xsl:with-param name="size" select="bwin"/>
57+
<xsl:with-param name="bits" select="1"/>
58+
</xsl:call-template>/s
59+
</td>
60+
<td>
61+
<xsl:call-template name="showsize">
62+
<xsl:with-param name="size" select="bwout div 8"/>
63+
</xsl:call-template>/s
64+
<br />
65+
<xsl:call-template name="showsize">
66+
<xsl:with-param name="size" select="bwout"/>
67+
<xsl:with-param name="bits" select="1"/>
68+
</xsl:call-template>/s
69+
</td>
70+
<td colspan="5"/>
71+
<td>
72+
<xsl:call-template name="showtime">
73+
<xsl:with-param name="time" select="/rtmp/uptime * 1000"/>
74+
</xsl:call-template>
75+
</td>
76+
</tr>
77+
<xsl:apply-templates select="server"/>
78+
</table>
5479
</xsl:template>
5580

5681
<xsl:template match="server">
@@ -100,10 +125,35 @@
100125
</a>
101126
</td>
102127
<td align="middle"> <xsl:value-of select="nclients"/> </td>
103-
<td><xsl:value-of select="in"/></td>
104-
<td><xsl:value-of select="out"/></td>
105-
<td><xsl:value-of select="round(bwin div 1024)"/></td>
106-
<td><xsl:value-of select="round(bwout div 1024)"/></td>
128+
<td>
129+
<xsl:call-template name="showsize">
130+
<xsl:with-param name="size" select="in"/>
131+
</xsl:call-template>
132+
</td>
133+
<td>
134+
<xsl:call-template name="showsize">
135+
<xsl:with-param name="size" select="out"/>
136+
</xsl:call-template>
137+
</td>
138+
<td>
139+
<xsl:call-template name="showsize">
140+
<xsl:with-param name="size" select="bwin div 8"/>
141+
</xsl:call-template>/s
142+
<br />
143+
<xsl:call-template name="showsize">
144+
<xsl:with-param name="size" select="bwin"/>
145+
<xsl:with-param name="bits" select="1"/>
146+
</xsl:call-template>/s
147+
</td>
148+
<td><xsl:call-template name="showsize">
149+
<xsl:with-param name="size" select="bwout div 8"/>
150+
</xsl:call-template>/s
151+
<br />
152+
<xsl:call-template name="showsize">
153+
<xsl:with-param name="size" select="bwout"/>
154+
<xsl:with-param name="bits" select="1"/>
155+
</xsl:call-template>/s
156+
</td>
107157
<td><xsl:value-of select="meta/width"/>x<xsl:value-of select="meta/height"/></td>
108158
<td align="middle"><xsl:value-of select="meta/framerate"/></td>
109159
<td>
@@ -164,6 +214,29 @@
164214
<xsl:value-of select="$sec mod 60"/>s
165215
</xsl:template>
166216

217+
<xsl:template name="showsize">
218+
<xsl:param name="size"/>
219+
<xsl:param name="bits" select="0" />
220+
<xsl:variable name="sizen">
221+
<xsl:value-of select="floor($size div 1024)"/>
222+
</xsl:variable>
223+
<xsl:choose>
224+
<xsl:when test="$sizen &gt;= 1073741824">
225+
<xsl:value-of select="format-number($sizen div 1073741824,'#.###')"/> T</xsl:when>
226+
227+
<xsl:when test="$sizen &gt;= 1048576">
228+
<xsl:value-of select="format-number($sizen div 1048576,'#.###')"/> G</xsl:when>
229+
230+
<xsl:when test="$sizen &gt;= 1024">
231+
<xsl:value-of select="format-number($sizen div 1024,'#.##')"/> M</xsl:when>
232+
<xsl:when test="$sizen &gt;= 0">
233+
<xsl:value-of select="$sizen"/>K</xsl:when>
234+
</xsl:choose>
235+
<xsl:choose>
236+
<xsl:when test="$bits = 1">b</xsl:when>
237+
<xsl:otherwise>B</xsl:otherwise>
238+
</xsl:choose>
239+
</xsl:template>
167240

168241
<xsl:template name="streamstate">
169242
<xsl:choose>

0 commit comments

Comments
 (0)