diff --git a/ngx_rtmp_bandwidth.h b/ngx_rtmp_bandwidth.h
index 0d9d323..b498482 100644
--- a/ngx_rtmp_bandwidth.h
+++ b/ngx_rtmp_bandwidth.h
@@ -13,7 +13,7 @@
/* Bandwidth update interval in seconds */
-#define NGX_RTMP_BANDWIDTH_INTERVAL 60
+#define NGX_RTMP_BANDWIDTH_INTERVAL 10
typedef struct {
diff --git a/ngx_rtmp_live_module.c b/ngx_rtmp_live_module.c
index eeff441..5bebb9e 100644
--- a/ngx_rtmp_live_module.c
+++ b/ngx_rtmp_live_module.c
@@ -1028,6 +1028,11 @@ ngx_rtmp_live_av(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_rtmp_update_bandwidth(&ctx->stream->bw_in, h->mlen);
ngx_rtmp_update_bandwidth(&ctx->stream->bw_out, h->mlen * peers);
+ ngx_rtmp_update_bandwidth(h->type == NGX_RTMP_MSG_AUDIO ?
+ &ctx->stream->bw_in_audio :
+ &ctx->stream->bw_in_video,
+ h->mlen);
+
return NGX_OK;
}
diff --git a/ngx_rtmp_live_module.h b/ngx_rtmp_live_module.h
index 5d9612c..71eca36 100644
--- a/ngx_rtmp_live_module.h
+++ b/ngx_rtmp_live_module.h
@@ -48,6 +48,8 @@ struct ngx_rtmp_live_stream_s {
ngx_rtmp_live_stream_t *next;
ngx_rtmp_live_ctx_t *ctx;
ngx_rtmp_bandwidth_t bw_in;
+ ngx_rtmp_bandwidth_t bw_in_audio;
+ ngx_rtmp_bandwidth_t bw_in_video;
ngx_rtmp_bandwidth_t bw_out;
ngx_msec_t epoch;
unsigned active:1;
diff --git a/ngx_rtmp_stat_module.c b/ngx_rtmp_stat_module.c
index 975ca93..5e67770 100644
--- a/ngx_rtmp_stat_module.c
+++ b/ngx_rtmp_stat_module.c
@@ -245,34 +245,39 @@ ngx_rtmp_stat_output(ngx_http_request_t *r, ngx_chain_t ***lll,
#define NGX_RTMP_STAT_ECS(s) NGX_RTMP_STAT_E((s), ngx_strlen(s))
+#define NGX_RTMP_STAT_BW 0x01
+#define NGX_RTMP_STAT_BYTES 0x02
+#define NGX_RTMP_STAT_BW_BYTES 0x03
+
+
static void
ngx_rtmp_stat_bw(ngx_http_request_t *r, ngx_chain_t ***lll,
- ngx_rtmp_bandwidth_t *bw_in, ngx_rtmp_bandwidth_t *bw_out)
+ ngx_rtmp_bandwidth_t *bw, char *name,
+ ngx_uint_t flags)
{
u_char buf[NGX_INT64_LEN + 1];
- ngx_rtmp_update_bandwidth(bw_in, 0);
- ngx_rtmp_update_bandwidth(bw_out, 0);
+ ngx_rtmp_update_bandwidth(bw, 0);
- NGX_RTMP_STAT_L("