thestk / rtaudio

A set of C++ classes that provide a common API for realtime audio input/output across Linux (native ALSA, JACK, PulseAudio and OSS), Macintosh OS X (CoreAudio and JACK), and Windows (DirectSound, ASIO, and WASAPI) operating systems.
Other
1.49k stars 317 forks source link

PulseAPI hang ups on 5.2.0 when used repeatedly from a child thread #392

Open ggarra13 opened 1 year ago

ggarra13 commented 1 year ago

My video player application:

https://www.github.com/ggarra13/mrv2
https://www.github.com/ggarra13/tlRender  # auxiliary video library that uses RtAudio

uses RtAudio, currently 5.2.0. The application is heavily multithreaded and, after some setup calls in the main thread, calls RtAudio functions from a child thread for each video loaded. I found that the pulse api of RtAudio was misbehaving, due to the server not returning on time and the function getDeviceCount() returning 0 as rt_pa_info.dev would sometimes be empty. I created a patch, which I can no longer apply to the current HEAD and which I attach here. It caches the rt_pa_info.dev vector after the first call to the server. Also, I am calling pa_operation_unref from each pacontext* call, as it seems that might be missing. I am attaching the diff to the 5.2.0 branch in case it is useful.

5.2.0.txt

I tried porting to the current HEAD (beta), and after some code changes -- DeviceInfo.probed gone, setErorCallback, openStream with no error callback--but the results were worse. The playback would not work at all as the RtAudo error callback would report that the device ID was not initialized (or something similar).

garyscavone commented 1 year ago

I'm afraid I cannot investigate this problem without a significant amount of further details. I will close this issue if there is no further communications within the next month or so.

luzpaz commented 8 months ago

ping @ggarra13

ggarra13 commented 8 months ago

@garyscavone I am sorry I haven't followed through. Not sure how else I can help out to debug it, as providing a simple test is not easy at all. If there has been progress with the latest HEAD, I can try checking it again.