Skip to content

Commit

Permalink
Show reason for retrying playback and capture
Browse files Browse the repository at this point in the history
  • Loading branch information
HEnquist committed Sep 9, 2020
1 parent 50718c3 commit cf17ed5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/alsadevice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ fn play_buffer(buffer: &[u8], pcmdevice: &alsa::PCM, io: &alsa::pcm::IO<u8>) ->
}
let _frames = match io.writei(&buffer[..]) {
Ok(frames) => frames,
Err(_err) => {
warn!("Retrying playback");
Err(err) => {
warn!("Retrying playback, error: {}", err);
pcmdevice.prepare()?;
let delay = Duration::from_millis(5);
thread::sleep(delay);
Expand All @@ -123,8 +123,8 @@ fn capture_buffer(buffer: &mut [u8], pcmdevice: &alsa::PCM, io: &alsa::pcm::IO<u
}
let _frames = match io.readi(buffer) {
Ok(frames) => frames,
Err(_err) => {
warn!("retrying capture");
Err(err) => {
warn!("Retrying capture, error: {}", err);
pcmdevice.prepare()?;
io.readi(buffer)?
}
Expand Down Expand Up @@ -413,7 +413,7 @@ fn get_nbr_capture_bytes(
buf: &mut Vec<u8>,
) -> usize {
let capture_bytes_new = if let Some(resampl) = &resampler {
trace!("Resamper needs {} frames", resampl.nbr_frames_needed());
trace!("Resampler needs {} frames", resampl.nbr_frames_needed());
resampl.nbr_frames_needed() * params.channels * params.store_bytes_per_sample
} else {
capture_bytes
Expand Down

0 comments on commit cf17ed5

Please sign in to comment.