Skip to content

fix: test segments and replays on a clock of their own - #582

Merged
devopvoid merged 3 commits into
mainfrom
fix/segment-tests-short-last-segment
Nov 10, 2026
Merged

devopvoid merged 3 commits into
mainfrom
fix/segment-tests-short-last-segment

Conversation

@devopvoid

@devopvoid devopvoid commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

The segment and replay tests recorded a live call for a few seconds and checked what came of it, which depended on how fast the machine ran: every slow runner found a new way to fail, and the loose checks this needed missed real bugs.

They now feed the recorder encoded frames through a test-only webrtc-java function table (JNI_FakeMedia), with a clock they set, and wait for the writer after every step through a new package-private sync(). Where each segment and replay begins and ends then follows from the frames alone, and is checked to the frame, including late key frames, rotation without a key frame, a second video track draining into the previous segment, a track that joins later, and a last segment that holds only its key frame. One test of each kind still records a real call, checking only what holds at any speed.

This turned up a bug in the replay buffer: it kept asking for a key frame until one came, and the request held back by the interval between requests went out a second later, bringing about one extra key frame for every two it asked for. A key frame that arrives now answers the pending request, as it already does for segments.

Stopped right after a segment began with a key frame, the recorder
closes it before any audio went in, which the segment tests that stop at
an arbitrary moment did not allow for.
The buffer asked for a key frame on every round until one came, and the
request held back by the interval between requests went out a second
later, bringing a key frame the buffer did not need yet: about one more
for every two it asked for.
…heir own

The tests recorded a live call for a few seconds and checked what came of
it, which depended on how fast the machine ran: each slow runner found a
new way to fail, and the loose checks this needed missed real bugs.

They now feed the recorder encoded frames through a webrtc-java function
table of their own, with a clock they set, and wait for the writer after
every step. Where each segment and replay begins and ends then follows
from the frames alone, and is checked to the frame. One test of each kind
still records a real call, checking only what holds at any speed.
@devopvoid devopvoid changed the title fix: let the last segment of a recording miss its audio fix: test segments and replays on a clock of their own Nov 10, 2026
@devopvoid
devopvoid merged commit b62734f into main Nov 10, 2026
23 checks passed
@devopvoid
devopvoid deleted the fix/segment-tests-short-last-segment branch November 10, 2026 19:24
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.

1 participant