fix(audioin): never return a no-device block before its deadline #532
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/532"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-04T15:28:05Z.
What
Fixes the intermittent Windows crash of
guest_audio_in_no_device(0xc0000409) reported on #243.The crash is the test's
Requireaborting onelapsed >= 4 * 16 ms, because on Windows the no-devicesceAudioInInputcould return before its block deadline:this_thread::sleep_untilon a steady clock makes a singlesleep_for(atime - now)call and doesn't check the clock again (bits/this_thread_sleep.h, GCC 15.2, the CI toolchain).sleep_forends in winpthreadsnanosleep, which truncates the request to whole milliseconds (tv_sec * 1000 + tv_nsec / 1000000,winpthreads/src/nanosleep.c, mingw-w64 14). So it sleeps up to 1 ms short, andSleepitself may also wake early. If less than 1 ms is left, it doesn't sleep at all.So the fifth block can come back just under 64 ms. glibc's
nanosleepnever returns early, which is why it only shows up on Windows.sceAudioInInputnow sleeps until the clock actually reaches the deadline. That is also the pacing a guest relies on: one block per grain, never early. The SDL capture path already pollsClock::now()against its deadline and is unchanged.Tested
Linux: Release build, full ctest (only
agc_driver_pixel_helper_lanesfails, which also fails onmainwith local RADV), andguest_audio_in_*with--repeat until-fail:20. I have no Windows machine, so I couldn't reproduce the early wake locally: the fix comes from the two sources above. A few Windows CI reruns on a fork would confirm it.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-04T18:36:59Z.
Thanks, this matches what I found: on the Windows CI toolchain
sleep_untilcan wake about 1 ms early. With this exact change my fork's Windows CI ran the test 1200 times with 0 failures, against 19 in 300 on main.