Skip to content

Migrate to latest LUS and fix a bunch of warnings and issues detected by ubsan#6640

Draft
bassdr wants to merge 4 commits into
HarbourMasters:developfrom
bassdr:fix/ubsan
Draft

Migrate to latest LUS and fix a bunch of warnings and issues detected by ubsan#6640
bassdr wants to merge 4 commits into
HarbourMasters:developfrom
bassdr:fix/ubsan

Conversation

@bassdr
Copy link
Copy Markdown

@bassdr bassdr commented May 22, 2026

@briaguya0, FYI. Maybe you'll find something useful in here.

See Kenix3/libultraship#1107

banteg and others added 4 commits May 24, 2026 19:11
the audio producer is woken once per Graph_ProcessGfxCommands call and
pushes a single ~1680-sample burst sized for the current R_UPDATE_RATE.
two layered issues caused crackling on macos over hdmi:

- DesiredBuffered = 1680 was exactly one producer burst, so any video
  frame jitter emptied the device buffer between wakes -- audible as
  clicks. bump it to 4096 (~128 ms at 32 khz).

- on the file-select screen R_UPDATE_RATE is 1, which expects the
  producer to wake at ~60 hz. when the user's display rate is 20 fps
  the producer only wakes 20 times/s and structurally underproduces
  by 3x, no reservoir size can cover that. fix by running additional
  audio engine ticks within the same outer call until the reservoir
  is back at desired (capped at 6 iterations). each tick advances
  internal audio time by num_samples / sample_rate and the consumer
  drains them at the same rate, so audio still plays at normal speed.

also bumps the libultraship submodule to fix-coreaudio-crackling, which
replaces the locked ring buffer in the coreaudio backend with a
lock-free spsc ring (eliminating the priority-inversion path) and fixes
the wrap-equality + whole-chunk-drop bugs that produced clicks even on
the built-in speaker path.

verified on hdmi: underflow count over a 65 s session dropped from
1023 to 13 (only at startup), buffer level stays in the 3000-5500
frame range, never empties.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants