No-sound on in game sleep / resume fix attempt#323
Closed
ro8inmorgan wants to merge 6 commits intomainfrom
Closed
Conversation
|
@ro8inmorgan I've got a PR open which makes some changes to the suspend script (#314). Might be worth merging them together into one PR? |
Collaborator
Author
|
Continueing this on #314 |
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.
Expiriencing this bug myself finally I got to take a look at the logs when this happens. The only real hint I could find searching through all the logs was the following line
ERROR: ALSA write failed (unrecoverable): File descriptor in bad state
Which seemed to be happening somewhere in the suspend script. Looking over this script I noticed 2 things first the alsa store/restore commands
alsactl --file "$asound_state_dir/asound.state.post" store || true
I get why they are here, but I wonder if they are really needed. It looks like the internal firmware is already handling this properly so I'm not sure if we really need to do this. Disabling these commands made no difference and sleeping resuming has no noticable changes with our without these commands. Sound still restores at the same volume so yeah.
However disabling these commands unfortunately did not resolve the bug as after a couple of sleep resume tries I still got the bug, so I looked into it a bit further and than I realize the resume part of the script was running backgrounded. The reason why is commented as
Resume services in background to reduce UI latencyBut this means when you resume directly back into the game it will run nextarch while the resume stuff is still running which my suspicion is that it could be the game will start running even before the sound driver is ready to accept sound.
I've run now a couple of tests sleeping/resuming with running after() normally without backgrounding. Firstly I really see no difference at all in resume speed, but second I did not expirience the no-sound bug yet. So I think this might resolve the issue. But yeah it def needs more testing as this is a very random bug happening very inconsistently as its probably something being timing dependent. But for now I got high hopes on that this solves the issue. But lets do some more testing maybe involving some users before we merge this.