@@ -504,9 +504,9 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
504
504
ngx_rtmp_live_ctx_t * ctx ;
505
505
ngx_rtmp_session_t * s ;
506
506
ngx_int_t n ;
507
- ngx_uint_t m ;
508
507
ngx_uint_t nclients , total_nclients ;
509
508
ngx_uint_t f ;
509
+ ngx_flag_t prev ;
510
510
u_char buf [NGX_INT_T_LEN ];
511
511
u_char bbuf [NGX_INT32_LEN ];
512
512
ngx_rtmp_stat_loc_conf_t * slcf ;
@@ -527,18 +527,19 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
527
527
528
528
total_nclients = 0 ;
529
529
for (n = 0 ; n < lacf -> nbuckets ; ++ n ) {
530
- m = 0 ;
531
- if (n > 0 && lacf -> streams [n - 1 ]) {
532
- m = 1 ;
530
+ prev = 0 ;
531
+ if (n && lacf -> streams [n - 1 ]) {
532
+ prev = 1 ;
533
533
}
534
+
534
535
for (stream = lacf -> streams [n ]; stream ; stream = stream -> next ) {
535
-
536
536
if (slcf -> format & NGX_RTMP_STAT_FORMAT_XML ) {
537
537
NGX_RTMP_STAT_L ("<stream>\r\n" );
538
538
} else {
539
- if (m == 1 || stream -> next != NULL ) {
539
+ if (prev || stream -> next ) {
540
540
NGX_RTMP_STAT_L ("," );
541
541
}
542
+
542
543
NGX_RTMP_STAT_L ("{" );
543
544
}
544
545
@@ -895,7 +896,8 @@ ngx_rtmp_stat_play(ngx_http_request_t *r, ngx_chain_t ***lll,
895
896
{
896
897
ngx_rtmp_play_ctx_t * ctx , * sctx ;
897
898
ngx_rtmp_session_t * s ;
898
- ngx_uint_t m , n , nclients , total_nclients ;
899
+ ngx_uint_t n , nclients , total_nclients ;
900
+ ngx_flag_t prev ;
899
901
u_char buf [NGX_INT_T_LEN ];
900
902
u_char bbuf [NGX_INT32_LEN ];
901
903
ngx_rtmp_stat_loc_conf_t * slcf ;
@@ -915,21 +917,22 @@ ngx_rtmp_stat_play(ngx_http_request_t *r, ngx_chain_t ***lll,
915
917
916
918
total_nclients = 0 ;
917
919
for (n = 0 ; n < pacf -> nbuckets ; ++ n ) {
918
- m = 0 ;
919
- if (n > 0 && pacf -> ctx [n - 1 ]) {
920
- m = 1 ;
920
+ prev = 0 ;
921
+ if (n && pacf -> ctx [n - 1 ]) {
922
+ prev = 1 ;
921
923
}
924
+
922
925
for (ctx = pacf -> ctx [n ]; ctx ; ) {
923
-
924
926
if (slcf -> format & NGX_RTMP_STAT_FORMAT_XML ) {
925
927
NGX_RTMP_STAT_L ("<stream>\r\n" );
926
928
NGX_RTMP_STAT_L ("<name>" );
927
929
NGX_RTMP_STAT_ECS (ctx -> name );
928
930
NGX_RTMP_STAT_L ("</name>\r\n" );
929
931
} else {
930
- if (m == 1 || ctx -> next != NULL ) {
932
+ if (prev || ctx -> next ) {
931
933
NGX_RTMP_STAT_L ("," );
932
934
}
935
+
933
936
NGX_RTMP_STAT_L ("{\"name\":\"" );
934
937
NGX_RTMP_STAT_ECS (ctx -> name );
935
938
NGX_RTMP_STAT_L ("\",\"clients\":[" );
@@ -938,7 +941,6 @@ ngx_rtmp_stat_play(ngx_http_request_t *r, ngx_chain_t ***lll,
938
941
nclients = 0 ;
939
942
sctx = ctx ;
940
943
for (; ctx ; ctx = ctx -> next ) {
941
-
942
944
if (ngx_strcmp (ctx -> name , sctx -> name )) {
943
945
break ;
944
946
}
0 commit comments