Skip to content

Commit 636e52e

Browse files
roderickvdabique
andauthored
refactor(alsa): optimize period configuration and audio callback performance (#1013)
* refactor(alsa): optimize period configuration and audio callback performance Implement device-aware period configuration strategy: - Query device limits to determine optimal approach - Prefer double buffering when buffer fits within device period size limits - Use multi-period configuration for larger buffers with calculated period distribution - Fallback to buffer-size-only configuration for maximum device compatibility Performance optimizations: - Pre-allocate worker thread buffers and silence templates - Cache period_frames and period_samples in StreamInner for hot path performance - Pre-fill descriptors array once instead of reallocating on each poll * docs: clarify FrameCount and improve BufferSize documentation * feat(alsa): enable support for U24 sample format * refactor: rename to clippy::too_many_arguments Co-authored-by: Alexandre Bique <[email protected]>
1 parent 87b7036 commit 636e52e

File tree

4 files changed

+334
-96
lines changed

4 files changed

+334
-96
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
- Add `Sample::bits_per_sample` method.
44
- Update `audio_thread_priority` to 0.34.
5-
- ALSA: Fix `BufferSize::Fixed` by selecting the nearest supported frame count.
5+
- ALSA: Improve `BufferSize::Fixed` latency precision and audio callback performance.
66
- ALSA: Change `BufferSize::Default` to use the device defaults.
77
- ALSA: Change card enumeration to work like `aplay -L` does.
88
- ALSA: Add `I24` and `U24` sample format support (24-bit samples stored in 4 bytes).

0 commit comments

Comments
 (0)