PortAudio / portaudio

PortAudio is a cross-platform, open-source C language library for real-time audio input and output.
Other
1.39k stars 293 forks source link

Hang when callbackMode is used (ALSA) #535

Open ulasyuksel opened 3 years ago

ulasyuksel commented 3 years ago

Describe the bug Pa_StartStream hangs when stream is in "callbackMode" when output is not primed and if AlsaStart fails

To Reproduce Steps to reproduce the behavior. Include code if applicable.

  1. Open a stream in callbackMode
  2. Try to start stream via Pa_StartStream.
  3. if AlsaStart() fails in CallbackThreadFunc() (@ else of "if( stream->primeBuffers )" ), function jumps to error label and exits the thread without notifying the caller thread. Hence, the caller hangs in StartStream( PaStream *s ), in PaUnixThread_New()

Expected behavior Pa_StartStream should return when start stream fails.

Desktop (please complete the following information):

philburk commented 3 years ago

@ulasyuksel - Does this also happen with the 19.7 stable candidate?

What audio device does this happen with?

Were you using INPUT or OUTPUT?

Have you reproduced the hang by hacking the PA code to fake an ALSA failure?

ulasyuksel commented 3 years ago

Hi //Does this also happen with the 19.7 stable candidate? I did not check with it but according to code flow there is no change at this thread. I suppose it can happen. //What audio device does this happen with? USB mic //Were you using INPUT or OUTPUT? input //Have you reproduced the hang by hacking the PA code to fake an ALSA failure? no, there is a real ALSA failure triggering the issue. I am investigating ALSA failure too. But as you indicated, I suppose the problem can be reproduced by hacking the code too.

philburk commented 8 months ago

Since I cannot reproduce the ALSA device error, I will try to inject an error to repro this hang.

But if someone else has time to work on this, please step up.