]> git.pld-linux.org Git - packages/mpd.git/blob - pipewire-graph-samplerate.patch
upstream patch for dynamic samplerate selection with pipewire output plugin
[packages/mpd.git] / pipewire-graph-samplerate.patch
1 From d5be8c74b009cdfc16b2b637aa9c4edb11cf105d Mon Sep 17 00:00:00 2001
2 From: Max Kellermann <max@musicpd.org>
3 Date: Mon, 18 Oct 2021 16:45:21 +0200
4 Subject: [PATCH] output/pipewire: attempt to change the graph sample rate
5
6 Requires PipeWire 0.3.32.
7
8 Closes https://github.com/MusicPlayerDaemon/MPD/issues/1283
9 ---
10  NEWS                                        | 1 +
11  src/output/plugins/PipeWireOutputPlugin.cxx | 7 +++++++
12  2 files changed, 8 insertions(+)
13
14 diff --git a/src/output/plugins/PipeWireOutputPlugin.cxx b/src/output/plugins/PipeWireOutputPlugin.cxx
15 index 6579c93b6..db7c36823 100644
16 --- a/src/output/plugins/PipeWireOutputPlugin.cxx
17 +++ b/src/output/plugins/PipeWireOutputPlugin.cxx
18 @@ -383,6 +383,13 @@ PipeWireOutput::Open(AudioFormat &audio_format)
19         if (target != nullptr && target_id == PW_ID_ANY)
20                 pw_properties_setf(props, PW_KEY_NODE_TARGET, "%s", target);
21  
22 +#ifdef PW_KEY_NODE_RATE
23 +       /* ask PipeWire to change the graph sample rate to ours
24 +          (requires PipeWire 0.3.32) */
25 +       pw_properties_setf(props, PW_KEY_NODE_RATE, "1/%u",
26 +                          audio_format.sample_rate);
27 +#endif
28 +
29         const PipeWire::ThreadLoopLock lock(thread_loop);
30  
31         stream = pw_stream_new_simple(pw_thread_loop_get_loop(thread_loop),
This page took 0.073647 seconds and 3 git commands to generate.