Skip to content

Match sender report statistics to the sender SSRC - #500

Open
Awuqing wants to merge 1 commit into
pion:mainfrom
Awuqing:fix/stats-sender-report-ownership
Open

Awuqing wants to merge 1 commit into
pion:mainfrom
Awuqing:fix/stats-sender-report-ownership

Conversation

@Awuqing

@Awuqing Awuqing commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Summary

A Sender Report can contain reception report blocks for other SSRCs. DestinationSSRC includes those block SSRCs, so using it to identify the SR sender also assigns the sender's counters and NTP timestamp to unrelated streams. On the outgoing path it records that SR in another stream's RTT history.

Match the SR's own SSRC before updating remote sender statistics or retaining a local SR for RTT matching. Continue processing embedded reception reports for their respective SSRCs.

The regressions cover separate local and remote streams, a valid zero-counter SR, preserving another sender's statistics, and rejecting an RTT sample that refers to another stream's SR. Embedded reception reports still update loss statistics.

Testing

  • Both new regressions fail against interceptor main 3084336 and pass with the patch.
  • GOWORK=off go test -race ./pkg/stats -count=3 passed.
  • GOWORK=off golangci-lint run ./... passed with 0 issues (2.10.1).
  • An external WebRTC next b45146ec fixture passed three race runs over bidirectional Opus and VP8 connections using real ICE/DTLS/SRTP/SRTCP. It confirms that an SR's sender counters do not appear under the local SSRC named in its reception block.

The external fixture also exposes a separate existing double-counting issue when the same decrypted SR is read from both destination streams. This patch fixes SSRC ownership; it does not change SRTCP fan-out or interceptor reader routing.

@codecov

codecov Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.76%. Comparing base (3084336) to head (0af5a65).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #500      +/-   ##
==========================================
+ Coverage   86.71%   86.76%   +0.05%     
==========================================
  Files          91       91              
  Lines        4154     4155       +1     
==========================================
+ Hits         3602     3605       +3     
+ Misses        552      550       -2     
Flag Coverage Δ
go 86.76% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Awuqing
Awuqing marked this pull request as ready for review October 30, 2026 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant