mirror of
https://github.com/arabianq/pipewire-soundpad.git
synced 2026-04-28 06:21:23 +00:00
perf: optimize value lookup in loop in GetFullStateCommand::execute (#18)
Moved the access of `audio_player.input_device_name` outside the loop in `GetFullStateCommand::execute` to avoid repeated field access and Option checking during iteration. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
f5c7d9bb2c
commit
80a8b1a45f
@@ -380,13 +380,14 @@ impl Executable for GetFullStateCommand {
|
|||||||
let mut current_input_nick = String::new();
|
let mut current_input_nick = String::new();
|
||||||
|
|
||||||
let audio_player = get_audio_player().await.lock().await;
|
let audio_player = get_audio_player().await.lock().await;
|
||||||
|
let current_input_name = audio_player.input_device_name.as_deref();
|
||||||
for device in input_devices {
|
for device in input_devices {
|
||||||
if device.name == "pwsp-virtual-mic" {
|
if device.name == "pwsp-virtual-mic" {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(current_input_name) = &audio_player.input_device_name {
|
if let Some(name) = current_input_name {
|
||||||
if device.name == *current_input_name {
|
if device.name == name {
|
||||||
current_input_nick = format!("{} - {}", device.name, device.nick);
|
current_input_nick = format!("{} - {}", device.name, device.nick);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user