Skip to content

Commit fe6a728

Browse files
committed
Allow failure of current_device
`AudioUnitStream::current_device` can fail when the default device has no `kAudioDevicePropertyDataSource` value.
1 parent 44eca95 commit fe6a728

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/backend/tests/interfaces.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -574,11 +574,14 @@ fn test_ops_stream_current_device() {
574574
println!("stream_get_current_device only works when the machine has both input and output devices");
575575
return;
576576
}
577+
577578
let mut device: *mut ffi::cubeb_device = ptr::null_mut();
578-
assert_eq!(
579-
unsafe { OPS.stream_get_current_device.unwrap()(stream, &mut device) },
580-
ffi::CUBEB_OK
581-
);
579+
if unsafe { OPS.stream_get_current_device.unwrap()(stream, &mut device) } != ffi::CUBEB_OK {
580+
// It can happen when we fail to get the device source.
581+
println!("stream_get_current_device fails. Skip this test.");
582+
return;
583+
}
584+
582585
assert!(!device.is_null());
583586
// Uncomment the below to print out the results.
584587
// let deviceref = unsafe { DeviceRef::from_ptr(device) };

0 commit comments

Comments
 (0)