Browse Source

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).
emacs-27
Tom Yan 6 years ago
committed by Leonid Plyushch
parent
commit
9a3d438686
  1. 11
      packages/libpulseaudio/module-aaudio-sink.c

11
packages/libpulseaudio/module-aaudio-sink.c

@ -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…
Cancel
Save