Skip to content

Commit 7d85924

Browse files
committed
Fix audio eMOS calculation and display
Summary - **Fix `v1_summary` to extract inline audio inbound tracks from main events** — inbound audio tracks were embedded inline on main stat events but never iterated over, so `compute_emos` was never called for them. Added `build_track_data` helper and loop over inline tracks per snapshot. - **Fix `compute_emos` packet loss fallback** — previously required `remote-outbound-rtp` data (which many browsers don't send) for `packetsSent`. Now falls back to `packetsLost / (packetsLost + packetsReceived)` from local `inbound-rtp` stats when remote data is unavailable. - **Fix `compute_emos` RTT source** — changed RTT lookup from `remote.audio.outbound` (which never carries `roundTripTime`) to `remote.audio.inbound`. - **Fix `compute_emos` one-way delay** — changed `delay = RTT` to `delay = RTT / 2` per E-model specification. - **Fix `compute_emos` guards** — added `bitrate 0` guard before `math.log`, `packets_sent 0` and `total_packets == 0` guards, and fixed operator precedence in auxiliary delay (`0.1 * (delay - 150)`). - **Fix `check_emos_score` shared mutable state** — replaced shared `issue_template` dict with a `make_issue_template()` factory function to prevent cross-participant corruption. - **Fix `check_emos_score` running average** — replaced incorrect `(avg + score) / 2` with Welford's online mean. - **Fix event ordering** — added `ORDER BY created_at ASC, id ASC` to `get_stats_events` and removed `events.reverse()`. - **Add pending track buffer** — per-track events that arrive before their connection's main event are queued and flushed when the snapshot is created. - **Add `@staticmethod` to `get_stats_events`**. Test plan - [x] Verified eMOS scores computed for Chrome and Edge participants across multiple test calls - [x] Verified packet loss fallback produces correct scores when `remote-outbound-rtp` is absent - [x] Verified zero errors in API logs during summary building - [x] Verified `check_emos_score` correctly accumulates per-participant averages
1 parent 34c6f5c commit 7d85924

1 file changed

Lines changed: 179 additions & 141 deletions

File tree

0 commit comments

Comments
 (0)