mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-24 09:14:04 +02:00
Another potential deadlock fix for PulseAudio.
This commit is contained in:
+22
-5
@@ -14090,11 +14090,28 @@ ma_result ma_context_get_device_info__pulse(ma_context* pContext, ma_device_type
|
|||||||
return ma_result_from_pulse(error);
|
return ma_result_from_pulse(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (((ma_pa_context_get_state_proc)pContext->pulse.pa_context_get_state)(pPulseContext) != MA_PA_CONTEXT_READY) {
|
for (;;) {
|
||||||
error = ((ma_pa_mainloop_iterate_proc)pContext->pulse.pa_mainloop_iterate)(pMainLoop, 1, NULL);
|
ma_pa_context_state_t state = ((ma_pa_context_get_state_proc)pContext->pulse.pa_context_get_state)(pPulseContext);
|
||||||
if (error < 0) {
|
if (state == MA_PA_CONTEXT_READY) {
|
||||||
result = ma_result_from_pulse(error);
|
break; /* Success. */
|
||||||
goto done;
|
}
|
||||||
|
if (state == MA_PA_CONTEXT_CONNECTING || state == MA_PA_CONTEXT_AUTHORIZING || state == MA_PA_CONTEXT_SETTING_NAME) {
|
||||||
|
error = ((ma_pa_mainloop_iterate_proc)pContext->pulse.pa_mainloop_iterate)(pMainLoop, 1, NULL);
|
||||||
|
if (error < 0) {
|
||||||
|
result = ma_result_from_pulse(error);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef MA_DEBUG_OUTPUT
|
||||||
|
printf("[PulseAudio] pa_context_get_state() returned %d. Waiting.\n", state);
|
||||||
|
#endif
|
||||||
|
continue; /* Keep trying. */
|
||||||
|
}
|
||||||
|
if (state == MA_PA_CONTEXT_UNCONNECTED || state == MA_PA_CONTEXT_FAILED || state == MA_PA_CONTEXT_TERMINATED) {
|
||||||
|
#ifdef MA_DEBUG_OUTPUT
|
||||||
|
printf("[PulseAudio] pa_context_get_state() returned %d. Failed.\n", state);
|
||||||
|
#endif
|
||||||
|
goto done; /* Failed. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user