Better error handling in format detection

This commit is contained in:
Pierre Krieger 2015-09-01 15:33:44 +02:00
parent dc08fc4652
commit 77fb55329e
1 changed files with 7 additions and 1 deletions

View File

@ -110,7 +110,13 @@ impl Endpoint {
unsafe { unsafe {
let mut format_ptr = mem::uninitialized(); let mut format_ptr = mem::uninitialized();
check_result((*client).GetMixFormat(&mut format_ptr)).unwrap(); // FIXME: don't unwrap match check_result((*client).GetMixFormat(&mut format_ptr)) {
Err(ref e) if e.raw_os_error() == Some(winapi::AUDCLNT_E_DEVICE_INVALIDATED) => {
return Err(FormatsEnumerationError::DeviceNotAvailable);
},
Err(e) => panic!("{:?}", e),
Ok(()) => (),
};
let format = { let format = {
let data_type = match (*format_ptr).wFormatTag { let data_type = match (*format_ptr).wFormatTag {