mirror of
https://github.com/Ryujinx/libsoundio.git
synced 2024-12-22 17:55:37 +00:00
PulseAudio: detect server going offline
This commit is contained in:
parent
8d3a32e668
commit
b8a2adb4ec
|
@ -272,10 +272,10 @@ Then look at `html/index.html` in a browser.
|
|||
|
||||
## Roadmap
|
||||
|
||||
0. Detect PulseAudio server going offline and emit `on_backend_disconnect`.
|
||||
0. Ability to "activate" a buffer-flexible outstream by jumping the gun and
|
||||
causing `write_callback` to be called early.
|
||||
- Use the same mechanism when destroying the outstream
|
||||
0. Create a test for recovering from backend disconnecting that reconnects
|
||||
0. Create a test for input stream overflow handling.
|
||||
0. Create a test for the latency / synchronization API.
|
||||
- Input is an audio file and some events indexed at particular frame - when
|
||||
|
|
|
@ -36,6 +36,7 @@ static int subscribe_to_events(SoundIoPrivate *si) {
|
|||
static void context_state_callback(pa_context *context, void *userdata) {
|
||||
SoundIoPrivate *si = (SoundIoPrivate *)userdata;
|
||||
SoundIoPulseAudio *sipa = &si->backend_data.pulseaudio;
|
||||
SoundIo *soundio = &si->pub;
|
||||
|
||||
switch (pa_context_get_state(context)) {
|
||||
case PA_CONTEXT_UNCONNECTED: // The context hasn't been connected yet.
|
||||
|
@ -55,7 +56,9 @@ static void context_state_callback(pa_context *context, void *userdata) {
|
|||
return;
|
||||
case PA_CONTEXT_FAILED: // The connection failed or was disconnected.
|
||||
sipa->connection_err = SoundIoErrorInitAudioBackend;
|
||||
sipa->ready_flag = true;
|
||||
if (sipa->ready_flag.exchange(true)) {
|
||||
soundio->on_backend_disconnect(soundio, SoundIoErrorBackendDisconnected);
|
||||
}
|
||||
pa_threaded_mainloop_signal(sipa->main_loop, 0);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue