sender: add LookupNetStatsBySSRC for senders added outside AddVideoTrack - #165
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #165 +/- ##
==========================================
+ Coverage 46.63% 47.27% +0.63%
==========================================
Files 18 18
Lines 1829 1851 +22
==========================================
+ Hits 853 875 +22
Misses 907 907
Partials 69 69
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
RTCSender's existing GetTrackStats(trackID) walks s.tracks, which holds only entries created through AddVideoTrack. Consumers that add senders directly to the underlying PeerConnection (e.g. via pc.AddTrack for pre-encoded sample tracks published alongside the bwe-test-managed video tracks) currently have no way to read their pion stats-interceptor counters: the getter is private, and pion's own pc.GetStats() does not emit OutboundRTPStreamStats in this path. Expose a small by-SSRC variant that returns just the network-side fields (no pipeline / encoder counters, which don't apply to externally-added senders). RTT-bearing fields stay zero until an RTCP RR arrives for the SSRC, matching GetTrackStats' contract. No behavior change for existing callers. Co-Authored-By: Seung Yang <syang@nuro.ai> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
lkang-nuro
force-pushed
the
lkang/lookup-netstats-by-ssrc
branch
from
July 1, 2026 03:41
cd7fa51 to
c502d75
Compare
hanguyen-nuro
approved these changes
Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RTCSender.GetTrackStats(trackID)walkss.tracks, which only holds entries created throughAddVideoTrack. Consumers that add senders directly to the underlyingPeerConnection(e.g. viapc.AddTrackfor pre-encoded sample tracks published alongside bwe-test-managed video tracks) currently have no way to read their pion stats-interceptor counters — the getter is private, and pion's ownpc.GetStats()does not emitOutboundRTPStreamStatsin this code path.This adds a small by-SSRC variant,
LookupNetStatsBySSRC, returning just the network-side fields via a newSenderNetStatstype (no pipeline/encoder counters, which don't apply to externally-added senders). RTT-bearing fields stay zero until an RTCP RR arrives for the SSRC, matchingGetTrackStats' contract.No behavior change for existing callers.
Changes
SenderNetStatstype: per-SSRC network-side subset ofTrackStats.RTCSender.LookupNetStatsBySSRC(ssrc): returns nil when the stats interceptor is unbound or has no entry for the SSRC.Testing
go build ./...,go vet ./sender/clean.senderpackage test suite passes.🤖 Generated with Claude Code