Skip to content

Commit ee90600

Browse files
committed
[fix] fix some potential bugs in stat module.
1 parent 0ff497b commit ee90600

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ngx_rtmp_stat_module.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -816,13 +816,17 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
816816
"%ui", codec->audio_channels) - buf);
817817
}
818818
if (codec->sample_rate) {
819-
if (f >= 1) NGX_RTMP_STAT_L(",");
819+
if (f == 1 || f == 2) {
820+
NGX_RTMP_STAT_L("\",");
821+
} else if (f == 3) {
822+
NGX_RTMP_STAT_L(",");
823+
}
820824
f = 4;
821825
NGX_RTMP_STAT_L("\"sample_rate\":");
822826
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
823827
"%ui", codec->sample_rate) - buf);
824828
}
825-
if (f >= 1 && f <= 3) {
829+
if (f == 1 || f == 2) {
826830
NGX_RTMP_STAT_L("\"");
827831
}
828832
NGX_RTMP_STAT_L("}}");

0 commit comments

Comments
 (0)