Commit 2ffd9dc
committed
Handle zero rate/channels from hardware description gracefully
CoreAudio can report zero sample rate or channel count in the
hardware stream description during device transitions (e.g. device
unplug, default device change). This is the #1 cubeb-coreaudio
crash signature, with ~240 crash pings per 30 days on macOS,
100% in the main (parent) process.
Previously, create_stream_description() would panic on zero rate
or channels. Now:
- Validate rate and channel count in setup() immediately after
reading the hardware description, returning an error with
diagnostic logging when the values are invalid. This catches
the problem at the source, where we have full context (device
info, stream pointer).
- Convert the asserts in create_stream_description() to
debug_assert + error return, so programming errors are still
caught in dev builds but users don't crash.
- The output path already had a zero-channel check ("observed in
the wild"); extend it to also check rate, and add both checks
to the input path.1 parent 6767a85 commit 2ffd9dc
1 file changed
+32
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
270 | | - | |
271 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
272 | 286 | | |
273 | 287 | | |
274 | 288 | | |
| |||
3848 | 3862 | | |
3849 | 3863 | | |
3850 | 3864 | | |
| 3865 | + | |
| 3866 | + | |
| 3867 | + | |
| 3868 | + | |
| 3869 | + | |
| 3870 | + | |
| 3871 | + | |
| 3872 | + | |
| 3873 | + | |
| 3874 | + | |
3851 | 3875 | | |
3852 | 3876 | | |
3853 | 3877 | | |
| |||
4056 | 4080 | | |
4057 | 4081 | | |
4058 | 4082 | | |
4059 | | - | |
4060 | | - | |
| 4083 | + | |
| 4084 | + | |
4061 | 4085 | | |
4062 | | - | |
4063 | | - | |
| 4086 | + | |
| 4087 | + | |
| 4088 | + | |
| 4089 | + | |
4064 | 4090 | | |
4065 | 4091 | | |
4066 | 4092 | | |
| |||
0 commit comments