Skip to content

feat(pipewire): set node.rate prop - #1341

Merged
roderickvd merged 2 commits into
RustAudio:masterfrom
kpqi5858:pw-node-rate
Sep 1, 2026
Merged

feat(pipewire): set node.rate prop#1341
roderickvd merged 2 commits into
RustAudio:masterfrom
kpqi5858:pw-node-rate

Conversation

@kpqi5858

Copy link
Copy Markdown
Contributor

I was debugging why default.clock.allowed-rates isn't working with cpal stream, and came up with this solution.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new NODE_RATE reference is unavailable in pipewire 0.10 and prevents compilation.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds PipeWire stream rate hints to support configured clock rates.

Changes:

  • Sets node.rate from the stream sample rate.
  • Uses PipeWire’s constant for node.group.
  • Updates the changelog.
File summaries
File Description
src/host/pipewire/device.rs Configures PipeWire node properties.
CHANGELOG.md Documents the PipeWire change.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/host/pipewire/device.rs

@roderickvd roderickvd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

// preventing phase drift between simultaneous input/output streams.
properties.insert("node.group", format!("cpal-{}", std::process::id()));
properties.insert(
*pw::keys::NODE_GROUP,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good one! I also prefer to re-use constants. Any chance there's more in src/host/pipewire/utils.rs where we could use some from *pw::keys instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed node module from utils and replaced with pw::keys.

  • METADATA_NAME is exposed in pipewire-sys but not in pipewire.
  • There is pw::keys::DEVICE_ICON but that one exposes icon-name, not icon_name
  • I couldn't find anything other than that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thanks. One nit I added to the review, to use *pw:: instead of &pw::.

Comment thread CHANGELOG.md Outdated
@kpqi5858
kpqi5858 force-pushed the pw-node-rate branch 2 times, most recently from 287879f to bc8df40 Compare August 31, 2026 04:19
Comment thread src/host/pipewire/device.rs Outdated
Option<SampleRate>,
) = props
.get(node::LATENCY)
.get(&pw::keys::NODE_LATENCY)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: I think *pw::keys::FOO is more idiomatic than &pw::keys::FOO.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@roderickvd

Copy link
Copy Markdown
Member

Thanks, merging!

@roderickvd
roderickvd merged commit 6515573 into RustAudio:master Sep 1, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants