diff --git a/README.md b/README.md index 390928519..15338e50d 100755 --- a/README.md +++ b/README.md @@ -201,6 +201,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 @@ -1763,6 +1764,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 [bug #1631]: https://github.com/ossrs/srs/issues/1631 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 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()