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

Refine get_heartbeat_interval in time unit

This commit is contained in:
winlin 2019-04-09 08:47:18 +08:00
parent 5937304717
commit 60f9561d2d
4 changed files with 15 additions and 6 deletions

View file

@ -6944,9 +6944,9 @@ bool SrsConfig::get_heartbeat_enabled()
return SRS_CONF_PERFER_FALSE(conf->arg0());
}
int64_t SrsConfig::get_heartbeat_interval()
srs_utime_t SrsConfig::get_heartbeat_interval()
{
static int64_t DEFAULT = (int64_t)(9.9 * 1000);
static srs_utime_t DEFAULT = (srs_utime_t)(9.9 * SRS_UTIME_SECONDS);
SrsConfDirective* conf = get_heartbeart();
if (!conf) {
@ -6958,7 +6958,7 @@ int64_t SrsConfig::get_heartbeat_interval()
return DEFAULT;
}
return (int64_t)(::atof(conf->arg0().c_str()) * 1000);
return (srs_utime_t)(::atof(conf->arg0().c_str()) * SRS_UTIME_SECONDS);
}
string SrsConfig::get_heartbeat_url()

View file

@ -1423,9 +1423,9 @@ public:
*/
virtual bool get_heartbeat_enabled();
/**
* get the heartbeat interval, in ms.
* get the heartbeat interval, in srs_utime_t.
*/
virtual int64_t get_heartbeat_interval();
virtual srs_utime_t get_heartbeat_interval();
/**
* get the heartbeat report url.
*/

View file

@ -910,7 +910,7 @@ srs_error_t SrsServer::do_cycle()
}
// the interval in config.
int heartbeat_max_resolution = (int)(_srs_config->get_heartbeat_interval() * SRS_UTIME_MILLISECONDS / SRS_SYS_CYCLE_INTERVAL);
int heartbeat_max_resolution = (int)(_srs_config->get_heartbeat_interval() / SRS_SYS_CYCLE_INTERVAL);
// dynamic fetch the max.
int dynamic_max = srs_max(max, heartbeat_max_resolution);