Skip to content

Commit

Permalink
Create data media sections
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 committed Jul 28, 2020
1 parent 940d6aa commit 4aed41c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions peerconnection.go
Original file line number Diff line number Diff line change
Expand Up @@ -1856,7 +1856,10 @@ 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 +1868,10 @@ 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 4aed41c

Please # to comment.