forked from External/mediamtx
webrtc: fix crash when marshaling ICE fragments (#3231)
This commit is contained in:
parent
5a39e07eb7
commit
4354535a94
1 changed files with 3 additions and 0 deletions
|
|
@ -60,6 +60,9 @@ func ICEFragmentMarshal(offer string, candidates []*webrtc.ICECandidateInit) ([]
|
||||||
|
|
||||||
candidatesByMedia := make(map[uint16][]*webrtc.ICECandidateInit)
|
candidatesByMedia := make(map[uint16][]*webrtc.ICECandidateInit)
|
||||||
for _, candidate := range candidates {
|
for _, candidate := range candidates {
|
||||||
|
if candidate.SDPMLineIndex == nil {
|
||||||
|
return nil, fmt.Errorf("sdpMLineIndex is null")
|
||||||
|
}
|
||||||
mid := *candidate.SDPMLineIndex
|
mid := *candidate.SDPMLineIndex
|
||||||
candidatesByMedia[mid] = append(candidatesByMedia[mid], candidate)
|
candidatesByMedia[mid] = append(candidatesByMedia[mid], candidate)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue