Merge pull request #711 from mbodmer/update_nix_to_0.25

update nix crate to v0.25
This commit is contained in:
est31 2022-10-20 20:43:49 +02:00 • committed by GitHub
commit 4b49fbd259
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 8 deletions

View file

@ -34,7 +34,7 @@ once_cell = "1.12"
[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.6" alsa = "0.6"
nix = "0.23" nix = "0.25"
libc = "0.2.65" libc = "0.2.65"
parking_lot = "0.12" parking_lot = "0.12"
jack = { version = "0.9", optional = true } jack = { version = "0.9", optional = true }
@ -51,7 +51,7 @@ coreaudio-rs = { version = "0.10", default-features = false, features = ["audio_
coreaudio-rs = { version = "0.10", default-features = false, features = ["audio_unit", "core_audio", "audio_toolbox"] } coreaudio-rs = { version = "0.10", default-features = false, features = ["audio_unit", "core_audio", "audio_toolbox"] }
[target.'cfg(target_os = "emscripten")'.dependencies] [target.'cfg(target_os = "emscripten")'.dependencies]
stdweb = { version = "0.1.3", default-features = false } stdweb = { version = "0.4.20", default-features = false }
[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies] [target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
wasm-bindgen = { version = "0.2.58", optional = true } wasm-bindgen = { version = "0.2.58", optional = true }

View file

@ -255,8 +255,12 @@ 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((_, nix::errno::Errno::EBUSY)) => return Err(BuildStreamError::DeviceNotAvailable), Err((_, alsa::nix::errno::Errno::EBUSY)) => {
Err((_, nix::errno::Errno::EINVAL)) => return Err(BuildStreamError::InvalidArgument), return Err(BuildStreamError::DeviceNotAvailable)
}
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,
}; };
@ -312,10 +316,11 @@ 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((_, nix::errno::Errno::ENOENT)) | Err((_, nix::errno::Errno::EBUSY)) => { Err((_, alsa::nix::errno::Errno::ENOENT))
| Err((_, alsa::nix::errno::Errno::EBUSY)) => {
return Err(SupportedStreamConfigsError::DeviceNotAvailable) return Err(SupportedStreamConfigsError::DeviceNotAvailable)
} }
Err((_, nix::errno::Errno::EINVAL)) => { Err((_, alsa::nix::errno::Errno::EINVAL)) => {
return Err(SupportedStreamConfigsError::InvalidArgument) return Err(SupportedStreamConfigsError::InvalidArgument)
} }
Err((e, _)) => return Err(e.into()), Err((e, _)) => return Err(e.into()),
@ -749,7 +754,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() == nix::errno::Errno::EPIPE => { Err(err) if err.errno() == alsa::nix::errno::Errno::EPIPE => {
return Ok(PollDescriptorsFlow::XRun) return Ok(PollDescriptorsFlow::XRun)
} }
res => res, res => res,
@ -832,7 +837,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() == nix::errno::Errno::EPIPE => { Err(err) if err.errno() == alsa::nix::errno::Errno::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);