Skip to content

Commit b2b9062

Browse files
authored
fix(pipewire): switch to localized, per-port device names (#1280)
1 parent c9f5e73 commit b2b9062

2 files changed

Lines changed: 2 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
- **CoreAudio**: Bump `objc2-core-foundation` dependency lower bound to 0.3.1.
2020
- **iOS**: Timestamps now include hardware latency and update when the audio route changes.
2121
- **JACK**: Timestamps now include port latency.
22+
- **PipeWire**: Devices with multiple ports now get distinct, localized, per-port names.
2223
- **WASAPI**: The `windows` and `windows-core` dependencies are now both pinned to 0.62.
2324

2425
### Fixed

src/host/pipewire/device.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ enum Role {
7171
#[derive(Clone, Debug, Default)]
7272
pub struct Device {
7373
node_name: String,
74-
nick_name: String,
7574
description: String,
7675
direction: DeviceDirection,
7776
channels: ChannelCount,
@@ -98,7 +97,6 @@ impl Device {
9897
fn sink_default() -> Self {
9998
Self {
10099
node_name: "sink_default".to_owned(),
101-
nick_name: "sink_default".to_owned(),
102100
description: "default_sink".to_owned(),
103101
direction: DeviceDirection::Duplex,
104102
channels: 2,
@@ -110,7 +108,6 @@ impl Device {
110108
fn input_default() -> Self {
111109
Self {
112110
node_name: "input_default".to_owned(),
113-
nick_name: "input_default".to_owned(),
114111
description: "default_input".to_owned(),
115112
direction: DeviceDirection::Input,
116113
channels: 2,
@@ -122,7 +119,6 @@ impl Device {
122119
fn output_default() -> Self {
123120
Self {
124121
node_name: "output_default".to_owned(),
125-
nick_name: "output_default".to_owned(),
126122
description: "default_output".to_owned(),
127123
direction: DeviceDirection::Output,
128124
channels: 2,
@@ -220,7 +216,7 @@ impl DeviceTrait for Device {
220216
}
221217

222218
fn description(&self) -> Result<DeviceDescription, Error> {
223-
let mut builder = DeviceDescriptionBuilder::new(&self.nick_name)
219+
let mut builder = DeviceDescriptionBuilder::new(&self.description)
224220
.direction(self.direction)
225221
.device_type(self.device_type())
226222
.interface_type(self.interface_type);
@@ -230,9 +226,6 @@ impl DeviceTrait for Device {
230226
if let Some(driver) = self.driver.as_ref() {
231227
builder = builder.driver(driver);
232228
}
233-
if !self.description.is_empty() && self.description != self.nick_name {
234-
builder = builder.add_extended_line(&self.description);
235-
}
236229
Ok(builder.build())
237230
}
238231

@@ -938,10 +931,6 @@ pub fn init_devices(connect_automatically: Arc<AtomicBool>) -> Option<Vec<Device
938931
.get(*pw::keys::NODE_DESCRIPTION)
939932
.unwrap_or("unknown")
940933
.to_owned();
941-
let nick_name = props
942-
.get(*pw::keys::NODE_NICK)
943-
.unwrap_or(description.as_str())
944-
.to_owned();
945934
let channels = props
946935
.get(*pw::keys::AUDIO_CHANNELS)
947936
.and_then(|channels| channels.parse().ok())
@@ -993,7 +982,6 @@ pub fn init_devices(connect_automatically: Arc<AtomicBool>) -> Option<Vec<Device
993982

994983
let device = Device {
995984
node_name,
996-
nick_name,
997985
description,
998986
direction,
999987
role,

0 commit comments

Comments
 (0)