Skip to content

Commit

Permalink
output/pipewire: attempt to change the graph sample rate
Browse files Browse the repository at this point in the history
Requires PipeWire 0.3.32.

Closes #1283
  • Loading branch information
MaxKellermann committed Oct 18, 2021
1 parent c112cb6 commit d5be8c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ver 0.23.1 (not yet released)
* output
- pipewire: attempt to change the graph sample rate
- snapcast: fix time stamp bug which caused "Failed to get chunk"
* fix libfmt linker problems
* fix broken password authentication
Expand Down
7 changes: 7 additions & 0 deletions src/output/plugins/PipeWireOutputPlugin.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,13 @@ PipeWireOutput::Open(AudioFormat &audio_format)
if (target != nullptr && target_id == PW_ID_ANY)
pw_properties_setf(props, PW_KEY_NODE_TARGET, "%s", target);

#ifdef PW_KEY_NODE_RATE
/* ask PipeWire to change the graph sample rate to ours
(requires PipeWire 0.3.32) */
pw_properties_setf(props, PW_KEY_NODE_RATE, "1/%u",
audio_format.sample_rate);
#endif

const PipeWire::ThreadLoopLock lock(thread_loop);

stream = pw_stream_new_simple(pw_thread_loop_get_loop(thread_loop),
Expand Down

0 comments on commit d5be8c7

Please sign in to comment.