Skip to content

Commit

Permalink
Ignore explicit SSRCes in RID Simulcast processing
Browse files Browse the repository at this point in the history
If the SRTP Stream hasn't been opened yet we would attempt to process
(and fail) RTP traffic. This change causes us to not even attempt to
read.

No behavior change from this, but will cause less useless logging.
  • Loading branch information
Sean-Der committed Jan 31, 2022
1 parent a97a76f commit 2949e53
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
12 changes: 12 additions & 0 deletions peerconnection.go
Original file line number Diff line number Diff line change
Expand Up @@ -1450,6 +1450,18 @@ func (pc *PeerConnection) handleIncomingSSRC(rtpStream io.Reader, ssrc SSRC) err
return errPeerConnRemoteDescriptionNil
}

// If a SSRC already exists in the RemoteDescription don't perform heuristics upon it
for _, track := range trackDetailsFromSDP(pc.log, remoteDescription.parsed) {
if track.repairSsrc != nil && ssrc == *track.repairSsrc {
return nil
}
for _, trackSsrc := range track.ssrcs {
if ssrc == trackSsrc {
return nil
}
}
}

// If the remote SDP was only one media section the ssrc doesn't have to be explicitly declared
if handled, err := pc.handleUndeclaredSSRC(ssrc, remoteDescription); handled || err != nil {
return err
Expand Down
11 changes: 7 additions & 4 deletions sdp.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type trackDetails struct {
streamID string
id string
ssrcs []SSRC
repairSsrc SSRC
repairSsrc *SSRC
rids []string
}

Expand Down Expand Up @@ -168,9 +168,10 @@ func trackDetailsFromSDP(log logging.LeveledLogger, s *sdp.SessionDescription) (
trackDetails.id = trackID
trackDetails.ssrcs = []SSRC{SSRC(ssrc)}

for repairSsrc, baseSsrc := range rtxRepairFlows {
for r, baseSsrc := range rtxRepairFlows {
if baseSsrc == ssrc {
trackDetails.repairSsrc = SSRC(repairSsrc)
repairSsrc := SSRC(r)
trackDetails.repairSsrc = &repairSsrc
}
}

Expand Down Expand Up @@ -216,7 +217,9 @@ func trackDetailsToRTPReceiveParameters(t *trackDetails) RTPReceiveParameters {
encodings[i].SSRC = t.ssrcs[i]
}

encodings[i].RTX.SSRC = t.repairSsrc
if t.repairSsrc != nil {
encodings[i].RTX.SSRC = *t.repairSsrc
}
}

return RTPReceiveParameters{Encodings: encodings}
Expand Down

0 comments on commit 2949e53

Please sign in to comment.