Skip to content

Commit

Permalink
Create data media sections for each requested
Browse files Browse the repository at this point in the history
Don't create data media sections unless we're asked to

Fixes #1349
  • Loading branch information
wdouglass authored and Sean-Der committed Jul 29, 2020
1 parent 940d6aa commit abd6a35
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions peerconnection.go
Original file line number Diff line number Diff line change
Expand Up @@ -1856,7 +1856,9 @@ func (pc *PeerConnection) generateUnmatchedSDP(useIdentity bool) (*sdp.SessionDe
if len(audio) > 0 {
mediaSections = append(mediaSections, mediaSection{id: "audio", transceivers: audio})
}
mediaSections = append(mediaSections, mediaSection{id: "data", data: true})
for i := uint32(0); i < pc.sctpTransport.dataChannelsRequested; i++ {
mediaSections = append(mediaSections, mediaSection{id: pc.sctpTransport.dataChannels[i].label, data: true})
}
} else {
for _, t := range pc.GetTransceivers() {
if t.Sender() != nil {
Expand All @@ -1865,7 +1867,9 @@ func (pc *PeerConnection) generateUnmatchedSDP(useIdentity bool) (*sdp.SessionDe
mediaSections = append(mediaSections, mediaSection{id: t.Mid(), transceivers: []*RTPTransceiver{t}})
}

mediaSections = append(mediaSections, mediaSection{id: strconv.Itoa(len(mediaSections)), data: true})
for i := uint32(0); i < pc.sctpTransport.dataChannelsRequested; i++ {
mediaSections = append(mediaSections, mediaSection{id: strconv.Itoa(len(mediaSections)), data: true})
}
}

dtlsFingerprints, err := pc.configuration.Certificates[0].GetFingerprints()
Expand Down

0 comments on commit abd6a35

Please sign in to comment.