mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[client] audio/pw: don't re-create an idle stream with matching format
This commit is contained in:
parent
2ea24516d2
commit
ebdc847ef1
@ -32,6 +32,7 @@ struct PipeWire
|
|||||||
struct pw_thread_loop * thread;
|
struct pw_thread_loop * thread;
|
||||||
struct pw_stream * stream;
|
struct pw_stream * stream;
|
||||||
int channels;
|
int channels;
|
||||||
|
int sampleRate;
|
||||||
int stride;
|
int stride;
|
||||||
|
|
||||||
RingBuffer buffer;
|
RingBuffer buffer;
|
||||||
@ -150,11 +151,15 @@ static void pipewire_start(int channels, int sampleRate)
|
|||||||
.process = pipewire_on_process
|
.process = pipewire_on_process
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (pw.stream && pw.channels == channels && pw.sampleRate == sampleRate)
|
||||||
|
return;
|
||||||
|
|
||||||
pipewire_stop_stream();
|
pipewire_stop_stream();
|
||||||
|
|
||||||
pw.channels = channels;
|
pw.channels = channels;
|
||||||
pw.stride = sizeof(uint16_t) * channels;
|
pw.sampleRate = sampleRate;
|
||||||
pw.buffer = ringbuffer_new(sampleRate / 10, channels * sizeof(uint16_t));
|
pw.stride = sizeof(uint16_t) * channels;
|
||||||
|
pw.buffer = ringbuffer_new(sampleRate / 10, channels * sizeof(uint16_t));
|
||||||
|
|
||||||
pw_thread_loop_lock(pw.thread);
|
pw_thread_loop_lock(pw.thread);
|
||||||
pw.stream = pw_stream_new_simple(
|
pw.stream = pw_stream_new_simple(
|
||||||
|
Loading…
Reference in New Issue
Block a user