1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Micro changes and refines.

This commit is contained in:
winlin 2022-09-30 18:11:59 +08:00
parent 378bffa34f
commit d65c699829
9 changed files with 14 additions and 23 deletions

View file

@ -313,7 +313,7 @@ srs_error_t srs_config_transform_vhost(SrsConfDirective* root)
SrsConfDirective* conf = *it; SrsConfDirective* conf = *it;
if (conf->name == "perf_stat" || conf->name == "queue_length") { if (conf->name == "perf_stat" || conf->name == "queue_length") {
dir->directives.erase(it); it = dir->directives.erase(it);
srs_freep(conf); srs_freep(conf);
continue; continue;
} }
@ -835,7 +835,7 @@ void SrsConfDirective::remove(SrsConfDirective* v)
{ {
std::vector<SrsConfDirective*>::iterator it; std::vector<SrsConfDirective*>::iterator it;
if ((it = std::find(directives.begin(), directives.end(), v)) != directives.end()) { 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; return;
} }
subscribes.erase(it); it = subscribes.erase(it);
} }
// LCOV_EXCL_START // LCOV_EXCL_START

View file

@ -325,6 +325,8 @@ SrsServer::SrsServer()
signal_manager = new SrsSignalManager(this); signal_manager = new SrsSignalManager(this);
conn_manager = new SrsResourceManager("TCP", true); conn_manager = new SrsResourceManager("TCP", true);
latest_version_ = new SrsLatestVersion(); latest_version_ = new SrsLatestVersion();
ppid = ::getppid();
rtmp_listener_ = new SrsMultipleTcpListeners(this); rtmp_listener_ = new SrsMultipleTcpListeners(this);
api_listener_ = new SrsTcpListener(this); api_listener_ = new SrsTcpListener(this);
apis_listener_ = new SrsTcpListener(this); apis_listener_ = new SrsTcpListener(this);
@ -333,7 +335,6 @@ SrsServer::SrsServer()
webrtc_listener_ = new SrsTcpListener(this); webrtc_listener_ = new SrsTcpListener(this);
stream_caster_flv_listener_ = new SrsHttpFlvListener(); stream_caster_flv_listener_ = new SrsHttpFlvListener();
stream_caster_mpegts_ = new SrsUdpCasterListener(); stream_caster_mpegts_ = new SrsUdpCasterListener();
ppid = ::getppid();
// donot new object in constructor, // donot new object in constructor,
// for some global instance is not ready now, // for some global instance is not ready now,

View file

@ -2711,7 +2711,7 @@ void SrsLiveSource::on_consumer_destroy(SrsLiveConsumer* consumer)
std::vector<SrsLiveConsumer*>::iterator it; std::vector<SrsLiveConsumer*>::iterator it;
it = std::find(consumers.begin(), consumers.end(), consumer); it = std::find(consumers.begin(), consumers.end(), consumer);
if (it != consumers.end()) { if (it != consumers.end()) {
consumers.erase(it); it = consumers.erase(it);
} }
if (consumers.empty()) { if (consumers.empty()) {

View file

@ -741,7 +741,7 @@ void SrsSrtSource::on_consumer_destroy(SrsSrtConsumer* consumer)
std::vector<SrsSrtConsumer*>::iterator it; std::vector<SrsSrtConsumer*>::iterator it;
it = std::find(consumers.begin(), consumers.end(), consumer); it = std::find(consumers.begin(), consumers.end(), consumer);
if (it != consumers.end()) { if (it != consumers.end()) {
consumers.erase(it); it = consumers.erase(it);
} }
} }

View file

@ -17,12 +17,10 @@
#include <srs_app_log.hpp> #include <srs_app_log.hpp>
#include <srs_app_async_call.hpp> #include <srs_app_async_call.hpp>
#include <srs_app_tencentcloud.hpp> #include <srs_app_tencentcloud.hpp>
#ifdef SRS_RTC #ifdef SRS_RTC
#include <srs_app_rtc_dtls.hpp> #include <srs_app_rtc_dtls.hpp>
#include <srs_app_rtc_conn.hpp> #include <srs_app_rtc_conn.hpp>
#endif #endif
#ifdef SRS_SRT #ifdef SRS_SRT
#include <srs_app_srt_source.hpp> #include <srs_app_srt_source.hpp>
#endif #endif

View file

@ -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). // 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 // 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 // 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 // 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 // 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. // 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 // 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 // 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 // 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. // 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 // 110x xxxx
// ISO/IEC 13818-3 or ISO/IEC 11172-3 or ISO/IEC 13818-7 or ISO/IEC // ISO/IEC 13818-3 or ISO/IEC 11172-3 or ISO/IEC 13818-7 or ISO/IEC

View file

@ -1826,7 +1826,7 @@ SrsJsonObject* SrsJsonObject::set(string key, SrsJsonAny* value)
if (key == name) { if (key == name) {
srs_freep(any); srs_freep(any);
properties.erase(it); it = properties.erase(it);
break; break;
} }
} }

View file

@ -51,7 +51,7 @@ srs_error_t prepare_main() {
} }
srs_freep(_srs_log); srs_freep(_srs_log);
_srs_log = new MockEmptyLog(SrsLogLevelDisabled); _srs_log = new MockEmptyLog(SrsLogLevelError);
if ((err = _srs_rtc_dtls_certificate->initialize()) != srs_success) { if ((err = _srs_rtc_dtls_certificate->initialize()) != srs_success) {
return srs_error_wrap(err, "rtc dtls certificate initialize"); return srs_error_wrap(err, "rtc dtls certificate initialize");

View file

@ -373,7 +373,7 @@ srs_error_t MockTsHandler::on_ts_message(SrsTsMessage* m)
{ {
srs_freep(msg); srs_freep(msg);
msg = m->detach(); msg = m->detach();
return srs_success; return srs_success;
} }
@ -1391,7 +1391,7 @@ VOID TEST(KernelFlvTest, FlvVSDecoderStreamClosed)
fs.close(); fs.close();
SrsFlvVodStreamDecoder dec; 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_EQ(100, ctx.get(100)->pid);
EXPECT_TRUE(NULL == ctx.get(200)); 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) VOID TEST(KernelTSTest, CoverContextEncode)