[webaudio] Return Err instead of panicking on input device requests
Currently we are yet to implement input stream support for CPAL's webaudio host. Instead of panicking, we should return an error, None or empty iterator in order to let the user write well behaved cross-platform apps and notify the user accordingly rather than crashing.
This commit is contained in:
parent
1dfdeace25
commit
f03fd69b65
|
@ -85,7 +85,8 @@ impl Device {
|
||||||
fn supported_input_configs(
|
fn supported_input_configs(
|
||||||
&self,
|
&self,
|
||||||
) -> Result<SupportedInputConfigs, SupportedStreamConfigsError> {
|
) -> Result<SupportedInputConfigs, SupportedStreamConfigsError> {
|
||||||
unimplemented!();
|
// TODO
|
||||||
|
Ok(Vec::new().into_iter())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -105,7 +106,8 @@ impl Device {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn default_input_config(&self) -> Result<SupportedStreamConfig, DefaultStreamConfigError> {
|
fn default_input_config(&self) -> Result<SupportedStreamConfig, DefaultStreamConfigError> {
|
||||||
unimplemented!();
|
// TODO
|
||||||
|
Err(DefaultStreamConfigError::StreamTypeNotSupported)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -167,7 +169,8 @@ impl DeviceTrait for Device {
|
||||||
D: FnMut(&Data, &InputCallbackInfo) + Send + 'static,
|
D: FnMut(&Data, &InputCallbackInfo) + Send + 'static,
|
||||||
E: FnMut(StreamError) + Send + 'static,
|
E: FnMut(StreamError) + Send + 'static,
|
||||||
{
|
{
|
||||||
unimplemented!()
|
// TODO
|
||||||
|
Err(BuildStreamError::StreamConfigNotSupported)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create an output stream.
|
/// Create an output stream.
|
||||||
|
@ -406,7 +409,8 @@ impl Iterator for Devices {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn default_input_device() -> Option<Device> {
|
fn default_input_device() -> Option<Device> {
|
||||||
unimplemented!();
|
// TODO
|
||||||
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
Loading…
Reference in New Issue