Skip to content

Revert "Enable browser G2G latency measurement by default" - #194

Merged
AdirAmsalem merged 1 commit into
mainfrom
revert-191-rene/sdk-g2g-default
Aug 5, 2026
Merged

Revert "Enable browser G2G latency measurement by default"#194
AdirAmsalem merged 1 commit into
mainfrom
revert-191-rene/sdk-g2g-default

Conversation

@AdirAmsalem

@AdirAmsalem AdirAmsalem commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Reverts #191


Note

Medium Risk
Changes default realtime wire format and viewer compatibility semantics; publishers on the reverted behavior no longer send frame trailers unless debugQuality is set, which fixes subscriber breakage but is a behavioral/API contract shift integrators should verify.

Overview
Reverts default-on browser glass-to-glass (G2G) measurement so frame metadata and packet trailers are only used when publishers explicitly opt in.

Publishers must pass connect({ debugQuality: true }) to enable LiveKit frame-metadata workers, advertise frame_timing to the server, and populate g2gMs / ttffMs on stats and connection quality. Without that flag, sessions behave like standard realtime connects with no frame trailers. Worker creation failures no longer abort the media connection—they log and continue without latency metrics. Deep connectivity preflight still turns on debugQuality for its short probe session.

Viewers no longer read frame_timing from subscribe tokens or spin up strip workers; subscribe uses a plain LiveKit room, so mixed SDK versions and React Native subscribers are not blocked or left with a black video when an upgraded publisher would have advertised timing.

Docs and the SDK demo page describe G2G as opt-in diagnostic measurement and add a checkbox wired to debugQuality. React Native rejects debugQuality like other browser-only features. G2G playout timestamp handling is corrected to treat LiveKit timeSyncUpdate timestamps as relative to performance.timeOrigin.

Reviewed by Cursor Bugbot for commit 2de0f09. Bugbot is set up for automated code reviews on this repo. Configure here.

@AdirAmsalem
AdirAmsalem merged commit 73e608e into main Aug 5, 2026
3 checks passed
@AdirAmsalem
AdirAmsalem deleted the revert-191-rene/sdk-g2g-default branch August 5, 2026 10:31

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 2de0f09. Configure here.

// `timestamp` is the sync-source playout time as a DOMHighResTimeStamp
// (relative to performance.timeOrigin); convert to epoch ms so it lines up
// with the publisher's epoch `userTimestamp` and the epoch `startMs`.
if (frameMetadata) tracker.recordFrame(frameMetadata.userTimestamp, performance.timeOrigin + timestamp);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broken G2G timestamp conversion

High Severity

timeSyncUpdate already carries an absolute wall-clock timestamp from RTCRtpContributingSource (performance.timeOrigin + performance.now()). Adding performance.timeOrigin again produces implausible latencies that recordFrame drops, so opted-in glass-to-glass metrics stay empty.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2de0f09. Configure here.

frameMetadataWorker = undefined;
throw error;
}
room = new LiveKitRoom(REALTIME_CONFIG.livekit.roomOptions);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Viewers break with debugQuality

High Severity

debugQuality still advertises frame_timing, so the server appends packet trailers to room frames, but subscribe no longer builds a strip worker or encodes frame_timing in tokens. Viewers of those sessions decode nothing and see a black video with no error.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2de0f09. Configure here.

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