Repository navigation
[Windows] How does SRT wait for packets to send? Would SRT benefit from calling timeBeginPeriod? #3191
Replies: 1 comment
|
We are underway to abandon completely any homecooked sync subproject for any other platform than Linux. All other platforms should rely on the C++11 standard library in this subproject; for that you need Whether this C++11 standard library does it right or not, we don't know, but we believe SRT would be not the only project having problems with that. @maxsharabayko has made once measurement how reliably Windows can apply short sleep time and the results were disastrous for Windows (however, the same measurements done on Windows with C++11 standard library has shown much better results). Likely for Windows there must be special procedure used for waiting times below 20ms, but we believe that C++11 standard library is doing exactly that. At least if there is a solution that should be granted by at least the Microsoft's compiler that it should do things reliable way as per requirements, we see no point in crafting our own solutions here. |
Uh oh!
There was an error while loading. Please reload this page.
On Windows systems, it's well documented that the internal system clock fires timers every 15ms. So asking the OS to sleep for 1 millisecond will result in a much longer sleep. I believe this is disastrous for video streaming.
That timer value can be overridden by calling timeBeginPeriod. https://learn.microsoft.com/en-us/windows/win32/api/timeapi/nf-timeapi-timebeginperiod
However, anecdotally, I've not observed that using the SRT library to stream videos is eating an amount of CPU that would be associated with "busy waiting". I see the USE_BUSY_WAITING build flag but I don't believe the build I'm using is using it.
I'm wondering how SRT accomplishes waiting between sending packets. Depending on the implementation, I'm wondering if it would benefit from the application calling timeBeginPeriod.
I've tried to self-serve on this as best I can and as best I can tell from the code, it feels like SRT would be susceptible to these problems, though I haven't observed it.
All reactions