-
Notifications
You must be signed in to change notification settings - Fork 861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gstreamer - high IAT(Inter Arrival Time) around ~10ms observed between UDP datagrams of SRT client output #673
Comments
@ravtr This might be related to #637. SRT inter packet sending has a minimum waiting interval of 10 ms. So if each packet should have 1 ms interval, then the first one will have 10 ms inter packet delay, and further 9 will be sent ASAP to make the interval 1 ms on average.
|
@maxlovic thanks for the quick reply, will try the suggested changes and share the results |
@maxlovic I have disabled NO_BUSY_WAITING in srt.h and udt.h then I can see no more 10ms peaks. Is there any plan to make this change as a configurable feature? |
Would the NO_BUSY_WAITING change described above be appropriate for Windows too? I understand that Windows timers are even worse, so this could help, right? |
We are looking into this. Some tests on several platforms are to be performed.
Yes, Windows timers are far less accurate. But busy waiting will produce some undesireable CPU load, so it can't be the general case solution. Maybe a fix will be to wait with timer if waiting time is higher than 10 ms, and with busy waiting - if less.. Will see. |
So here is a suggested modified version of CTimer:sleepto() which uses the timer for waits >= 10ms and busy waits for any smaller amounts. The * 10000 could eventually be replaced with some sort of platform-specific granularity constant. Maybe @ravtr you could test this and observe CPU load vs the change you already made that just busy waits in all cases?
|
@oviano @maxlovic |
The only thing I notice about that PR is it doesn't include the change suggested by @maxlovic to preserve the inter-packet interval adjustment. Just mentioning in case that was an oversight. |
@maxtomilov I can see #678 is raised on master |
Also, there are these lines in queue.cpp: #ifdef NO_BUSY_WAITING But with the above hybrid sleep/busy wait loop, you still want it to call the ->tick() to wake it up because it may be in the pthread_cond_wait portion of the code, i.e. just make it: m_pTimer->tick(); |
Makes sense. What would be the desired time though - it's going to vary per platform. The best I've been able to achieve on Windows is about 1700us. |
@maxlovic thanks |
So, here is the revised sleepto I am using having updated my SRT to 1.3.4. Taking this second step is is very important - it reduces idle CPU from around 20% to almost zero on both Windows machines I have tried.
|
@oviano
To summ up, In this approach busy waiting is used only for waiting durations below 10 ms or after a spurious wake up, when the remaining waiting time is less than 10 ms. What bitrate did you use for testing? Can you create a PR? |
Yes sorry there was a flaw in my edit this morning, it needs to be more like the below so that in the busy waiting mode it sleeps only for 10ms each iteration, until there is < 10ms remaining at which point it does the actual busy waiting in the second loop.
|
I would rather wait till |
Yes that would be even better, you are right. |
So a refined version; now it will only do the pthread sleep up until t - 10ms (or 1ms for non-Windows).
|
Using below pipeline to convert RTP to SRT
udpsrc name=srtudpsrc multicast-iface=lo address=<address port= caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, payload=(int)33, encoding-name=(string)MP2T" ! queue name=rtpqueue max-size-buffers=80000 max-size-bytes=100000000 max-size-time=10000000000 min-threshold-time=0 min-threshold-buffers=0 min-threshold-bytes=0 leaky=upstream ! rtpjitterbuffer latency=40 ! queue name=rtpjitterbufferqueue ! rtpmp2tdepay ! queue name=outputqueue ! srtclientsink uri= latency=1000 max-lateness=100000000 key-length=16 passphrase=""
When monitored the input IAT was seen to be 1ms. But output of SRT client is around 10ms around 10% of the time. The same is observed when packets captured at SRT output.
Need some help in debugging this issue.
The text was updated successfully, but these errors were encountered: