diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index bd02dc061..1e9850913 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -6880,8 +6880,8 @@ bool SrsConfig::get_srto_tlpktdrop() { return SRS_CONF_PERFER_TRUE(conf->arg0()); } -int SrsConfig::get_srto_conntimeout() { - static int DEFAULT = 3000; +srs_utime_t SrsConfig::get_srto_conntimeout() { + static srs_utime_t DEFAULT = 3 * SRS_UTIME_SECONDS; SrsConfDirective* conf = root->get("srt_server"); if (!conf) { return DEFAULT; @@ -6891,11 +6891,11 @@ int SrsConfig::get_srto_conntimeout() { if (!conf || conf->arg0().empty()) { return DEFAULT; } - return atoi(conf->arg0().c_str()); + return (srs_utime_t)(::atoi(conf->arg0().c_str()) * SRS_UTIME_MILLISECONDS); } -int SrsConfig::get_srto_peeridletimeout() { - static int DEFAULT = 10000; +srs_utime_t SrsConfig::get_srto_peeridletimeout() { + static srs_utime_t DEFAULT = 10 * SRS_UTIME_SECONDS; SrsConfDirective* conf = root->get("srt_server"); if (!conf) { return DEFAULT; @@ -6905,7 +6905,7 @@ int SrsConfig::get_srto_peeridletimeout() { if (!conf || conf->arg0().empty()) { return DEFAULT; } - return atoi(conf->arg0().c_str()); + return (srs_utime_t)(::atoi(conf->arg0().c_str()) * SRS_UTIME_MILLISECONDS); } int SrsConfig::get_srto_sendbuf() { diff --git a/trunk/src/app/srs_app_config.hpp b/trunk/src/app/srs_app_config.hpp index 78a815111..516162618 100644 --- a/trunk/src/app/srs_app_config.hpp +++ b/trunk/src/app/srs_app_config.hpp @@ -649,9 +649,9 @@ public: // Get the srt SRTO_TLPKTDROP, Too-late Packet Drop, default is true. virtual bool get_srto_tlpktdrop(); // Get the srt SRTO_CONNTIMEO, connection timeout, default is 3000ms. - virtual int get_srto_conntimeout(); + virtual srs_utime_t get_srto_conntimeout(); // Get the srt SRTO_PEERIDLETIMEO, peer idle timeout, default is 10000ms. - virtual int get_srto_peeridletimeout(); + virtual srs_utime_t get_srto_peeridletimeout(); // Get the srt SRTO_SNDBUF, send buffer, default is 8192 × (1500-28). virtual int get_srto_sendbuf(); // Get the srt SRTO_RCVBUF, recv buffer, default is 8192 × (1500-28). diff --git a/trunk/src/app/srs_app_srt_server.cpp b/trunk/src/app/srs_app_srt_server.cpp index e77896ea3..0a23fcc61 100644 --- a/trunk/src/app/srs_app_srt_server.cpp +++ b/trunk/src/app/srs_app_srt_server.cpp @@ -118,11 +118,11 @@ srs_error_t SrsSrtMessageAcceptor::set_srt_opt() return srs_error_wrap(err, "set opt"); } - if ((err = srs_srt_set_connect_timeout(listener_->fd(), _srs_config->get_srto_conntimeout())) != srs_success) { + if ((err = srs_srt_set_connect_timeout(listener_->fd(), srsu2msi(_srs_config->get_srto_conntimeout()))) != srs_success) { return srs_error_wrap(err, "set opt"); } - if ((err = srs_srt_set_peer_idle_timeout(listener_->fd(), _srs_config->get_srto_peeridletimeout())) != srs_success) { + if ((err = srs_srt_set_peer_idle_timeout(listener_->fd(), srsu2msi(_srs_config->get_srto_peeridletimeout()))) != srs_success) { return srs_error_wrap(err, "set opt"); }