Repository navigation
winmm: preserve pending samples across transient write failures - #321
Conversation
|
Could you use Review comment authored by Codex on behalf of @hajimehoshi. |
|
Addressed in A private regression uses the actual appendBuffers method with native writes and sleeping substituted. Both paths fail the fixed-delay check before the change for small and large buffers, and pass afterward under race. The existing PCM retry-order, alternate-header success and fatal-write checks also pass. Internal package race tests, the other vet analyzers, and Windows 386/amd64/arm64 builds passed. Native Windows playback, driver failure and actual sleep timing were not tested; Windows may sleep longer than the requested interval. All nine exact-head upstream checks passed (https://github.com/ebitengine/oto/actions/runs/38783327144), as did all nine fork checks (https://github.com/kumagi/oto/actions/runs/38783319555). |
|
Sorry for the unnecessary change request above. I overlooked that the buffer-duration sleep logic already existed and was being reused here. Please disregard my request to use a fixed 1 ms delay for both retry paths. If you have already applied that suggestion, please revert just that adjustment and retain the buffer-duration delay as originally proposed in this PR. Comment authored by Codex on behalf of @hajimehoshi. |
|
One optional cleanup suggestion: could the shared buffer-duration calculation and sleep be extracted into a WinMM-specific helper, such as Comment authored by Codex on behalf of @hajimehoshi. |
|
Addressed the updated request in Private regression tests using the actual methods with native writes and sleeping substituted fail on the fixed-delay head and pass afterward under race: both NODRIVER and all-headers-NOMEM paths request the original duration for normal and large buffers (1 ms and 500 ms). PCM retry ordering, alternate-header success and fatal termination still pass. Internal package race tests, the other vet analyzers, and Windows 386/amd64/arm64 builds passed. Native Windows playback, driver failure and actual scheduler sleep timing were not tested. All nine exact-head upstream checks passed (https://github.com/ebitengine/oto/actions/runs/38787774178), as did all nine fork checks (https://github.com/kumagi/oto/actions/runs/38787767559). |
What issue is this addressing?
None
What type of issue is this addressing?
bug
What this PR does | solves
Keep PCM pending until a header accepts it, including MMSYSERR_NOMEM and MMSYSERR_NODRIVER retries. Back off for a buffer duration if all headers reject with NOMEM rather than immediately consuming and discarding another chunk. Fatal errors remain terminal.
Validation: An actual-method private race harness detects the original lost PCM sequence and passes after the fix. It covers NOMEM/NODRIVER followed by success, acceptance by another header, positive retry backoff and fatal-write termination. Native writes and sleeping are substituted.
Native macOS arm64 internal race tests and build passed. Windows 386/amd64/arm64 builds passed (compile only). Internal vet and other analyzers passed; full vet retains unchanged baseline Darwin unsafe.Pointer and Windows unkeyed GUID diagnostics. Native Windows playback, reconnect and recovery were not run. Independent review found no blocking issue.
The retry wait is shared by the WinMM-specific
waitBeforeRetry()helper; both retry paths retain the original buffer-duration delay.