Upstream change to max channel count breaks libspa build
System information
- coppwr version (See in Help → About): git
- coppwr installation method (Flathub, AUR, .deb, .rpm): rpm
- PipeWire version (See with
pipewire --version): git - OS: opensuse tumbleweed
- Desktop environment/Window manager: KDE
Describe the bug Since this commit "Bump max channels to 128", coppwr fails to build, and the errors make it clear that there's a problem in libspa.
Of course I should normally log this there, but I went there and saw that it became unmaintained, and I read you're working on a fork at the moment, so I brought it to here first. I hope that's OK.
[ 155s] error[E0308]: mismatched types
[ 155s] --> /home/abuild/rpmbuild/BUILD/coppwr-1.7.0+git20250918.80e515d-build/coppwr-1.7.0+git20250918.80e515d/vendor/libspa-0.9.2/src/param/audio/raw.rs:32:23
[ 155s] |
[ 155s] 32 | position: [0; 64usize],
[ 155s] | ^^^^^^^^^^^^ expected an array with a size of 128, found one with a size of 64
[ 155s]
[ 155s] error[E0308]: mismatched types
[ 155s] --> /home/abuild/rpmbuild/BUILD/coppwr-1.7.0+git20250918.80e515d-build/coppwr-1.7.0+git20250918.80e515d/vendor/libspa-0.9.2/src/param/audio/raw.rs:69:27
[ 155s] |
[ 155s] 69 | self.0.position = position;
[ 155s] | ^^^^^^^^ expected an array with a size of 128, found one with a size of 64
[ 155s]
[ 155s] error[E0308]: mismatched types
[ 155s] --> /home/abuild/rpmbuild/BUILD/coppwr-1.7.0+git20250918.80e515d-build/coppwr-1.7.0+git20250918.80e515d/vendor/libspa-0.9.2/src/param/audio/raw.rs:78:9
[ 155s] |
[ 155s] 77 | pub fn position(&self) -> [u32; 64usize] {
[ 155s] | -------------- expected `[u32; 64]` because of return type
[ 155s] 78 | self.0.position
[ 155s] | ^^^^^^^^^^^^^^^ expected an array with a size of 64, found one with a size of 128
[ 155s]
I tried just changing those three instances of 64usize to 128usize and it worked.
This did the trick:
diff -urN vendor/vendor/libspa-0.9.2/.cargo-checksum.json vendorb/vendor/libspa-0.9.2/.cargo-checksum.json
diff -urN vendor/vendor/libspa-0.9.2/src/param/audio/raw.rs vendorb/vendor/libspa-0.9.2/src/param/audio/raw.rs
--- vendor/vendor/libspa-0.9.2/src/param/audio/raw.rs 2025-10-02 20:08:55.214215266 +1000
+++ vendorb/vendor/libspa-0.9.2/src/param/audio/raw.rs 2025-10-02 20:17:27.274412467 +1000
@@ -29,7 +29,7 @@
flags: AudioInfoRawFlags::UNPOSITIONED.bits(),
rate: 0,
channels: 0,
- position: [0; 64usize],
+ position: [0; 128usize],
})
}
@@ -65,7 +65,7 @@
self.0.channels
}
- pub fn set_position(&mut self, position: [u32; 64usize]) {
+ pub fn set_position(&mut self, position: [u32; 128usize]) {
self.0.position = position;
if position[0] == 0 {
self.0.flags |= AudioInfoRawFlags::UNPOSITIONED.bits();
@@ -74,7 +74,7 @@
};
}
- pub fn position(&self) -> [u32; 64usize] {
+ pub fn position(&self) -> [u32; 128usize] {
self.0.position
}
I hope that's helpful. I don't know rust at all, this may be an abomination. Seems OK though :)
Can you try with this patch?
diff --git a/libspa/src/param/audio/raw.rs b/libspa/src/param/audio/raw.rs
index 68b0483..11395f7 100644
--- a/libspa/src/param/audio/raw.rs
+++ b/libspa/src/param/audio/raw.rs
@@ -29,7 +29,7 @@ impl AudioInfoRaw {
flags: AudioInfoRawFlags::UNPOSITIONED.bits(),
rate: 0,
channels: 0,
- position: [0; 64usize],
+ position: [0; spa_sys::SPA_AUDIO_MAX_CHANNELS as usize],
})
}
@@ -65,7 +65,7 @@ impl AudioInfoRaw {
self.0.channels
}
- pub fn set_position(&mut self, position: [u32; 64usize]) {
+ pub fn set_position(&mut self, position: [u32; spa_sys::SPA_AUDIO_MAX_CHANNELS as usize]) {
self.0.position = position;
if position[0] == 0 {
self.0.flags |= AudioInfoRawFlags::UNPOSITIONED.bits();
@@ -74,7 +74,7 @@ impl AudioInfoRaw {
};
}
- pub fn position(&self) -> [u32; 64usize] {
+ pub fn position(&self) -> [u32; spa_sys::SPA_AUDIO_MAX_CHANNELS as usize] {
self.0.position
}
Thank you! That works a treat. I imagine it will be compatible with pipewire from before and after the commit, now that it's using that macro.
Fixed by https://gitlab.freedesktop.org/pipewire/pipewire-rs/-/commit/8745eb6f0f0221e6c974b10b9e2b6599ff6a0e37
Edit: Still have to update the dependency
@dimtpap I've just seen this in pw's commit logs: https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/c94aff8cae158def64e20a320dcc1b1020d1d795
I haven't updated yet for obvious reasons, I thought you'd like to know about it.
Yeah I'm keeping track, thanks