diff --git a/src/backend/mod.rs b/src/backend/mod.rs index 69058219..f9221277 100644 --- a/src/backend/mod.rs +++ b/src/backend/mod.rs @@ -1001,6 +1001,8 @@ fn audiounit_get_preferred_channel_layout(output_unit: AudioUnit) -> ChannelLayo audiounit_convert_channel_layout(layout.as_ref()) } +// This is for output AudioUnit only. Calling this by input-only AudioUnit is prone +// to crash intermittently. fn audiounit_get_current_channel_layout(output_unit: AudioUnit) -> ChannelLayout { let mut rv = NO_ERR; let mut size: usize = 0; diff --git a/src/backend/tests/api.rs b/src/backend/tests/api.rs index 71343e26..27d4f473 100644 --- a/src/backend/tests/api.rs +++ b/src/backend/tests/api.rs @@ -980,23 +980,6 @@ fn test_set_channel_layout_output_undefind() { } } -#[test] -fn test_set_channel_layout_input() { - if let Some(unit) = test_get_default_audiounit(Scope::Input) { - // Get original layout. - let original_layout = audiounit_get_current_channel_layout(unit.get_inner()); - // Leave layout as it is. - assert!(audiounit_set_channel_layout(unit.get_inner(), ChannelLayout::UNDEFINED).is_ok()); - // Check the layout is same as the original one. - assert_eq!( - audiounit_get_current_channel_layout(unit.get_inner()), - original_layout - ); - } else { - println!("No input audiounit."); - } -} - #[test] #[should_panic] fn test_set_channel_layout_with_null_unit() {