From d65c699829bcfd5ea57911b7a7fa7b345e6c58ab Mon Sep 17 00:00:00 2001 From: winlin Date: Fri, 30 Sep 2022 18:11:59 +0800 Subject: [PATCH] Micro changes and refines. --- trunk/src/app/srs_app_config.cpp | 6 +++--- trunk/src/app/srs_app_server.cpp | 3 ++- trunk/src/app/srs_app_source.cpp | 2 +- trunk/src/app/srs_app_srt_source.cpp | 2 +- trunk/src/app/srs_app_threads.cpp | 2 -- trunk/src/main/srs_main_ingest_hls.cpp | 6 +++--- trunk/src/protocol/srs_protocol_json.cpp | 2 +- trunk/src/utest/srs_utest.cpp | 2 +- trunk/src/utest/srs_utest_kernel.cpp | 12 ++---------- 9 files changed, 14 insertions(+), 23 deletions(-) diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index 27b222a39..e5af11207 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -313,7 +313,7 @@ srs_error_t srs_config_transform_vhost(SrsConfDirective* root) SrsConfDirective* conf = *it; if (conf->name == "perf_stat" || conf->name == "queue_length") { - dir->directives.erase(it); + it = dir->directives.erase(it); srs_freep(conf); continue; } @@ -835,7 +835,7 @@ void SrsConfDirective::remove(SrsConfDirective* v) { std::vector::iterator it; if ((it = std::find(directives.begin(), directives.end(), v)) != directives.end()) { - directives.erase(it); + it = directives.erase(it); } } @@ -1242,7 +1242,7 @@ void SrsConfig::unsubscribe(ISrsReloadHandler* handler) return; } - subscribes.erase(it); + it = subscribes.erase(it); } // LCOV_EXCL_START diff --git a/trunk/src/app/srs_app_server.cpp b/trunk/src/app/srs_app_server.cpp index 3ae01c6e1..0afb938bc 100644 --- a/trunk/src/app/srs_app_server.cpp +++ b/trunk/src/app/srs_app_server.cpp @@ -325,6 +325,8 @@ SrsServer::SrsServer() signal_manager = new SrsSignalManager(this); conn_manager = new SrsResourceManager("TCP", true); latest_version_ = new SrsLatestVersion(); + ppid = ::getppid(); + rtmp_listener_ = new SrsMultipleTcpListeners(this); api_listener_ = new SrsTcpListener(this); apis_listener_ = new SrsTcpListener(this); @@ -333,7 +335,6 @@ SrsServer::SrsServer() webrtc_listener_ = new SrsTcpListener(this); stream_caster_flv_listener_ = new SrsHttpFlvListener(); stream_caster_mpegts_ = new SrsUdpCasterListener(); - ppid = ::getppid(); // donot new object in constructor, // for some global instance is not ready now, diff --git a/trunk/src/app/srs_app_source.cpp b/trunk/src/app/srs_app_source.cpp index a6766631e..260f43838 100755 --- a/trunk/src/app/srs_app_source.cpp +++ b/trunk/src/app/srs_app_source.cpp @@ -2711,7 +2711,7 @@ void SrsLiveSource::on_consumer_destroy(SrsLiveConsumer* consumer) std::vector::iterator it; it = std::find(consumers.begin(), consumers.end(), consumer); if (it != consumers.end()) { - consumers.erase(it); + it = consumers.erase(it); } if (consumers.empty()) { diff --git a/trunk/src/app/srs_app_srt_source.cpp b/trunk/src/app/srs_app_srt_source.cpp index 45b76d69d..4042d9fbf 100644 --- a/trunk/src/app/srs_app_srt_source.cpp +++ b/trunk/src/app/srs_app_srt_source.cpp @@ -741,7 +741,7 @@ void SrsSrtSource::on_consumer_destroy(SrsSrtConsumer* consumer) std::vector::iterator it; it = std::find(consumers.begin(), consumers.end(), consumer); if (it != consumers.end()) { - consumers.erase(it); + it = consumers.erase(it); } } diff --git a/trunk/src/app/srs_app_threads.cpp b/trunk/src/app/srs_app_threads.cpp index 503e77db5..f7240eb1d 100644 --- a/trunk/src/app/srs_app_threads.cpp +++ b/trunk/src/app/srs_app_threads.cpp @@ -17,12 +17,10 @@ #include #include #include - #ifdef SRS_RTC #include #include #endif - #ifdef SRS_SRT #include #endif diff --git a/trunk/src/main/srs_main_ingest_hls.cpp b/trunk/src/main/srs_main_ingest_hls.cpp index 03f6befdb..a3e82ebf7 100644 --- a/trunk/src/main/srs_main_ingest_hls.cpp +++ b/trunk/src/main/srs_main_ingest_hls.cpp @@ -727,7 +727,7 @@ srs_error_t SrsIngestHlsOutput::on_ts_message(SrsTsMessage* msg) // because when audio stream_number is 0, the elementary is ADTS(ISO_IEC_14496-3-AAC-2001.pdf, page 75, 1.A.2.2 ADTS). // about the bytes of PES_packet_data_byte, defined in hls-mpeg-ts-iso13818-1.pdf, page 58 - // PES_packet_data_byte ¨C PES_packet_data_bytes shall be contiguous bytes of data from the elementary stream + // PES_packet_data_byte "C PES_packet_data_bytes shall be contiguous bytes of data from the elementary stream // indicated by the packet¡¯s stream_id or PID. When the elementary stream data conforms to ITU-T // Rec. H.262 | ISO/IEC 13818-2 or ISO/IEC 13818-3, the PES_packet_data_bytes shall be byte aligned to the bytes of this // Recommendation | International Standard. The byte-order of the elementary stream shall be preserved. The number of @@ -739,12 +739,12 @@ srs_error_t SrsIngestHlsOutput::on_ts_message(SrsTsMessage* msg) // PES_packet_data_byte field are user definable and will not be specified by ITU-T | ISO/IEC in the future. // about the bytes of stream_id, define in hls-mpeg-ts-iso13818-1.pdf, page 49 - // stream_id ¨C In Program Streams, the stream_id specifies the type and number of the elementary stream as defined by the + // stream_id "C In Program Streams, the stream_id specifies the type and number of the elementary stream as defined by the // stream_id Table 2-18. In Transport Streams, the stream_id may be set to any valid value which correctly describes the // elementary stream type as defined in Table 2-18. In Transport Streams, the elementary stream type is specified in the // Program Specific Information as specified in 2.4.4. - // about the stream_id table, define in Table 2-18 ¨C Stream_id assignments, hls-mpeg-ts-iso13818-1.pdf, page 52. + // about the stream_id table, define in Table 2-18 "C Stream_id assignments, hls-mpeg-ts-iso13818-1.pdf, page 52. // // 110x xxxx // ISO/IEC 13818-3 or ISO/IEC 11172-3 or ISO/IEC 13818-7 or ISO/IEC diff --git a/trunk/src/protocol/srs_protocol_json.cpp b/trunk/src/protocol/srs_protocol_json.cpp index 9d356c88a..7378f3522 100644 --- a/trunk/src/protocol/srs_protocol_json.cpp +++ b/trunk/src/protocol/srs_protocol_json.cpp @@ -1826,7 +1826,7 @@ SrsJsonObject* SrsJsonObject::set(string key, SrsJsonAny* value) if (key == name) { srs_freep(any); - properties.erase(it); + it = properties.erase(it); break; } } diff --git a/trunk/src/utest/srs_utest.cpp b/trunk/src/utest/srs_utest.cpp index fb9466f77..5277835a6 100644 --- a/trunk/src/utest/srs_utest.cpp +++ b/trunk/src/utest/srs_utest.cpp @@ -51,7 +51,7 @@ srs_error_t prepare_main() { } srs_freep(_srs_log); - _srs_log = new MockEmptyLog(SrsLogLevelDisabled); + _srs_log = new MockEmptyLog(SrsLogLevelError); if ((err = _srs_rtc_dtls_certificate->initialize()) != srs_success) { return srs_error_wrap(err, "rtc dtls certificate initialize"); diff --git a/trunk/src/utest/srs_utest_kernel.cpp b/trunk/src/utest/srs_utest_kernel.cpp index 60ef6bd0c..b9f0019db 100644 --- a/trunk/src/utest/srs_utest_kernel.cpp +++ b/trunk/src/utest/srs_utest_kernel.cpp @@ -373,7 +373,7 @@ srs_error_t MockTsHandler::on_ts_message(SrsTsMessage* m) { srs_freep(msg); msg = m->detach(); - + return srs_success; } @@ -1391,7 +1391,7 @@ VOID TEST(KernelFlvTest, FlvVSDecoderStreamClosed) fs.close(); SrsFlvVodStreamDecoder dec; - ASSERT_FALSE(srs_success == dec.initialize(&fs)); + HELPER_ASSERT_FAILED(dec.initialize(&fs)); } /** @@ -4817,14 +4817,6 @@ VOID TEST(KernelTSTest, CoverContextUtility) EXPECT_EQ(100, ctx.get(100)->pid); EXPECT_TRUE(NULL == ctx.get(200)); } - - if (true) { - SrsTsContext ctx; - EXPECT_EQ(0x47, ctx.sync_byte); - - ctx.set_sync_byte(0x01); - EXPECT_EQ(0x01, ctx.sync_byte); - } } VOID TEST(KernelTSTest, CoverContextEncode)