mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-14 01:58:25 +00:00
[client] audio/pw: don't actually stop when SPICE signals a stop
This commit is contained in:
parent
e810577317
commit
75e46128d4
@ -133,6 +133,18 @@ static void pipewire_free(void)
|
|||||||
pw_deinit();
|
pw_deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void pipewire_stop(void)
|
||||||
|
{
|
||||||
|
if (!pw.stream)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pw_thread_loop_lock(pw.thread);
|
||||||
|
pw_stream_flush(pw.stream, true);
|
||||||
|
pw_stream_destroy(pw.stream);
|
||||||
|
pw.stream = NULL;
|
||||||
|
pw_thread_loop_unlock(pw.thread);
|
||||||
|
}
|
||||||
|
|
||||||
static void pipewire_start(int channels, int sampleRate)
|
static void pipewire_start(int channels, int sampleRate)
|
||||||
{
|
{
|
||||||
const struct spa_pod * params[1];
|
const struct spa_pod * params[1];
|
||||||
@ -144,6 +156,8 @@ static void pipewire_start(int channels, int sampleRate)
|
|||||||
.process = pipewire_on_process
|
.process = pipewire_on_process
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pipewire_stop();
|
||||||
|
|
||||||
pw.channels = channels;
|
pw.channels = channels;
|
||||||
pw.stride = sizeof(uint16_t) * channels;
|
pw.stride = sizeof(uint16_t) * channels;
|
||||||
pw.buffer = ringbuffer_new(sampleRate, channels * sizeof(uint16_t));
|
pw.buffer = ringbuffer_new(sampleRate, channels * sizeof(uint16_t));
|
||||||
@ -197,16 +211,9 @@ static void pipewire_play(uint8_t * data, int size)
|
|||||||
ringbuffer_push(pw.buffer, data + i);
|
ringbuffer_push(pw.buffer, data + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pipewire_stop(void)
|
static void pipewire_stop_nop(void)
|
||||||
{
|
{
|
||||||
if (!pw.stream)
|
// we ignore the stop message to avoid messing up any audio graph
|
||||||
return;
|
|
||||||
|
|
||||||
pw_thread_loop_lock(pw.thread);
|
|
||||||
pw_stream_flush(pw.stream, true);
|
|
||||||
pw_stream_destroy(pw.stream);
|
|
||||||
pw.stream = NULL;
|
|
||||||
pw_thread_loop_unlock(pw.thread);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct LG_AudioDevOps LGAD_PipeWire =
|
struct LG_AudioDevOps LGAD_PipeWire =
|
||||||
@ -216,5 +223,5 @@ struct LG_AudioDevOps LGAD_PipeWire =
|
|||||||
.free = pipewire_free,
|
.free = pipewire_free,
|
||||||
.start = pipewire_start,
|
.start = pipewire_start,
|
||||||
.play = pipewire_play,
|
.play = pipewire_play,
|
||||||
.stop = pipewire_stop
|
.stop = pipewire_stop_nop
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user