mirror of
https://github.com/project-slippi/cpal.git
synced 2025-10-05 15:52:44 +02:00
Replace assert in WASAPI check with bubble'd error (#797)
Replace assert in WASAPI WAVEFORMTEX supported format check with bubbled error message. For our use case, this stops a crash that pops up for some users who encounter this path and allows us to gracefully just not play audio and log a message elsewhere.
This commit is contained in:
@@ -441,7 +441,12 @@ impl Device {
|
||||
.map_err(windows_err_to_cpal_err::<SupportedStreamConfigsError>)?;
|
||||
|
||||
// If the default format can't succeed we have no hope of finding other formats.
|
||||
assert!(is_format_supported(client, default_waveformatex_ptr.0)?);
|
||||
if !is_format_supported(client, default_waveformatex_ptr.0)? {
|
||||
let description =
|
||||
"Could not determine support for default `WAVEFORMATEX`".to_string();
|
||||
let err = BackendSpecificError { description };
|
||||
return Err(err.into());
|
||||
}
|
||||
|
||||
// Copy the format to use as a test format (as to avoid mutating the original format).
|
||||
let mut test_format = {
|
||||
|
Reference in New Issue
Block a user