Skip to content

Commit 6096945

Browse files
committed
[fix] fix a JSON stat bug.
1 parent 3054375 commit 6096945

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

ngx_rtmp_stat_module.c

+2-14
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,6 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
507507
ngx_int_t n;
508508
ngx_uint_t nclients, total_nclients;
509509
ngx_uint_t f;
510-
ngx_flag_t prev;
511510
u_char buf[NGX_INT_T_LEN];
512511
u_char bbuf[NGX_INT32_LEN];
513512
ngx_rtmp_stat_loc_conf_t *slcf;
@@ -528,16 +527,11 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
528527

529528
total_nclients = 0;
530529
for (n = 0; n < lacf->nbuckets; ++n) {
531-
prev = 0;
532-
if (n && lacf->streams[n - 1]) {
533-
prev = 1;
534-
}
535-
536530
for (stream = lacf->streams[n]; stream; stream = stream->next) {
537531
if (slcf->format & NGX_RTMP_STAT_FORMAT_XML) {
538532
NGX_RTMP_STAT_L("<stream>\r\n");
539533
} else {
540-
if (prev || stream->next) {
534+
if (total_nclients || stream->next) {
541535
NGX_RTMP_STAT_L(",");
542536
}
543537

@@ -897,7 +891,6 @@ ngx_rtmp_stat_play(ngx_http_request_t *r, ngx_chain_t ***lll,
897891
ngx_rtmp_play_ctx_t *ctx, *sctx;
898892
ngx_rtmp_session_t *s;
899893
ngx_uint_t n, nclients, total_nclients;
900-
ngx_flag_t prev;
901894
u_char buf[NGX_INT_T_LEN];
902895
u_char bbuf[NGX_INT32_LEN];
903896
ngx_rtmp_stat_loc_conf_t *slcf;
@@ -917,19 +910,14 @@ ngx_rtmp_stat_play(ngx_http_request_t *r, ngx_chain_t ***lll,
917910

918911
total_nclients = 0;
919912
for (n = 0; n < pacf->nbuckets; ++n) {
920-
prev = 0;
921-
if (n && pacf->ctx[n - 1]) {
922-
prev = 1;
923-
}
924-
925913
for (ctx = pacf->ctx[n]; ctx; ) {
926914
if (slcf->format & NGX_RTMP_STAT_FORMAT_XML) {
927915
NGX_RTMP_STAT_L("<stream>\r\n");
928916
NGX_RTMP_STAT_L("<name>");
929917
NGX_RTMP_STAT_ECS(ctx->name);
930918
NGX_RTMP_STAT_L("</name>\r\n");
931919
} else {
932-
if (prev || ctx->next) {
920+
if (total_nclients || ctx->next) {
933921
NGX_RTMP_STAT_L(",");
934922
}
935923

0 commit comments

Comments
 (0)