mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
SRT: Support transform tlpkdrop to tlpktdrop. 5.0.98 (#3279)
This commit is contained in:
parent
fdbfe59784
commit
5cadfff2e5
6 changed files with 42 additions and 8 deletions
|
@ -331,6 +331,19 @@ srs_error_t srs_config_transform_vhost(SrsConfDirective* root)
|
|||
}
|
||||
}
|
||||
|
||||
// SRS4.0, rename the config:
|
||||
// SRS4:
|
||||
// srt_server { tlpkdrop; }
|
||||
// SRS5:
|
||||
// srt_server { tlpktdrop; }
|
||||
if (dir->name == "srt_server") {
|
||||
std::vector<SrsConfDirective*>::iterator it;
|
||||
for (it = dir->directives.begin(); it != dir->directives.end(); ++it) {
|
||||
SrsConfDirective* conf = *it;
|
||||
if (conf->name == "tlpkdrop") conf->name = "tlpktdrop";
|
||||
}
|
||||
}
|
||||
|
||||
// SRS5.0, GB28181 allows unused config.
|
||||
// stream_caster {
|
||||
// caster gb28181; tcp_enable; rtp_port_min; rtp_port_max; wait_keyframe; rtp_idle_timeout;
|
||||
|
@ -7733,11 +7746,7 @@ bool SrsConfig::get_srto_tlpktdrop()
|
|||
return DEFAULT;
|
||||
}
|
||||
|
||||
SrsConfDirective* conf = srt_server_conf->get("tlpkdrop");
|
||||
if (!conf) {
|
||||
// make it compatible tlpkdrop and tlpktdrop opt.
|
||||
conf = srt_server_conf->get("tlpktdrop");
|
||||
}
|
||||
SrsConfDirective* conf = srt_server_conf->get("tlpktdrop");
|
||||
if (!conf || conf->arg0().empty()) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ srs_error_t SrsSrtAcceptor::set_srt_opt()
|
|||
}
|
||||
|
||||
if ((err = srs_srt_set_tlpktdrop(listener_->fd(), _srs_config->get_srto_tlpktdrop())) != srs_success) {
|
||||
return srs_error_wrap(err, "set opt tlpkdrop=%d failed", _srs_config->get_srto_tlpktdrop());
|
||||
return srs_error_wrap(err, "set opt tlpktdrop=%d failed", _srs_config->get_srto_tlpktdrop());
|
||||
}
|
||||
|
||||
if ((err = srs_srt_set_connect_timeout(listener_->fd(), srsu2msi(_srs_config->get_srto_conntimeout()))) != srs_success) {
|
||||
|
|
|
@ -295,7 +295,7 @@ srs_error_t SrsRtmpFromSrtBridge::on_packet(SrsSrtPacket *pkt)
|
|||
SrsAutoFree(SrsBuffer, stream);
|
||||
|
||||
// Process each ts packet. Note that the jitter of UDP may cause video glitch when packet loss or wrong seq. We
|
||||
// don't handle it because SRT will, see tlpkdrop at https://ossrs.net/lts/zh-cn/docs/v4/doc/srt-params
|
||||
// don't handle it because SRT will, see tlpktdrop at https://ossrs.net/lts/zh-cn/docs/v4/doc/srt-params
|
||||
if ((err = ts_ctx_->decode(stream, this)) != srs_success) {
|
||||
srs_warn("parse ts packet err=%s", srs_error_desc(err).c_str());
|
||||
srs_error_reset(err);
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
|
||||
#define VERSION_MAJOR 5
|
||||
#define VERSION_MINOR 0
|
||||
#define VERSION_REVISION 97
|
||||
#define VERSION_REVISION 98
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3865,3 +3865,27 @@ VOID TEST(ConfigMainTest, LogLevelV2)
|
|||
EXPECT_EQ(SrsLogLevelWarn, srs_get_log_level(conf.get_log_level_v2()));
|
||||
}
|
||||
}
|
||||
|
||||
VOID TEST(ConfigMainTest, SrtServerTlpktDrop)
|
||||
{
|
||||
srs_error_t err;
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_SUCCESS(conf.parse(_MIN_OK_CONF));
|
||||
EXPECT_TRUE(conf.get_srto_tlpktdrop());
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_SUCCESS(conf.parse(_MIN_OK_CONF "srt_server{tlpktdrop off;}"));
|
||||
EXPECT_FALSE(conf.get_srto_tlpktdrop());
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_SUCCESS(conf.parse(_MIN_OK_CONF "srt_server{tlpkdrop off;}"));
|
||||
EXPECT_FALSE(conf.get_srto_tlpktdrop());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue