Skip to content

Commit

Permalink
Remove the test_set_channel_layout_input
Browse files Browse the repository at this point in the history
Calling audiounit_get_current_channel_layout by input-only
(microphone-only) AudioUnit is prone to cause crash intermittently.

The test_set_channel_layout_input is likely to cause intermittent crash
since it calls audiounit_get_current_channel_layout by a input-only
AudioUnit. Removing this test can avoid the random crashes when running
`cargo test` (#31).

The cubeb implementation has no need to get the channel-layout on input
side, so the test_set_channel_layout_input is unnecessary anyway.
  • Loading branch information
ChunMinChang committed Dec 18, 2019
1 parent 868d847 commit 8e0d869
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
2 changes: 2 additions & 0 deletions src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 0 additions & 17 deletions src/backend/tests/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 8e0d869

Please # to comment.