Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update alsa from 0.8 to 0.9 #852

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ asio-sys = { version = "0.2", path = "asio-sys", 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]
alsa = "0.8"
alsa = "0.9"
libc = "0.2"
jack = { version = "0.11", optional = true }

Expand Down
25 changes: 8 additions & 17 deletions src/host/alsa/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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,
};
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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))
Expand Down
Loading