Skip to content

Commit ed7e988

Browse files
committed
fix(coreaudio): prefer stereo output configuration on iOS
1 parent ea167cf commit ed7e988

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
119119
- **CoreAudio**: Streams no longer start automatically on creation; call `play()` manually.
120120
- **CoreAudio (iOS)**: `default_input_config()` and `default_output_config()` now prefer 48 kHz,
121121
then 44.1 kHz, then the maximum supported sample rate, instead of always taking the maximum.
122+
- **CoreAudio (iOS)**: `default_output_config()` now prefers stereo over the maximum channel count.
122123
- **JACK**: Timestamps now use the precise hardware deadline.
123124
- **JACK**: Buffer size change no longer invokes the error callback; internal buffers are resized
124125
without error.

src/host/coreaudio/ios/mod.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,14 @@ impl Device {
118118
}
119119

120120
fn default_output_config(&self) -> Result<SupportedStreamConfig, Error> {
121-
// Get the maximum channel count config from supported configs
122-
let range = get_supported_stream_configs(false).last().ok_or_else(|| {
123-
Error::with_message(
124-
ErrorKind::UnsupportedConfig,
125-
"No supported output configuration",
126-
)
127-
})?;
121+
let range = get_supported_stream_configs(false)
122+
.max_by(|a, b| a.cmp_default_heuristics(b))
123+
.ok_or_else(|| {
124+
Error::with_message(
125+
ErrorKind::UnsupportedConfig,
126+
"No supported output configuration",
127+
)
128+
})?;
128129
Ok(range
129130
.try_with_standard_sample_rate()
130131
.unwrap_or_else(|| range.with_max_sample_rate()))

0 commit comments

Comments
 (0)