Skip to content

Fix replay audio timing reliability - #373

Merged
rgarcia merged 3 commits into
mainfrom
hypeship/fix-replay-audio-timestamps
Sep 8, 2026
Merged

Fix replay audio timing reliability#373
rgarcia merged 3 commits into
mainfrom
hypeship/fix-replay-audio-timestamps

Conversation

@rgarcia

@rgarcia rgarcia commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Synchronize the PulseAudio input to x11grab with -isync 0. Both use wall-clock timestamps, but ffmpeg otherwise subtracts each input start independently, pulling later-opened audio forward and ending it early in the replay timeline.
  • Bind the Playwright daemon socket before importing the selected browser engine; import esbuild only when transforming code. Previously all three packages initialized before listening. Keep the existing 5-second socket deadline.
  • Explicitly apply and verify the fixture's intended 1280×720 display through the API. WIDTH/HEIGHT alone do not configure headful Xorg; CI was recording its 3840×2160 fallback instead.
  • Retain the real-browser audio MP4, packet/stream timestamps and isolated service logs in e2e CI. Log measured durations and lifecycle timings; run the normal parallel e2e suite uncached.

The existing 2-second audio-duration assertion, audible-tone check, recording-before-first-Playwright ordering and e2e concurrency are unchanged. No audio padding, test retries or production deployment.

Regression evidence

  • New ffmpeg regression models devices opening at timestamps 10 and 13 and both finishing at 16, retaining production encode/mux arguments. Pre-fix: video ends at 6.021387s, audio at 3.029333s. Fixed: 6.000000s / 6.008000s, before and after remux. Decoding still yields only about 3 seconds of audio, not padded silence.
  • New daemon regression holds dependency evaluation until explicitly released. Pre-fix the socket remains absent; fixed it accepts connections while the engine import is blocked, then connects after release. This proves the startup dependency, not CPU contention in historical CI failures.

Validation

  • Local make test-unit (vet and Go race tests) and make test-runtime pass. An earlier baseline unit run hit an unrelated devtoolsproxy Chromium TempDir cleanup race; the complete rerun passed.
  • Full local parallel real-container suite passes with both updated headful/headless images and verified 1280×720 capture: video 10.100000s, audio 9.971750s, gap 0.128250s, no non-monotonic DTS warnings.
  • The first candidate passed three independent CI jobs, but one had a 1.795333s gap, 28 non-monotonic audio DTS warnings and ffmpeg final speed 0.858x while encoding unintended 4K video. Validation was stopped proactively rather than accepting a near-threshold result. Correcting fixture setup reduces raw frame bandwidth from 2,654,208 to 294,912 kbit/s (9×), without changing suite parallelism or production recording settings. The local corrected full-suite run sustained 1.04x with no DTS warnings.
  • Final commit 8897c2a881ce2a08a5faac4554e305399d5f972e passed ten consecutive independent full parallel e2e CI jobs. All normal CI checks and latest-commit BugBot are green; BugBot reported no issues. No code changed during validation.

Ten-run CI evidence

Workflow server-test.yaml, run 34002849643, attempts 1–10. Each is a distinct job execution of the full normal parallel suite with -race -count=1; the target ran exactly once without skips or retries. Source SHA 8897c2a881ce2a08a5faac4554e305399d5f972e; tested merge SHA cd4a15bdaa7dcbbb649e6ca4c8fb06e3673b26b2 throughout.

Attempt Independent e2e job Video / format (s) Audio (s) Outcome
1 101404737767 9.400000 9.269750 PASS
2 101405310678 8.900000 8.830000 PASS
3 101405973470 9.800000 9.664396 PASS
4 101406546784 9.600000 9.526396 PASS
5 101407211513 9.400000 9.185375 PASS
6 101407785465 9.600000 9.559938 PASS
7 101408374366 10.500000 10.433687 PASS
8 101408938930 9.900000 9.759292 PASS
9 101409567192 9.100000 8.994167 PASS
10 101410190324 9.300000 9.162354 PASS

Largest gap: 0.214625s against the unchanged 2s assertion. Each run has a replay-audio-34002849643-<attempt> artifact containing the MP4, stream/packet probe and service logs. Every video is verified as 1280×720. Minor Pulse timestamp warnings remain visible in those logs; no universal overloaded-4K recording guarantee is claimed.

@rgarcia
rgarcia requested a review from sjmiller609 September 7, 2026 10:57
@rgarcia
rgarcia merged commit 18ac2bf into main Sep 8, 2026
47 checks passed
@rgarcia
rgarcia deleted the hypeship/fix-replay-audio-timestamps branch September 8, 2026 15:21
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