chore(audio-watch): drop deprecated DeviceTrait::name fallback
rodio deprecated `DeviceTrait::name()` in favour of `description()` (name) / `id()` (stable identifier). The legacy fallback in `preferred_name()` was unreachable on our target platforms anyway — the only path that matters is the `description()` one, since that is what `get_audio_devices()` persists in settings. Skip the device if `description()` fails instead of falling back to the deprecated API. Silences the build warning. cc
This commit is contained in:
1 file changed
+3
-5
@@ -82,12 +82,10 @@ pub fn check_selected_device_presence(settings: &AudioSettingsState) -> DevicePr
|
|||||||
// DeviceTrait::description() (richer, stable identifier). The
|
// DeviceTrait::description() (richer, stable identifier). The
|
||||||
// legacy DeviceTrait::name() returns a different string on some
|
// legacy DeviceTrait::name() returns a different string on some
|
||||||
// platforms (especially PipeWire-backed Linux) and would cause
|
// platforms (especially PipeWire-backed Linux) and would cause
|
||||||
// every configured device to look 'missing' here.
|
// every configured device to look 'missing' here, so we skip
|
||||||
|
// devices whose description() fails rather than falling back.
|
||||||
fn preferred_name(d: &rodio::cpal::Device) -> Option<String> {
|
fn preferred_name(d: &rodio::cpal::Device) -> Option<String> {
|
||||||
if let Ok(desc) = d.description() {
|
d.description().ok().map(|desc| desc.name().to_string())
|
||||||
return Some(desc.name().to_string());
|
|
||||||
}
|
|
||||||
d.name().ok()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut available: Vec<String> = Vec::new();
|
let mut available: Vec<String> = Vec::new();
|
||||||
|
|||||||
Reference in new issue
Block a user