SRS is a simple, high-efficiency, real-time video server supporting RTMP, WebRTC, HLS, HTTP-FLV, SRT, MPEG-DASH, and GB28181.
24.72k
stars
5.28k
forks
source link
change system time backward will let st-srs behavior abnormal #3978
Open
suzp1984 opened 3 months ago
Root Cause
https://github.com/ossrs/srs/blob/fa8096ad0117a085515729e12a3758ca26036552/trunk/3rdparty/st-srs/md.h#L113-L116 the default implementation of get timestamp of microseconds is depends on system time.
man gettimeofday
the
st-srs
has api that let us to config our own get timestamp function, but srs didn't config it.https://github.com/ossrs/srs/blob/fa8096ad0117a085515729e12a3758ca26036552/trunk/3rdparty/st-srs/sync.c#L57-L85
Solutions
refactor
MD_GET_UTIME
or Config a time function based on more robust solutions, e.g. system uptime, the timestamp since the system boot.Version All version
To Reproduce Steps to reproduce the behavior:
make
./helloword
Hello
print will stuck.Expected behavior Change the system time should not impact the st-srs behavior.