From 9c11e5077f5f73550df6e3f0b2d1a1270eef95ed Mon Sep 17 00:00:00 2001 From: winlin Date: Sun, 27 Sep 2020 16:21:15 +0800 Subject: [PATCH 1/2] Fix Kbps resample bug --- trunk/src/protocol/srs_protocol_kbps.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/trunk/src/protocol/srs_protocol_kbps.cpp b/trunk/src/protocol/srs_protocol_kbps.cpp index 063b0dfae..11f119a53 100644 --- a/trunk/src/protocol/srs_protocol_kbps.cpp +++ b/trunk/src/protocol/srs_protocol_kbps.cpp @@ -166,22 +166,24 @@ void SrsKbps::set_io(ISrsProtocolStatistic* in, ISrsProtocolStatistic* out) int SrsKbps::get_send_kbps() { - srs_utime_t duration = clk->now() - is.starttime; + int duration = srsu2ms(clk->now() - is.starttime); if (duration <= 0) { return 0; } + int64_t bytes = get_send_bytes(); - return (int)(bytes * 8 / srsu2ms(duration)); + return (int)(bytes * 8 / duration); } int SrsKbps::get_recv_kbps() { - srs_utime_t duration = clk->now() - os.starttime; + int duration = srsu2ms(clk->now() - os.starttime); if (duration <= 0) { return 0; } + int64_t bytes = get_recv_bytes(); - return (int)(bytes * 8 / srsu2ms(duration)); + return (int)(bytes * 8 / duration); } int SrsKbps::get_send_kbps_30s() From 3f3a23f97808afdef95ba0a7db0e71fc5347a7e6 Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 14 Oct 2020 11:38:54 +0800 Subject: [PATCH 2/2] Fix #1987, Fix Kbps resample bug. 3.0.145 --- README.md | 2 ++ trunk/src/core/srs_core_version3.hpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a39abde0b..727c0e0d5 100755 --- a/README.md +++ b/README.md @@ -149,6 +149,7 @@ For previous versions, please read: ## V3 changes +* v3.0, 2020-10-14, Fix [#1987][bug #1987], Fix Kbps resample bug. 3.0.145 * v3.0, 2020-10-10, [3.0 release1(3.0.144)][r3.0r1] released. 122674 lines. * v3.0, 2020-10-10, Fix [#1780][bug #1780], build fail on Ubuntu20(focal). 3.0.144 * v3.0, 2020-09-14, Prevent stop ingest for multiple times. 3.0.143 @@ -1699,6 +1700,7 @@ Winlin [bug #1619]: https://github.com/ossrs/srs/issues/1619 [bug #1629]: https://github.com/ossrs/srs/issues/1629 [bug #1780]: https://github.com/ossrs/srs/issues/1780 +[bug #1987]: https://github.com/ossrs/srs/issues/1987 [bug #yyyyyyyyyyyyy]: https://github.com/ossrs/srs/issues/yyyyyyyyyyyyy [exo #828]: https://github.com/google/ExoPlayer/pull/828 diff --git a/trunk/src/core/srs_core_version3.hpp b/trunk/src/core/srs_core_version3.hpp index ef1590d42..6b933fbfc 100644 --- a/trunk/src/core/srs_core_version3.hpp +++ b/trunk/src/core/srs_core_version3.hpp @@ -24,6 +24,6 @@ #ifndef SRS_CORE_VERSION3_HPP #define SRS_CORE_VERSION3_HPP -#define SRS_VERSION3_REVISION 144 +#define SRS_VERSION3_REVISION 145 #endif