ultravideo / uvgRTP

An open-source library for RTP/SRTP media delivery
BSD 2-Clause "Simplified" License
296 stars 84 forks source link

rtcp: fix socket selection busylooping in rtcp polling #178

Closed wowaser closed 1 year ago

wowaser commented 1 year ago

Hello,

I have noticed that my program takes an unnecessary amount of CPU and ran a profiler in Visual Studio. It showed that the poll function in rtcp runner is very CPU heavy, although it's not doing much. Long story short the wait time of ::select function was not fully implemented, and was always 0, causing the function to busyloop. I fixed it by finishing the wait time calculation for microseconds aswell. After this adjustment, the CPU load of my program was roughly halved.

jrsnen commented 1 year ago

Hello,

you are right, good find. Thanks a lot!

BR, Joni Räsänen