Skip to content

Commit 4f81641

Browse files
committed
fix: key _simulcast_track_map by SDP MID availability, not RTP MID extension
Use mid.has_value() (SDP a=mid) as the sole condition for building the "mid:rid" composite key in _simulcast_track_map, instead of requiring both has_mid_extension (RTP MID header extension) and mid.has_value(). Previously, if the SDP contained a=mid but the RTP MID extension was not negotiated, the map key was stored as "rid" while MID+RID format headers (mid:<mid>:rid:<rid>:...) expected "mid:rid", causing a lookup mismatch. Update comments in webrtc_stream.h and webrtc_stream.cpp to reflect that the key condition is based on the SDP a=mid identifier, not the RTP MID header extension.
1 parent 084aeba commit 4f81641

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/projects/providers/webrtc/webrtc_stream.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ namespace pvd
271271

272272
if (has_rid_extension)
273273
{
274-
// Key: "mid:rid" when MID extension is present to disambiguate across m= sections
274+
// Key: "mid:rid" when the SDP a=mid identifier is available to disambiguate across m= sections
275275
// that reuse the same RID values; otherwise just "rid".
276276
// RID values are [a-zA-Z0-9\-_]+ and MID tokens contain no ':', so ':' is a safe separator.
277277
//
@@ -280,7 +280,7 @@ namespace pvd
280280
// MID="video0", RID="low" → key = "video0:low"
281281
// no MID, RID="high" → key = "high"
282282
auto mid = answer_media_desc->GetMid();
283-
auto key = (has_mid_extension && mid.has_value())
283+
auto key = mid.has_value()
284284
? (mid.value() + ":" + rid_attr->GetId())
285285
: rid_attr->GetId();
286286
_simulcast_track_map[key] = track->GetId();

src/projects/providers/webrtc/webrtc_stream.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ namespace pvd
132132
std::map<uint32_t, bool> _sent_sequence_header;
133133

134134
// RID to track ID mapping
135-
// Key: "mid:rid" when MID extension is present (disambiguates across m= sections with reused RIDs),
136-
// or just "rid" when MID is unavailable. Each key is unique, so a single track ID per entry suffices.
135+
// Key: "mid:rid" when the SDP a=mid identifier is available (disambiguates across m= sections with reused RIDs),
136+
// or just "rid" when no SDP MID is available. Each key is unique, so a single track ID per entry suffices.
137137
std::map<ov::String, uint32_t> _simulcast_track_map;
138138

139139
ov::String _oven_capabilities;

0 commit comments

Comments
 (0)