add timeout paramter to DeviceTrait stream builders (#696)
* add timeout paramter to DeviceTrait stream builders This makes it possible for the library client to handle situations where the host takes too long to respond or even blocks forever, eg. a retry can be applied. if the timeout passed is "None" the current behaviour is applied, eg. blocking forever. if the timeout passed is a Duration then it will be applied to the Device Streams. This is only implemented for ALSA, the other hosts will ignore the parameter for now. Signed-off-by: Marc Bodmer <marc.bodmer@securiton.ch>
This commit is contained in:
parent
def424809b
commit
0a3e8c2208
21 changed files with 148 additions and 21 deletions
|
|
@ -1,6 +1,7 @@
|
|||
use std::mem;
|
||||
use std::os::raw::c_void;
|
||||
use std::slice::from_raw_parts;
|
||||
use std::time::Duration;
|
||||
use stdweb;
|
||||
use stdweb::unstable::TryInto;
|
||||
use stdweb::web::set_timeout;
|
||||
|
|
@ -171,6 +172,7 @@ impl DeviceTrait for Device {
|
|||
_sample_format: SampleFormat,
|
||||
_data_callback: D,
|
||||
_error_callback: E,
|
||||
_timeout: Option<Duration>,
|
||||
) -> Result<Self::Stream, BuildStreamError>
|
||||
where
|
||||
D: FnMut(&Data, &InputCallbackInfo) + Send + 'static,
|
||||
|
|
@ -185,6 +187,7 @@ impl DeviceTrait for Device {
|
|||
sample_format: SampleFormat,
|
||||
data_callback: D,
|
||||
error_callback: E,
|
||||
_timeout: Option<Duration>,
|
||||
) -> Result<Self::Stream, BuildStreamError>
|
||||
where
|
||||
D: FnMut(&mut Data, &OutputCallbackInfo) + Send + 'static,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue