Fix guest sound playback XRUN issue#138
Open
Cuda-Chen wants to merge 1 commit into
Open
Conversation
ed76457 to
07f3dca
Compare
There was a problem hiding this comment.
1 issue found across 3 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Fix guest OS sound playback XRUN (underrun, specifically) issue. As using a concurrent queue with conditional variables holding PCM frames, apply the famous self pipe trick so that the emulator can safely handle asynchronous signals when virtio-snd is enabled.
07f3dca to
2279fe3
Compare
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
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.
Fix guest OS sound playback XRUN (underrun, specifically) issue.
As using a concurrent queue with conditional variables holding PCM
frames, apply the famous self pipe trick so that the emulator can
safely handle asynchronous signals when virtio-snd is enabled.
Test Procedures
=yin the Linux Kernel config:rm linux/.config../scripts/build-image.sh --linux.make checkto run emulated guest OS.echo 3 > /proc/asound/card0/pcmp0/xrun_debug.aplay /usr/share/sounds/alsa/Front_Center.wavthree times in guest OS.dmesg.Expected Results
dmesgshould not produce any XRUN messages, for example:Summary by cubic
Fixes guest audio playback XRUNs and the missing last period by waking the event loop on each used-ring update, honoring the guest’s period size, and draining buffers before stop. Playback now ends cleanly without underruns or dropping the final period.
VIRTIOSND; on each used-ring update raise IRQ with release semantics and write one wake byte sopoll(-1)unblocks promptly.lenand index inside the processing loop to ensure the final period is reported.period_bytes; clear the release flag on START and wait for PortAudio to drain pending buffers before STOP.Written for commit 2279fe3. Summary will update on new commits.