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

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