Documentation does not specify unit for timeout in pa_mainloop_prepare
The API documentation for
pa_mainloop_prepare says that the timeout argument specifies a timeout, but doesn't say what unit it is (ms, µs etc). See the online API docs for this function.
This is particularly unfortunate since the meaning of the timeout actually changed in commit:6b1719d0. Previously the value was (apparently mistakenly) treated as µs; since this commit it has been treated as ms. This breaking change might have been unwise, but now it's out there, the proper behaviour should at least be documented.
Here's a possible patch:
--- /usr/include/pulse/mainloop.h 2020-10-31 13:10:54.000000000 +0000 +++ ./mainloop.h 2020-11-13 09:59:36.468544981 +0000 @@ -84,8 +84,8 @@ void pa_mainloop_free(pa_mainloop* m); /** Prepare for a single iteration of the main loop. Returns a negative value -on error or exit request. timeout specifies a maximum timeout for the subsequent -poll, or -1 for blocking behaviour. .*/ +on error or exit request. timeout specifies a maximum timeout in milliseconds +for the subsequent poll, or -1 for blocking behaviour. .*/ int pa_mainloop_prepare(pa_mainloop *m, int timeout); /** Execute the previously prepared poll. Returns a negative value on error.*/