From b3485396877f694909a654bf68932d4174abd334 Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 31 Oct 2020 17:53:00 +0800 Subject: [PATCH] Remove some global elements for debugging. 3.0.152 --- README.md | 3 +++ trunk/src/app/srs_app_bandwidth.cpp | 12 ++++++------ trunk/src/app/srs_app_config.cpp | 18 +++++++++--------- trunk/src/app/srs_app_config.hpp | 10 +++++----- trunk/src/app/srs_app_source.cpp | 2 +- trunk/src/app/srs_app_source.hpp | 2 +- trunk/src/core/srs_core_version3.hpp | 2 +- trunk/src/libs/srs_lib_bandwidth.cpp | 14 +++++++------- trunk/src/protocol/srs_protocol_amf0.cpp | 4 ++-- trunk/src/protocol/srs_protocol_amf0.hpp | 12 ++++++------ trunk/src/protocol/srs_rtmp_handshake.cpp | 4 ++-- trunk/src/protocol/srs_rtmp_handshake.hpp | 2 +- trunk/src/utest/srs_utest_amf0.cpp | 2 +- trunk/src/utest/srs_utest_config.hpp | 2 +- trunk/src/utest/srs_utest_protocol.cpp | 4 ++-- trunk/src/utest/srs_utest_protocol.hpp | 2 +- 16 files changed, 49 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 1a9475720..7754747f7 100755 --- a/README.md +++ b/README.md @@ -145,6 +145,9 @@ For previous versions, please read: ## V3 changes +* v3.0, 2020-10-31, Remove some global elements for debugging. 3.0.152 +* v3.0, 2020-10-31, Use global _srs_server for debugging. 3.0.151 +* v3.0, 2020-10-31, Refine source cid, track previous one. 3.0.150 * v3.0, 2020-10-25, Add hls.realtime.conf for low-latency HLS. 3.0.149 * v3.0, 2020-10-24, Refine script and startup logs. 3.0.148 * v3.0, 2020-10-23, Allow FFmpeg if exists at /usr/local/bin/ffmpeg. 3.0.147 diff --git a/trunk/src/app/srs_app_bandwidth.cpp b/trunk/src/app/srs_app_bandwidth.cpp index f89cabe03..750c8d62f 100644 --- a/trunk/src/app/srs_app_bandwidth.cpp +++ b/trunk/src/app/srs_app_bandwidth.cpp @@ -91,7 +91,7 @@ bool _bandwidth_is_stopped_publish(SrsBandwidthPacket* pkt) { return pkt->is_stopped_publish(); } -srs_error_t _srs_expect_bandwidth_packet(SrsRtmpServer* rtmp, _CheckPacketType pfn) +srs_error_t srs_expect_bandwidth_packet(SrsRtmpServer* rtmp, _CheckPacketType pfn) { srs_error_t err = srs_success; @@ -241,7 +241,7 @@ srs_error_t SrsBandwidth::play_start(SrsBandwidthSample* sample, SrsKbpsLimit* l } } - if ((err = _srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_starting_play)) != srs_success) { + if ((err = srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_starting_play)) != srs_success) { return srs_error_wrap(err, "expect bandwidth"); } @@ -304,7 +304,7 @@ srs_error_t SrsBandwidth::play_stop(SrsBandwidthSample* sample, SrsKbpsLimit* /* } } - if ((err = _srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_stopped_play)) != srs_success) { + if ((err = srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_stopped_play)) != srs_success) { return srs_error_wrap(err, "expect bandwidth"); } @@ -328,7 +328,7 @@ srs_error_t SrsBandwidth::publish_start(SrsBandwidthSample* sample, SrsKbpsLimit } } - if ((err = _srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_starting_publish)) != srs_success) { + if ((err = srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_starting_publish)) != srs_success) { return srs_error_wrap(err, "expect packet"); } @@ -388,7 +388,7 @@ srs_error_t SrsBandwidth::publish_stop(SrsBandwidthSample* sample, SrsKbpsLimit* // we just ignore the packet and send the bandwidth test data. bool is_flash = (_req->swfUrl != ""); if (!is_flash) { - if ((err = _srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_stopped_publish)) != srs_success) { + if ((err = srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_stopped_publish)) != srs_success) { return srs_error_wrap(err, "expect bandwidth"); } } @@ -422,7 +422,7 @@ srs_error_t SrsBandwidth::do_final(SrsBandwidthSample& play_sample, SrsBandwidth bool is_flash = (_req->swfUrl != ""); if (!is_flash) { // ignore any error. - err = _srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_final); + err = srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_final); srs_error_reset(err); } diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index 6b7c27d58..62a324943 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -53,7 +53,7 @@ using namespace std; #include #include -using namespace _srs_internal; +using namespace srs_internal; // @global the version to identify the core. const char* _srs_version = "XCORE-" RTMP_SIG_SRS_SERVER; @@ -88,7 +88,7 @@ bool is_common_space(char ch) return (ch == ' ' || ch == '\t' || ch == SRS_CR || ch == SRS_LF); } -namespace _srs_internal +namespace srs_internal { SrsConfigBuffer::SrsConfigBuffer() { @@ -4404,20 +4404,20 @@ int SrsConfig::get_time_jitter(string vhost) SrsConfDirective* conf = get_vhost(vhost); if (!conf) { - return _srs_time_jitter_string2int(DEFAULT); + return srs_time_jitter_string2int(DEFAULT); } conf = conf->get("play"); if (!conf) { - return _srs_time_jitter_string2int(DEFAULT); + return srs_time_jitter_string2int(DEFAULT); } conf = conf->get("time_jitter"); if (!conf || conf->arg0().empty()) { - return _srs_time_jitter_string2int(DEFAULT); + return srs_time_jitter_string2int(DEFAULT); } - return _srs_time_jitter_string2int(conf->arg0()); + return srs_time_jitter_string2int(conf->arg0()); } bool SrsConfig::get_mix_correct(string vhost) @@ -6585,15 +6585,15 @@ int SrsConfig::get_dvr_time_jitter(string vhost) SrsConfDirective* conf = get_dvr(vhost); if (!conf) { - return _srs_time_jitter_string2int(DEFAULT); + return srs_time_jitter_string2int(DEFAULT); } conf = conf->get("time_jitter"); if (!conf || conf->arg0().empty()) { - return _srs_time_jitter_string2int(DEFAULT); + return srs_time_jitter_string2int(DEFAULT); } - return _srs_time_jitter_string2int(conf->arg0()); + return srs_time_jitter_string2int(conf->arg0()); } bool SrsConfig::get_http_api_enabled() diff --git a/trunk/src/app/srs_app_config.hpp b/trunk/src/app/srs_app_config.hpp index 02c6b842b..d0e6f2928 100644 --- a/trunk/src/app/srs_app_config.hpp +++ b/trunk/src/app/srs_app_config.hpp @@ -77,7 +77,7 @@ bool srs_vector_actual_equals(const std::vector& a, const std::vector& b) return true; } -namespace _srs_internal +namespace srs_internal { // The buffer of config content. class SrsConfigBuffer @@ -228,7 +228,7 @@ public: // Parse utilities public: // Parse config directive from file buffer. - virtual srs_error_t parse(_srs_internal::SrsConfigBuffer* buffer); + virtual srs_error_t parse(srs_internal::SrsConfigBuffer* buffer); // Marshal the directive to writer. // @param level, the root is level0, all its directives are level1, and so on. virtual srs_error_t persistence(SrsFileWriter* writer, int level); @@ -252,13 +252,13 @@ private: // 1. read a token(directive args and a ret flag), // 2. initialize the directive by args, args[0] is name, args[1-N] is args of directive, // 3. if ret flag indicates there are child-directives, read_conf(directive, block) recursively. - virtual srs_error_t parse_conf(_srs_internal::SrsConfigBuffer* buffer, SrsDirectiveType type); + virtual srs_error_t parse_conf(srs_internal::SrsConfigBuffer* buffer, SrsDirectiveType type); // Read a token from buffer. // A token, is the directive args and a flag indicates whether has child-directives. // @param args, the output directive args, the first is the directive name, left is the args. // @param line_start, the actual start line of directive. // @return, an error code indicates error or has child-directives. - virtual srs_error_t read_token(_srs_internal::SrsConfigBuffer* buffer, std::vector& args, int& line_start); + virtual srs_error_t read_token(srs_internal::SrsConfigBuffer* buffer, std::vector& args, int& line_start); }; // The config service provider. @@ -422,7 +422,7 @@ protected: // Parse config from the buffer. // @param buffer, the config buffer, user must delete it. // @remark, use protected for the utest to override with mock. - virtual srs_error_t parse_buffer(_srs_internal::SrsConfigBuffer* buffer); + virtual srs_error_t parse_buffer(srs_internal::SrsConfigBuffer* buffer); // global env public: // Get the current work directory. diff --git a/trunk/src/app/srs_app_source.cpp b/trunk/src/app/srs_app_source.cpp index bc655cbe5..2c62fee40 100755 --- a/trunk/src/app/srs_app_source.cpp +++ b/trunk/src/app/srs_app_source.cpp @@ -64,7 +64,7 @@ using namespace std; // the time to cleanup source. #define SRS_SOURCE_CLEANUP (30 * SRS_UTIME_SECONDS) -int _srs_time_jitter_string2int(std::string time_jitter) +int srs_time_jitter_string2int(std::string time_jitter) { if (time_jitter == "full") { return SrsRtmpJitterAlgorithmFULL; diff --git a/trunk/src/app/srs_app_source.hpp b/trunk/src/app/srs_app_source.hpp index f93bc314d..273493a17 100644 --- a/trunk/src/app/srs_app_source.hpp +++ b/trunk/src/app/srs_app_source.hpp @@ -72,7 +72,7 @@ enum SrsRtmpJitterAlgorithm SrsRtmpJitterAlgorithmZERO, SrsRtmpJitterAlgorithmOFF }; -int _srs_time_jitter_string2int(std::string time_jitter); +int srs_time_jitter_string2int(std::string time_jitter); // Time jitter detect and correct, to ensure the rtmp stream is monotonically. class SrsRtmpJitter diff --git a/trunk/src/core/srs_core_version3.hpp b/trunk/src/core/srs_core_version3.hpp index e931fd18d..4f7a26305 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 151 +#define SRS_VERSION3_REVISION 152 #endif diff --git a/trunk/src/libs/srs_lib_bandwidth.cpp b/trunk/src/libs/srs_lib_bandwidth.cpp index 611c2c6b8..19d84ca7a 100644 --- a/trunk/src/libs/srs_lib_bandwidth.cpp +++ b/trunk/src/libs/srs_lib_bandwidth.cpp @@ -62,7 +62,7 @@ bool _bandwidth_is_finish(SrsBandwidthPacket* pkt) { return pkt->is_finish(); } -int _srs_expect_bandwidth_packet(SrsRtmpClient* rtmp, _CheckPacketType pfn) +int srs_expect_bandwidth_packet(SrsRtmpClient* rtmp, _CheckPacketType pfn) { int ret = ERROR_SUCCESS; srs_error_t err = srs_success; @@ -86,7 +86,7 @@ int _srs_expect_bandwidth_packet(SrsRtmpClient* rtmp, _CheckPacketType pfn) return ret; } -int _srs_expect_bandwidth_packet2(SrsRtmpClient* rtmp, _CheckPacketType pfn, SrsBandwidthPacket** ppkt) +int srs_expect_bandwidth_packet2(SrsRtmpClient* rtmp, _CheckPacketType pfn, SrsBandwidthPacket** ppkt) { int ret = ERROR_SUCCESS; srs_error_t err = srs_success; @@ -202,7 +202,7 @@ int SrsBandwidthClient::play_start() int ret = ERROR_SUCCESS; srs_error_t err = srs_success; - if ((ret = _srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_start_play)) != ERROR_SUCCESS) { + if ((ret = srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_start_play)) != ERROR_SUCCESS) { return ret; } srs_info("BW check recv play begin request."); @@ -234,7 +234,7 @@ int SrsBandwidthClient::play_stop() int ret = ERROR_SUCCESS; srs_error_t err = srs_success; - if ((ret = _srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_stop_play)) != ERROR_SUCCESS) { + if ((ret = srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_stop_play)) != ERROR_SUCCESS) { return ret; } srs_info("BW check recv play stop request."); @@ -262,7 +262,7 @@ int SrsBandwidthClient::publish_start(int& duration_ms, int& play_kbps) if (true) { SrsBandwidthPacket* pkt = NULL; - if ((ret = _srs_expect_bandwidth_packet2(_rtmp, _bandwidth_is_start_publish, &pkt)) != ERROR_SUCCESS) { + if ((ret = srs_expect_bandwidth_packet2(_rtmp, _bandwidth_is_start_publish, &pkt)) != ERROR_SUCCESS) { return ret; } SrsAutoFree(SrsBandwidthPacket, pkt); @@ -367,7 +367,7 @@ int SrsBandwidthClient::publish_stop() } srs_info("BW client stop publish request."); - if ((ret = _srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_stop_publish)) != ERROR_SUCCESS) { + if ((ret = srs_expect_bandwidth_packet(_rtmp, _bandwidth_is_stop_publish)) != ERROR_SUCCESS) { return ret; } srs_info("BW check recv publish stop request."); @@ -393,7 +393,7 @@ int SrsBandwidthClient::do_final(SrsBandwidthPacket** ppkt) int ret = ERROR_SUCCESS; srs_error_t err = srs_success; - if ((ret = _srs_expect_bandwidth_packet2(_rtmp, _bandwidth_is_finish, ppkt)) != ERROR_SUCCESS) { + if ((ret = srs_expect_bandwidth_packet2(_rtmp, _bandwidth_is_finish, ppkt)) != ERROR_SUCCESS) { return ret; } srs_info("BW check recv finish/report request."); diff --git a/trunk/src/protocol/srs_protocol_amf0.cpp b/trunk/src/protocol/srs_protocol_amf0.cpp index 3af4d2d7e..7d2ed6ce6 100644 --- a/trunk/src/protocol/srs_protocol_amf0.cpp +++ b/trunk/src/protocol/srs_protocol_amf0.cpp @@ -33,7 +33,7 @@ using namespace std; #include #include -using namespace _srs_internal; +using namespace srs_internal; // AMF0 marker #define RTMP_AMF0_Number 0x00 @@ -1703,7 +1703,7 @@ srs_error_t srs_amf0_write_undefined(SrsBuffer* stream) return err; } -namespace _srs_internal +namespace srs_internal { srs_error_t srs_amf0_read_utf8(SrsBuffer* stream, string& value) { diff --git a/trunk/src/protocol/srs_protocol_amf0.hpp b/trunk/src/protocol/srs_protocol_amf0.hpp index 7af7c700b..7ab16fc3c 100644 --- a/trunk/src/protocol/srs_protocol_amf0.hpp +++ b/trunk/src/protocol/srs_protocol_amf0.hpp @@ -36,7 +36,7 @@ class SrsAmf0StrictArray; class SrsJsonAny; // internal objects, user should never use it. -namespace _srs_internal +namespace srs_internal { class SrsUnSortedHashtable; class SrsAmf0ObjectEOF; @@ -335,8 +335,8 @@ public: class SrsAmf0Object : public SrsAmf0Any { private: - _srs_internal::SrsUnSortedHashtable* properties; - _srs_internal::SrsAmf0ObjectEOF* eof; + srs_internal::SrsUnSortedHashtable* properties; + srs_internal::SrsAmf0ObjectEOF* eof; private: friend class SrsAmf0Any; /** @@ -425,8 +425,8 @@ public: class SrsAmf0EcmaArray : public SrsAmf0Any { private: - _srs_internal::SrsUnSortedHashtable* properties; - _srs_internal::SrsAmf0ObjectEOF* eof; + srs_internal::SrsUnSortedHashtable* properties; + srs_internal::SrsAmf0ObjectEOF* eof; int32_t _count; private: friend class SrsAmf0Any; @@ -626,7 +626,7 @@ extern srs_error_t srs_amf0_read_undefined(SrsBuffer* stream); extern srs_error_t srs_amf0_write_undefined(SrsBuffer* stream); // internal objects, user should never use it. -namespace _srs_internal +namespace srs_internal { /** * read amf0 string from stream. diff --git a/trunk/src/protocol/srs_rtmp_handshake.cpp b/trunk/src/protocol/srs_rtmp_handshake.cpp index 3d0a8a9b1..9204c6807 100644 --- a/trunk/src/protocol/srs_rtmp_handshake.cpp +++ b/trunk/src/protocol/srs_rtmp_handshake.cpp @@ -34,7 +34,7 @@ #include #include -using namespace _srs_internal; +using namespace srs_internal; // for openssl_HMACsha256 #include @@ -111,7 +111,7 @@ static int DH_set_length(DH *dh, long length) #endif -namespace _srs_internal +namespace srs_internal { // 68bytes FMS key which is used to sign the sever packet. uint8_t SrsGenuineFMSKey[] = { diff --git a/trunk/src/protocol/srs_rtmp_handshake.hpp b/trunk/src/protocol/srs_rtmp_handshake.hpp index bfe7b1bd0..d6ecec547 100644 --- a/trunk/src/protocol/srs_rtmp_handshake.hpp +++ b/trunk/src/protocol/srs_rtmp_handshake.hpp @@ -34,7 +34,7 @@ class SrsBuffer; // For openssl. #include -namespace _srs_internal +namespace srs_internal { // The digest key generate size. #define SRS_OpensslHashSize 512 diff --git a/trunk/src/utest/srs_utest_amf0.cpp b/trunk/src/utest/srs_utest_amf0.cpp index a76f22464..4eeb75209 100644 --- a/trunk/src/utest/srs_utest_amf0.cpp +++ b/trunk/src/utest/srs_utest_amf0.cpp @@ -32,7 +32,7 @@ using namespace std; #include #include #include -using namespace _srs_internal; +using namespace srs_internal; /** * main scenario to use amf0. diff --git a/trunk/src/utest/srs_utest_config.hpp b/trunk/src/utest/srs_utest_config.hpp index b3355691c..fc07fb97a 100644 --- a/trunk/src/utest/srs_utest_config.hpp +++ b/trunk/src/utest/srs_utest_config.hpp @@ -35,7 +35,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define _MIN_OK_CONF "listen 1935; " -class MockSrsConfigBuffer : public _srs_internal::SrsConfigBuffer +class MockSrsConfigBuffer : public srs_internal::SrsConfigBuffer { public: MockSrsConfigBuffer(std::string buf); diff --git a/trunk/src/utest/srs_utest_protocol.cpp b/trunk/src/utest/srs_utest_protocol.cpp index 2b13b2835..fa2ee73e3 100644 --- a/trunk/src/utest/srs_utest_protocol.cpp +++ b/trunk/src/utest/srs_utest_protocol.cpp @@ -352,7 +352,7 @@ VOID TEST(ProtocolHandshakeTest, OpensslSha256) // verify the dh key VOID TEST(ProtocolHandshakeTest, DHKey) { - _srs_internal::SrsDH dh; + srs_internal::SrsDH dh; ASSERT_TRUE(ERROR_SUCCESS == dh.initialize(true)); @@ -368,7 +368,7 @@ VOID TEST(ProtocolHandshakeTest, DHKey) EXPECT_TRUE(srs_bytes_equals(pub_key1, pub_key2, 128)); // another dh - _srs_internal::SrsDH dh0; + srs_internal::SrsDH dh0; ASSERT_TRUE(ERROR_SUCCESS == dh0.initialize(true)); diff --git a/trunk/src/utest/srs_utest_protocol.hpp b/trunk/src/utest/srs_utest_protocol.hpp index 4a133127d..f81b3eb3b 100644 --- a/trunk/src/utest/srs_utest_protocol.hpp +++ b/trunk/src/utest/srs_utest_protocol.hpp @@ -37,7 +37,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -using namespace _srs_internal; +using namespace srs_internal; #include