Skip to content

e2e: verify inbound + remote-outbound getStats against real browser media#43

Merged
nus merged 1 commit into
mainfrom
e2e-getstats-chrome
Jun 8, 2026
Merged

e2e: verify inbound + remote-outbound getStats against real browser media#43
nus merged 1 commit into
mainfrom
e2e-getstats-chrome

Conversation

@nus

@nus nus commented Jun 8, 2026

Copy link
Copy Markdown
Owner

Adds live-browser e2e validation for the receive-side getStats fields shipped in #40 — which were only covered by a loopback unit test (zero jitter, synthetic SR, no loss).

Change

Extend the Scenario 2 media-receiver helper (media_receiver_helper.dart) to poll getStats() once a track is flowing and assert:

  • inbound-rtp: packetsReceived>0, jitter>=0 (real interarrival jitter), kind, and a resolvable codecId;
  • remote-outbound-rtp: present and linked to the inbound entry via localId, with reportsReceived>0 and a non-null remoteTimestamp.

packetsSent is only required non-negative, not positive — it's the SR's sender packet count, which is browser/timing-dependent (Firefox's first SR reports 0, Chrome ~120). Running the Firefox e2e caught this.

Validation (real browsers)

  • Chrome: jitter≈0.0012s, packetsSent=122
  • Firefox: early SR packetsSent=0 (handled)
  • Under 5% loss: packets=119 lost=7 — real packetsLost measured

This exercises #40's jitter and loss computation under conditions the loopback test can't reproduce.

Notes (from /simplify)

  • Find-by-ssrc loops collapsed to deterministic report['inbound-rtp-$ssrc'] / report['remote-outbound-rtp-$ssrc'] lookups.
  • Failure exit codes simplified to non-zero (the test reads stderr); stale file-header doc fixed.

Test-only change (no lib edits). dart analyze clean; 22 e2e pass across Chrome + Firefox.

🤖 Generated with Claude Code

…edia

Scenario 2 only asserted onTrack — the receive-side getStats fields added
in #40 (inbound jitter/packetsLost/kind/codecId, and the SR-derived
remote-outbound-rtp) were never checked against a real sender.

Extend the media-receiver helper to poll getStats once a track is flowing
and assert:
- inbound-rtp: packetsReceived>0, jitter>=0 (real interarrival jitter),
  kind, and a resolvable codecId;
- remote-outbound-rtp: present and linked to the inbound entry via
  localId, with reportsReceived>0 and a non-null remoteTimestamp.

packetsSent is only required non-negative, not positive: it's the SR's
sender packet count, which is browser/timing-dependent (Firefox's first SR
reports 0, Chrome ~120) — caught by running the Firefox e2e too.

Validated against both browsers, including under 5% loss where the helper
observed real packetsLost: e.g. Chrome jitter≈0.0012s / packetsSent=122,
and a lossy run "packets=119 lost=7". Confirms #40's jitter and loss
computation against conditions the loopback unit test can't reproduce.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@nus nus merged commit 27d9845 into main Jun 8, 2026
29 of 30 checks passed
@nus nus deleted the e2e-getstats-chrome branch June 8, 2026 18:30
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