mk-fg / python-pulse-control

Python high-level interface and ctypes-based bindings for PulseAudio (libpulse)
https://pypi.org/project/pulsectl/
MIT License
170 stars 36 forks source link

Wrong unit for timeout of mainloop_prepare #68

Closed georbl closed 2 years ago

georbl commented 2 years ago

The the parameter timeout is passed to pa_mainloop_prepare() in milliseconds instead of micoseconds. This causes higher CPU load when waiting for an event in case event_listen() is called with a timeout parameter.

https://github.com/mk-fg/python-pulse-control/blob/08395ddf0f5d7308e4fe05f6b3cc6fff57ec070a/pulsectl/pulsectl.py#L533

Also see https://freedesktop.org/software/pulseaudio/doxygen/mainloop_8h.html#a217ce134af601c1c6ce77c41c99fc0d2 image

mk-fg commented 2 years ago

Huh, indeed was a bug, introduced in 4bc5437058045339f6b38cc8582b94b236995ebd where apparently I thought it was ms, even though it says "us" in the signature and microseconds in the headers. Not sure what was going on there, but definitely looks like a mistake.

Should be fixed in 22.1.0. Thanks for noticing and reporting!