diff --git a/src/host/alsa/enumerate.rs b/src/host/alsa/enumerate.rs index 4b9d747..a269d7b 100644 --- a/src/host/alsa/enumerate.rs +++ b/src/host/alsa/enumerate.rs @@ -49,13 +49,15 @@ impl Iterator for Devices { // See if the device has an available output stream. let has_available_output = { - let playback_handle = alsa::pcm::PCM::new(&name, alsa::Direction::Playback, true); + let playback_handle = + alsa::pcm::PCM::new(&name, alsa::Direction::Playback, true); playback_handle.is_ok() }; // See if the device has an available input stream. let has_available_input = { - let capture_handle = alsa::pcm::PCM::new(&name, alsa::Direction::Capture, true); + let capture_handle = + alsa::pcm::PCM::new(&name, alsa::Direction::Capture, true); capture_handle.is_ok() }; diff --git a/src/host/alsa/mod.rs b/src/host/alsa/mod.rs index 8818977..c094bf1 100644 --- a/src/host/alsa/mod.rs +++ b/src/host/alsa/mod.rs @@ -8,10 +8,10 @@ use crate::{ StreamConfig, StreamError, SupportedStreamConfig, SupportedStreamConfigRange, SupportedStreamConfigsError, }; +use std::cmp; use std::sync::Arc; use std::thread::{self, JoinHandle}; use std::vec::IntoIter as VecIntoIter; -use std::cmp; use traits::{DeviceTrait, HostTrait, StreamTrait}; pub use self::enumerate::{default_input_device, default_output_device, Devices}; @@ -173,7 +173,8 @@ impl Device { ) -> Result { let name = &self.0; - let handle = match alsa::pcm::PCM::new(name, stream_type, true).map_err(|e| (e, e.errno())) { + let handle = match alsa::pcm::PCM::new(name, stream_type, true).map_err(|e| (e, e.errno())) + { Err((_, Some(nix::errno::Errno::EBUSY))) => { return Err(BuildStreamError::DeviceNotAvailable) } @@ -747,11 +748,11 @@ impl Drop for Stream { impl StreamTrait for Stream { fn play(&self) -> Result<(), PlayStreamError> { - self.inner.channel.pause(false)?; + self.inner.channel.pause(false).ok(); Ok(()) } fn pause(&self) -> Result<(), PauseStreamError> { - self.inner.channel.pause(true)?; + self.inner.channel.pause(true).ok(); Ok(()) } }