libpulseaudio: fix aaudio error callback
The error callback can be called before the transition of the sink state has completed. It therefore needs to wait until the sink has left init state before reconfiguring it with pa_sink_suspend calls. Also try to recover from all errors (and log what the error is when it is not AAUDIO_ERROR_DISCONNECTED).
This commit is contained in:
parent
bcabe3b13c
commit
29b6c114f4
@ -125,10 +125,13 @@ static void error_callback(AAudioStream *stream, void *userdata, aaudio_result_t
|
||||
|
||||
pa_assert(u);
|
||||
|
||||
if (error == AAUDIO_ERROR_DISCONNECTED) {
|
||||
pa_sink_suspend(u->sink, true, PA_SUSPEND_UNAVAILABLE);
|
||||
pa_sink_suspend(u->sink, false, PA_SUSPEND_UNAVAILABLE);
|
||||
}
|
||||
while (u->sink->state == PA_SINK_INIT);
|
||||
|
||||
if (error != AAUDIO_ERROR_DISCONNECTED)
|
||||
pa_log_debug("AAudio error: %d", error);
|
||||
|
||||
pa_sink_suspend(u->sink, true, PA_SUSPEND_UNAVAILABLE);
|
||||
pa_sink_suspend(u->sink, false, PA_SUSPEND_UNAVAILABLE);
|
||||
}
|
||||
|
||||
#define CHK(stmt) { \
|
||||
|
Loading…
Reference in New Issue
Block a user