sdp交换存在问题

This commit is contained in:
TonyChyi
2022-09-30 12:24:32 +08:00
parent 5c93e698b6
commit acf74153ef
4 changed files with 69 additions and 49 deletions

View File

@@ -77,13 +77,6 @@ func (c *Connection) Regist(offer *webrtc.SessionDescription) (*webrtc.SessionDe
rtc.OnICEConnectionStateChange(func(connectionState webrtc.ICEConnectionState) {
logrus.Debug("connection state has changed: ", connectionState.String())
switch connectionState {
case webrtc.ICEConnectionStateFailed:
fallthrough
case webrtc.ICEConnectionStateClosed:
rtc.Close()
}
})
for _, track := range c.stream.GetTracks() {
@@ -110,14 +103,12 @@ func (c *Connection) Regist(offer *webrtc.SessionDescription) (*webrtc.SessionDe
return nil, err
}
gatherComplete := webrtc.GatheringCompletePromise(rtc)
if err := rtc.SetLocalDescription(answer); err != nil {
return nil, err
}
logrus.Debug("answer set")
<-gatherComplete
<-webrtc.GatheringCompletePromise(rtc)
defer logrus.Debug("regist complete")
return rtc.LocalDescription(), nil