From ff3536996c13c5909f79f608f4aeb4a56bb2b797 Mon Sep 17 00:00:00 2001 From: Brad Murray Date: Mon, 16 Apr 2018 17:03:53 -0400 Subject: [PATCH] Add metadata audio+video data rate to stats --- ngx_rtmp_stat_module.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ngx_rtmp_stat_module.c b/ngx_rtmp_stat_module.c index ba1c646..325a2f1 100644 --- a/ngx_rtmp_stat_module.c +++ b/ngx_rtmp_stat_module.c @@ -555,7 +555,10 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll, NGX_RTMP_STAT_L(""); NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), "%.3f", codec->frame_rate) - buf); - NGX_RTMP_STAT_L(""); + NGX_RTMP_STAT_L(""); + NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), + "%.0f", codec->video_data_rate) - buf); + NGX_RTMP_STAT_L(""); cname = ngx_rtmp_get_video_codec_name(codec->video_codec_id); if (*cname) { @@ -615,6 +618,12 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll, "%ui", codec->sample_rate) - buf); NGX_RTMP_STAT_L(""); } + if (codec->audio_data_rate) { + NGX_RTMP_STAT_L(""); + NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), + "%0.2f", codec->audio_data_rate) - buf); + NGX_RTMP_STAT_L(""); + } NGX_RTMP_STAT_L(""); NGX_RTMP_STAT_L("\r\n");