Merge branch 'librespot-org:dev' into improve-subprocess-backend

This commit is contained in:
Jason Gray 2022-06-30 21:33:47 -05:00 committed by GitHub
commit 9b2490e4e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 7 deletions

View file

@ -6,7 +6,6 @@ use crate::{NUM_CHANNELS, SAMPLE_RATE};
use alsa::device_name::HintIter;
use alsa::pcm::{Access, Format, Frames, HwParams, PCM};
use alsa::{Direction, ValueOr};
use std::cmp::min;
use std::process::exit;
use thiserror::Error;
@ -141,7 +140,7 @@ fn list_compatible_devices() -> SinkResult<()> {
println!(
"\tDescription:\n\n\t\t{}\n",
a.desc.unwrap_or_default().replace("\n", "\n\t\t")
a.desc.unwrap_or_default().replace('\n', "\n\t\t")
);
println!(
@ -467,7 +466,7 @@ impl SinkAsBytes for AlsaSink {
loop {
let data_left = data_len - start_index;
let space_left = capacity - self.period_buffer.len();
let data_to_buffer = min(data_left, space_left);
let data_to_buffer = data_left.min(space_left);
let end_index = start_index + data_to_buffer;
self.period_buffer

View file

@ -658,7 +658,15 @@ fn get_setup() -> Setup {
trace!("Command line argument(s):");
for (index, key) in args.iter().enumerate() {
let opt = key.trim_start_matches('-');
let opt = {
let key = key.trim_start_matches('-');
if let Some((s, _)) = key.split_once('=') {
s
} else {
key
}
};
if index > 0
&& key.starts_with('-')
@ -668,13 +676,13 @@ fn get_setup() -> Setup {
{
if matches!(opt, PASSWORD | PASSWORD_SHORT | USERNAME | USERNAME_SHORT) {
// Don't log creds.
trace!("\t\t{} \"XXXXXXXX\"", key);
trace!("\t\t{} \"XXXXXXXX\"", opt);
} else {
let value = matches.opt_str(opt).unwrap_or_else(|| "".to_string());
if value.is_empty() {
trace!("\t\t{}", key);
trace!("\t\t{}", opt);
} else {
trace!("\t\t{} \"{}\"", key, value);
trace!("\t\t{} \"{}\"", opt, value);
}
}
}