Skip to content

Commit

Permalink
bump nix and alsa
Browse files Browse the repository at this point in the history
  • Loading branch information
haileys committed Jun 28, 2024
1 parent ced8036 commit 4353c52
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 30 deletions.
40 changes: 28 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions bark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ opus = ["bark-core/opus"]
bark-core = { workspace = true }
bark-protocol = { workspace = true }

alsa = "0.8.1"
alsa = "0.9"
bitflags = { workspace = true }
bytemuck = { workspace = true, features = ["extern_crate_alloc"] }
derive_more = { workspace = true }
env_logger = { version = "0.10", default-features = false, features = ["color", "auto-color", "humantime"] }
libc = "0.2.147"
libc = "0.2.155"
log = { workspace = true }
nix = { version = "0.26.2", features = ["time", "socket", "net", "poll", "user", "hostname"], default-features = false }
nix = { version = "0.29", features = ["time", "socket", "net", "poll", "user", "hostname"], default-features = false }
rand = "0.8.5"
serde = { version = "1.0.183", features = ["derive"] }
serde_json = "1.0.105"
Expand Down
9 changes: 4 additions & 5 deletions bark/src/audio/alsa/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use alsa::Direction;
use alsa::pcm::PCM;
use bark_core::audio::{Frame, self};
use bark_protocol::time::{Timestamp, SampleDuration};
use nix::errno::Errno;

use crate::audio::config::DeviceOpt;
use crate::audio::alsa::config::{self, OpenError};
Expand Down Expand Up @@ -46,13 +45,13 @@ impl Input {

// handle recoverable errors
match err.errno() {
| Errno::EPIPE // underrun
| Errno::ESTRPIPE // stream suspended
| Errno::EINTR // interrupted syscall
| libc::EPIPE // underrun
| libc::ESTRPIPE // stream suspended
| libc::EINTR // interrupted syscall
=> {
log::warn!("recovering from error: {}", err.errno());
// try to recover
self.pcm.recover(err.errno() as i32, false)?;
self.pcm.recover(err.errno(), false)?;
}
_ => { return Err(err.into()); }
}
Expand Down
9 changes: 4 additions & 5 deletions bark/src/audio/alsa/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use alsa::Direction;
use alsa::pcm::PCM;
use bark_core::audio::{Frame, self};
use bark_protocol::time::SampleDuration;
use nix::errno::Errno;

use crate::audio::config::DeviceOpt;
use crate::audio::alsa::config::{self, OpenError};
Expand Down Expand Up @@ -42,13 +41,13 @@ impl Output {

// handle recoverable errors
match err.errno() {
| Errno::EPIPE // underrun
| Errno::ESTRPIPE // stream suspended
| Errno::EINTR // interrupted syscall
| libc::EPIPE // underrun
| libc::ESTRPIPE // stream suspended
| libc::EINTR // interrupted syscall
=> {
log::warn!("recovering from error: {}", err.errno());
// try to recover
self.pcm.recover(err.errno() as i32, false)?;
self.pcm.recover(err.errno(), false)?;
}
_ => { return Err(err.into()); }
}
Expand Down
10 changes: 5 additions & 5 deletions bark/src/socket.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::io;
use std::net::{Ipv4Addr, UdpSocket, SocketAddr, SocketAddrV4};
use std::os::fd::AsRawFd;
use std::os::fd::AsFd;

use derive_more::Display;
use nix::poll::{PollFd, PollFlags};
use nix::poll::{PollFd, PollFlags, PollTimeout};
use socket2::{Domain, Type};
use structopt::StructOpt;

Expand Down Expand Up @@ -77,11 +77,11 @@ impl Socket {

pub fn recv_from(&self, buf: &mut [u8]) -> Result<(usize, PeerId), io::Error> {
let mut poll = [
PollFd::new(self.tx.as_raw_fd(), PollFlags::POLLIN),
PollFd::new(self.rx.as_raw_fd(), PollFlags::POLLIN),
PollFd::new(self.tx.as_fd(), PollFlags::POLLIN),
PollFd::new(self.rx.as_fd(), PollFlags::POLLIN),
];

nix::poll::poll(&mut poll, -1)?;
nix::poll::poll(&mut poll, PollTimeout::NONE)?;

let (nbytes, addr) =
if poll[0].any() == Some(true) {
Expand Down

0 comments on commit 4353c52

Please sign in to comment.