mirror of
https://github.com/librespot-org/librespot.git
synced 2024-11-08 16:45:43 +00:00
Merge branch 'librespot-org:dev' into improve-subprocess-backend
This commit is contained in:
commit
9b2490e4e1
2 changed files with 14 additions and 7 deletions
|
@ -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
|
||||
|
|
16
src/main.rs
16
src/main.rs
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue