tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit fa9ec9430a3b2bc15f88a650008698a497f8d3f5
parent 10ecba2e5c431954de17b8c802a81b05faaaa721
Author: Nico Grunbaum <na-g@nostrum.com>
Date:   Tue,  7 Oct 2025 21:18:51 +0000

Bug 1981005 - store an SSRC only once in JsepTrack;r=dbaker,bwc

Differential Revision: https://phabricator.services.mozilla.com/D266285

Diffstat:
Mdom/media/webrtc/jsep/JsepTrack.cpp | 9+++++++--
Mdom/media/webrtc/jsep/JsepTrack.h | 1+
2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/dom/media/webrtc/jsep/JsepTrack.cpp b/dom/media/webrtc/jsep/JsepTrack.cpp @@ -155,11 +155,16 @@ void JsepTrack::RecvTrackSetRemote(const Sdp& aSdp, // We do this whether or not the track is active SetCNAME(helper.GetCNAME(aMsection)); mSsrcs.clear(); + // Storage of mSsrcs and mSsrcToRtxSsrc could be improved, see Bug 1990364 + // Each `a=ssrc ssrc-attr:value` line can contain the same SSRC. We should + // only add unique SSRCs to mSsrcs. + std::set<uint32_t> ssrcsSet; if (aMsection.GetAttributeList().HasAttribute(SdpAttribute::kSsrcAttribute)) { - for (const auto& ssrcAttr : aMsection.GetAttributeList().GetSsrc().mSsrcs) { - mSsrcs.push_back(ssrcAttr.ssrc); + for (const auto& s : aMsection.GetAttributeList().GetSsrc().mSsrcs) { + ssrcsSet.insert(s.ssrc); } } + mSsrcs.assign(ssrcsSet.begin(), ssrcsSet.end()); // Use FID ssrc-group to associate rtx ssrcs with "regular" ssrcs. Despite // not being part of RFC 4588, this is how rtx is negotiated by libwebrtc diff --git a/dom/media/webrtc/jsep/JsepTrack.h b/dom/media/webrtc/jsep/JsepTrack.h @@ -316,6 +316,7 @@ class JsepTrack { // negotiated rids. std::vector<std::string> mRids; UniquePtr<JsepTrackNegotiatedDetails> mNegotiatedDetails; + // Storage of mSsrcs and mSsrcToRtxSsrc could be improved, see Bug 1990364 std::vector<uint32_t> mSsrcs; std::map<uint32_t, uint32_t> mSsrcToRtxSsrc; bool mActive;