Update alsa from 0.8 to 0.9 (#852)

This commit is contained in:
Fredrik Fornwall 2024-03-01 16:18:59 +01:00 • committed by GitHub
parent 403ffb557a
commit 70d65b54bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 18 deletions

View file

@ -43,7 +43,7 @@ asio-sys = { version = "0.2", path = "asio-sys", optional = true }
num-traits = { version = "0.2.6", optional = true } num-traits = { version = "0.2.6", optional = true }
[target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd"))'.dependencies] [target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd"))'.dependencies]
alsa = "0.8" alsa = "0.9"
libc = "0.2" libc = "0.2"
jack = { version = "0.11", optional = true } jack = { version = "0.11", optional = true }

View file

@ -255,12 +255,8 @@ impl Device {
.map_err(|e| (e, e.errno())); .map_err(|e| (e, e.errno()));
let handle = match handle_result { let handle = match handle_result {
Err((_, alsa::nix::errno::Errno::EBUSY)) => { Err((_, libc::EBUSY)) => return Err(BuildStreamError::DeviceNotAvailable),
return Err(BuildStreamError::DeviceNotAvailable) Err((_, libc::EINVAL)) => return Err(BuildStreamError::InvalidArgument),
}
Err((_, alsa::nix::errno::Errno::EINVAL)) => {
return Err(BuildStreamError::InvalidArgument)
}
Err((e, _)) => return Err(e.into()), Err((e, _)) => return Err(e.into()),
Ok(handle) => handle, Ok(handle) => handle,
}; };
@ -316,13 +312,10 @@ impl Device {
.map_err(|e| (e, e.errno())); .map_err(|e| (e, e.errno()));
let handle = match handle_result { let handle = match handle_result {
Err((_, alsa::nix::errno::Errno::ENOENT)) Err((_, libc::ENOENT)) | Err((_, libc::EBUSY)) => {
| Err((_, alsa::nix::errno::Errno::EBUSY)) => {
return Err(SupportedStreamConfigsError::DeviceNotAvailable) return Err(SupportedStreamConfigsError::DeviceNotAvailable)
} }
Err((_, alsa::nix::errno::Errno::EINVAL)) => { Err((_, libc::EINVAL)) => return Err(SupportedStreamConfigsError::InvalidArgument),
return Err(SupportedStreamConfigsError::InvalidArgument)
}
Err((e, _)) => return Err(e.into()), Err((e, _)) => return Err(e.into()),
Ok(handle) => handle, Ok(handle) => handle,
}; };
@ -759,9 +752,7 @@ fn poll_descriptors_and_prepare_buffer(
let status = stream.channel.status()?; let status = stream.channel.status()?;
let avail_frames = match stream.channel.avail() { let avail_frames = match stream.channel.avail() {
Err(err) if err.errno() == alsa::nix::errno::Errno::EPIPE => { Err(err) if err.errno() == libc::EPIPE => return Ok(PollDescriptorsFlow::XRun),
return Ok(PollDescriptorsFlow::XRun)
}
res => res, res => res,
}? as usize; }? as usize;
let delay_frames = match status.get_delay() { let delay_frames = match status.get_delay() {
@ -842,7 +833,7 @@ fn process_output(
} }
loop { loop {
match stream.channel.io_bytes().writei(buffer) { match stream.channel.io_bytes().writei(buffer) {
Err(err) if err.errno() == alsa::nix::errno::Errno::EPIPE => { Err(err) if err.errno() == libc::EPIPE => {
// buffer underrun // buffer underrun
// TODO: Notify the user of this. // TODO: Notify the user of this.
let _ = stream.channel.try_recover(err, false); let _ = stream.channel.try_recover(err, false);
@ -882,8 +873,8 @@ fn stream_timestamp(
let nanos = timespec_diff_nanos(ts, trigger_ts); let nanos = timespec_diff_nanos(ts, trigger_ts);
if nanos < 0 { if nanos < 0 {
panic!( panic!(
"get_htstamp `{:?}` was earlier than get_trigger_htstamp `{:?}`", "get_htstamp `{}.{}` was earlier than get_trigger_htstamp `{}.{}`",
ts, trigger_ts ts.tv_sec, ts.tv_nsec, trigger_ts.tv_sec, ts.tv_nsec
); );
} }
Ok(crate::StreamInstant::from_nanos(nanos)) Ok(crate::StreamInstant::from_nanos(nanos))