mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Refine srs_get_system_startup_time in time unit
This commit is contained in:
parent
6c12aa0eca
commit
170cca1f58
4 changed files with 5 additions and 5 deletions
|
@ -260,7 +260,7 @@ srs_error_t SrsBandwidth::play_checking(SrsBandwidthSample* sample, SrsKbpsLimit
|
||||||
|
|
||||||
int data_count = 1;
|
int data_count = 1;
|
||||||
srs_utime_t starttime = srs_update_system_time();
|
srs_utime_t starttime = srs_update_system_time();
|
||||||
while (srsu2ms(srs_get_system_time() - starttime) < sample->duration_ms) {
|
while (int64_t(srsu2ms(srs_get_system_time() - starttime)) < sample->duration_ms) {
|
||||||
srs_usleep(sample->interval_ms * SRS_UTIME_MILLISECONDS);
|
srs_usleep(sample->interval_ms * SRS_UTIME_MILLISECONDS);
|
||||||
|
|
||||||
// TODO: FIXME: use shared ptr message.
|
// TODO: FIXME: use shared ptr message.
|
||||||
|
@ -342,7 +342,7 @@ srs_error_t SrsBandwidth::publish_checking(SrsBandwidthSample* sample, SrsKbpsLi
|
||||||
|
|
||||||
// recv publish msgs until @duration_ms ms
|
// recv publish msgs until @duration_ms ms
|
||||||
srs_utime_t starttime = srs_update_system_time();
|
srs_utime_t starttime = srs_update_system_time();
|
||||||
while (srsu2ms(srs_get_system_time() - starttime) < sample->duration_ms) {
|
while (int64_t(srsu2ms(srs_get_system_time() - starttime)) < sample->duration_ms) {
|
||||||
SrsCommonMessage* msg = NULL;
|
SrsCommonMessage* msg = NULL;
|
||||||
SrsBandwidthPacket* pkt = NULL;
|
SrsBandwidthPacket* pkt = NULL;
|
||||||
if ((err = _rtmp->expect_message<SrsBandwidthPacket>(&msg, &pkt)) != srs_success) {
|
if ((err = _rtmp->expect_message<SrsBandwidthPacket>(&msg, &pkt)) != srs_success) {
|
||||||
|
|
|
@ -113,7 +113,7 @@ srs_utime_t srs_get_system_time()
|
||||||
return _srs_system_time_us_cache;
|
return _srs_system_time_us_cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_utime_t srs_get_system_startup_time_ms()
|
srs_utime_t srs_get_system_startup_time()
|
||||||
{
|
{
|
||||||
if (_srs_system_time_startup_time <= 0) {
|
if (_srs_system_time_startup_time <= 0) {
|
||||||
srs_update_system_time();
|
srs_update_system_time();
|
||||||
|
|
|
@ -44,7 +44,7 @@ extern srs_error_t srs_avc_nalu_read_bit(SrsBitBuffer* stream, int8_t& v);
|
||||||
|
|
||||||
// get current system time in srs_utime_t, use cache to avoid performance problem
|
// get current system time in srs_utime_t, use cache to avoid performance problem
|
||||||
extern srs_utime_t srs_get_system_time();
|
extern srs_utime_t srs_get_system_time();
|
||||||
extern srs_utime_t srs_get_system_startup_time_ms();
|
extern srs_utime_t srs_get_system_startup_time();
|
||||||
// the deamon st-thread will update it.
|
// the deamon st-thread will update it.
|
||||||
extern srs_utime_t srs_update_system_time();
|
extern srs_utime_t srs_update_system_time();
|
||||||
|
|
||||||
|
|
|
@ -312,7 +312,7 @@ int SrsBandwidthClient::publish_checking(int duration_ms, int play_kbps)
|
||||||
|
|
||||||
int data_count = 1;
|
int data_count = 1;
|
||||||
int64_t starttime = srsu2ms(srs_update_system_time());
|
int64_t starttime = srsu2ms(srs_update_system_time());
|
||||||
while ((srsu2ms(srs_get_system_time()) - starttime) < duration_ms) {
|
while (int64_t(srsu2ms(srs_get_system_time()) - starttime) < duration_ms) {
|
||||||
// TODO: FIXME: use shared ptr message.
|
// TODO: FIXME: use shared ptr message.
|
||||||
SrsBandwidthPacket* pkt = SrsBandwidthPacket::create_publishing();
|
SrsBandwidthPacket* pkt = SrsBandwidthPacket::create_publishing();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue