diff --git a/README.md b/README.md index 8b3abdbb3..c25054532 100755 --- a/README.md +++ b/README.md @@ -176,6 +176,7 @@ The ports used by SRS: ## V4 changes +* v4.0, 2021-05-20, Fix build fail when disable RTC by --rtc=off. 4.0.118 * v4.0, 2021-05-19, Fix [#2362][bug #2362]: Allow WebRTC to play before publishing, for GB28181 as such. 4.0.117 * v4.0, 2021-05-18, Fix [#2355][bug #2355]: GB28181: Fix play by RTC bug. 4.0.116 * v4.0, 2021-05-15, SRT: Build SRT from source by SRS. 4.0.115 diff --git a/trunk/src/app/srs_app_hourglass.cpp b/trunk/src/app/srs_app_hourglass.cpp index feb4024e0..cb64a1941 100644 --- a/trunk/src/app/srs_app_hourglass.cpp +++ b/trunk/src/app/srs_app_hourglass.cpp @@ -33,6 +33,8 @@ using namespace std; #include SrsPps* _srs_pps_timer = NULL; +SrsPps* _srs_pps_conn = NULL; +SrsPps* _srs_pps_pub = NULL; extern SrsPps* _srs_pps_clock_15ms; extern SrsPps* _srs_pps_clock_20ms; diff --git a/trunk/src/app/srs_app_hybrid.cpp b/trunk/src/app/srs_app_hybrid.cpp index aa2e17d40..3316bb4eb 100644 --- a/trunk/src/app/srs_app_hybrid.cpp +++ b/trunk/src/app/srs_app_hybrid.cpp @@ -443,6 +443,7 @@ srs_error_t SrsHybridServer::on_timer(srs_utime_t interval) #endif string objs_desc; +#ifdef SRS_RTC _srs_pps_objs_rtps->update(); _srs_pps_objs_rraw->update(); _srs_pps_objs_rfua->update(); _srs_pps_objs_rbuf->update(); _srs_pps_objs_msgs->update(); _srs_pps_objs_rothers->update(); if (_srs_pps_objs_rtps->r10s() || _srs_pps_objs_rraw->r10s() || _srs_pps_objs_rfua->r10s() || _srs_pps_objs_rbuf->r10s() || _srs_pps_objs_msgs->r10s() || _srs_pps_objs_rothers->r10s()) { snprintf(buf, sizeof(buf), ", objs=(pkt:%d,raw:%d,fua:%d,msg:%d,oth:%d,buf:%d)", @@ -450,6 +451,7 @@ srs_error_t SrsHybridServer::on_timer(srs_utime_t interval) _srs_pps_objs_msgs->r10s(), _srs_pps_objs_rothers->r10s(), _srs_pps_objs_rbuf->r10s()); objs_desc = buf; } +#endif srs_trace("Hybrid cpu=%.2f%%,%dMB%s%s%s%s%s%s%s%s%s%s%s", u->percent * 100, memory, diff --git a/trunk/src/app/srs_app_rtc_conn.cpp b/trunk/src/app/srs_app_rtc_conn.cpp index a359e54cc..0b0c98f70 100644 --- a/trunk/src/app/srs_app_rtc_conn.cpp +++ b/trunk/src/app/srs_app_rtc_conn.cpp @@ -68,8 +68,6 @@ SrsPps* _srs_pps_srtps = NULL; SrsPps* _srs_pps_pli = NULL; SrsPps* _srs_pps_twcc = NULL; SrsPps* _srs_pps_rr = NULL; -SrsPps* _srs_pps_pub = NULL; -SrsPps* _srs_pps_conn = NULL; extern SrsPps* _srs_pps_snack; extern SrsPps* _srs_pps_snack2; diff --git a/trunk/src/app/srs_app_threads.cpp b/trunk/src/app/srs_app_threads.cpp index 8f4b52715..dab5df616 100644 --- a/trunk/src/app/srs_app_threads.cpp +++ b/trunk/src/app/srs_app_threads.cpp @@ -31,9 +31,12 @@ #include #include #include +#include + +#ifdef SRS_RTC #include #include -#include +#endif #include using namespace std; @@ -43,11 +46,14 @@ extern ISrsContext* _srs_context; extern SrsConfig* _srs_config; extern SrsStageManager* _srs_stages; + +#ifdef SRS_RTC extern SrsRtcBlackhole* _srs_blackhole; extern SrsResourceManager* _srs_rtc_manager; extern SrsResourceManager* _srs_rtc_manager; extern SrsDtlsCertificate* _srs_rtc_dtls_certificate; +#endif #include @@ -254,12 +260,24 @@ srs_error_t SrsCircuitBreaker::on_timer(srs_utime_t interval) // The hybrid thread cpu and memory. float thread_percent = stat->percent * 100; - if (enabled_ && (hybrid_high_water_level() || hybrid_critical_water_level() || _srs_pps_snack2->r10s())) { - srs_trace("CircuitBreaker: cpu=%.2f%%,%dMB, break=%d,%d,%d, cond=%.2f%%, snk=%d,%d,%d", + static char buf[128]; + + string snk_desc; +#ifdef SRS_RTC + if (_srs_pps_snack2->r10s()) { + snprintf(buf, sizeof(buf), ", snk=%d,%d,%d", + _srs_pps_snack2->r10s(), _srs_pps_snack3->r10s(), _srs_pps_snack4->r10s() // NACK packet,seqs sent. + ); + snk_desc = buf; + } +#endif + + if (enabled_ && (hybrid_high_water_level() || hybrid_critical_water_level())) { + srs_trace("CircuitBreaker: cpu=%.2f%%,%dMB, break=%d,%d,%d, cond=%.2f%%%s", u->percent * 100, memory, hybrid_high_water_level(), hybrid_critical_water_level(), hybrid_dying_water_level(), // Whether Circuit-Break is enable. thread_percent, // The conditions to enable Circuit-Breaker. - _srs_pps_snack2->r10s(), _srs_pps_snack3->r10s(), _srs_pps_snack4->r10s() // NACK packet,seqs sent. + snk_desc.c_str() ); } @@ -291,15 +309,17 @@ srs_error_t srs_thread_initialize() // The global objects which depends on ST. _srs_hybrid = new SrsHybridServer(); - _srs_rtc_sources = new SrsRtcSourceManager(); _srs_sources = new SrsLiveSourceManager(); _srs_stages = new SrsStageManager(); - _srs_blackhole = new SrsRtcBlackhole(); - _srs_rtc_manager = new SrsResourceManager("RTC", true); _srs_circuit_breaker = new SrsCircuitBreaker(); +#ifdef SRS_RTC + _srs_rtc_sources = new SrsRtcSourceManager(); + _srs_blackhole = new SrsRtcBlackhole(); + _srs_rtc_manager = new SrsResourceManager("RTC", true); _srs_rtc_dtls_certificate = new SrsDtlsCertificate(); +#endif // Initialize global pps, which depends on _srs_clock _srs_pps_ids = new SrsPps(); @@ -308,7 +328,10 @@ srs_error_t srs_thread_initialize() _srs_pps_dispose = new SrsPps(); _srs_pps_timer = new SrsPps(); + _srs_pps_conn = new SrsPps(); + _srs_pps_pub = new SrsPps(); +#ifdef SRS_RTC _srs_pps_snack = new SrsPps(); _srs_pps_snack2 = new SrsPps(); _srs_pps_snack3 = new SrsPps(); @@ -320,6 +343,7 @@ srs_error_t srs_thread_initialize() _srs_pps_rnack2 = new SrsPps(); _srs_pps_rhnack = new SrsPps(); _srs_pps_rmnack = new SrsPps(); +#endif #if defined(SRS_DEBUG) && defined(SRS_DEBUG_STATS) _srs_pps_recvfrom = new SrsPps(); @@ -377,30 +401,29 @@ srs_error_t srs_thread_initialize() _srs_pps_fast_addrs = new SrsPps(); _srs_pps_spkts = new SrsPps(); + _srs_pps_objs_msgs = new SrsPps(); +#ifdef SRS_RTC _srs_pps_sstuns = new SrsPps(); _srs_pps_srtcps = new SrsPps(); _srs_pps_srtps = new SrsPps(); - _srs_pps_pli = new SrsPps(); - _srs_pps_twcc = new SrsPps(); - _srs_pps_rr = new SrsPps(); - _srs_pps_pub = new SrsPps(); - _srs_pps_conn = new SrsPps(); - _srs_pps_rstuns = new SrsPps(); _srs_pps_rrtps = new SrsPps(); _srs_pps_rrtcps = new SrsPps(); _srs_pps_aloss2 = new SrsPps(); - _srs_pps_objs_msgs = new SrsPps(); + _srs_pps_pli = new SrsPps(); + _srs_pps_twcc = new SrsPps(); + _srs_pps_rr = new SrsPps(); _srs_pps_objs_rtps = new SrsPps(); _srs_pps_objs_rraw = new SrsPps(); _srs_pps_objs_rfua = new SrsPps(); _srs_pps_objs_rbuf = new SrsPps(); _srs_pps_objs_rothers = new SrsPps(); +#endif return err; } diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index 9cac0d463..a789747f8 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -26,6 +26,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 117 +#define VERSION_REVISION 118 #endif