-
Notifications
You must be signed in to change notification settings - Fork 447
fix(alsa): buffering behavior on PipeWire-ALSA #1033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
roderickvd
wants to merge
9
commits into
master
Choose a base branch
from
fix/pipewire-alsa-latency
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Avoid setting period count when BufferSize::Default is used, allowing PipeWire-ALSA to select optimal buffer and period sizes. This prevents excessively large periods and high latency on PipeWire-ALSA devices.
|
Note to self: drop should wait for two periods worth of time, not the full buffer. |
Set buffer_size_near before period_size_near for Fixed buffer sizes to constrain total latency and avoid extremely large allocations (eg. PipeWire-ALSA creating ~1M-frame buffers). Then set period_size to keep double-buffering semantics. Adjust avail_min by direction: for playback wake when level drops to one period (buffer - period); for capture wake when one period is available (period) to prevent excessive capture latency.
Revert to v0.16 behavior: always terminate stream without attempting state-based drain or wait. Remove buffer-duration calculation and snd_pcm_wait usage to avoid delays during drop.
Query the device's period size and set buffer_size to 2 * period for BufferSize::Default. This prevents excessive memory allocation (e.g. PipeWire-ALSA) while respecting the device's period preference.
This should always align with the two-period double-buffering strategy that we use anyway.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes high latency with
BufferSize::Defaulton PipeWire-ALSA by avoiding period count constraints that cause pathologically large periods.Fixes