PortAudio / portaudio

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

Pipewire: Long timeout stalls user application #820

Open daschuer opened 1 year ago

daschuer commented 1 year ago

Describe the bug In case the audio callback stops because of an other error condition, the WaitCondition() will never happen and the long timeout of 10 min takes place. This is so long that the user will likely kill the application before, loosing his unsaved data.

To Reproduce

It happens here: https://github.com/PortAudio/portaudio/blob/2fe67f3568295accc0b4cc47cefd5e0d6a7f6e43/src/hostapi/jack/pa_jack.c#L1724

Expected behavior

Actual behavior

Desktop (please complete the following information):

Additional context The original bug is here: https://github.com/mixxxdj/mixxx/issues/11587

Is it possible to lower the timeout to a reasonable short time? Can we detect the error condition before start waiting?

RossBencina commented 1 year ago

Is this possibly related to #795

RossBencina commented 1 year ago

Some of my personal thoughts:

Phil and I agree that 10mins is too long. The question is what is the best value. Ultimately it's up to interested parties to develop a patch.

philburk commented 1 year ago

It may take a while to decide on the optimal timeout. So we could just change the 10 minutes to 3 seconds as a quick fix. It may not be short enough for some cases. For example stopping a stream requires waiting for all the audio to drain out. That might be more than 3 seconds. But I think we can agree 3 seconds is better than 10 minutes.

RossBencina commented 7 months ago

Having looked at the pa_jack.c code in more detail, i think all of the calls to WaitCondition need to be reviewed as it doesn't seem like pthread_cond_timedwait is being used correctly (i.e. a condition is not always checked).