add iceTrickle for restart from config.

This commit is contained in:
Miroslav Šedivý 2021-06-27 22:05:37 +02:00
parent 09fdea1b11
commit 7df642a346
4 changed files with 7 additions and 5 deletions

View File

@ -9,7 +9,7 @@ type ICEServer struct {
}
type WebRTCPeer interface {
CreateOffer(ICETrickle bool, ICERestart bool) (*webrtc.SessionDescription, error)
CreateOffer(ICERestart bool) (*webrtc.SessionDescription, error)
SignalAnswer(sdp string) error
SignalCandidate(candidate webrtc.ICECandidateInit) error

View File

@ -239,6 +239,7 @@ func (manager *WebRTCManagerCtx) CreatePeer(session types.Session, videoID strin
connection: connection,
changeVideo: changeVideo,
dataChannel: dataChannel,
iceTrickle: manager.config.ICETrickle,
}
cursorImage := func(entry *cursor.ImageEntry) {
@ -343,7 +344,7 @@ func (manager *WebRTCManagerCtx) CreatePeer(session types.Session, videoID strin
}()
session.SetWebRTCPeer(peer)
return peer.CreateOffer(manager.config.ICETrickle, false)
return peer.CreateOffer(false)
}
func (manager *WebRTCManagerCtx) mediaEngine(videoID string) (*webrtc.MediaEngine, error) {

View File

@ -15,9 +15,10 @@ type WebRTCPeerCtx struct {
connection *webrtc.PeerConnection
dataChannel *webrtc.DataChannel
changeVideo func(videoID string) error
iceTrickle bool
}
func (peer *WebRTCPeerCtx) CreateOffer(ICETrickle bool, ICERestart bool) (*webrtc.SessionDescription, error) {
func (peer *WebRTCPeerCtx) CreateOffer(ICERestart bool) (*webrtc.SessionDescription, error) {
// offer timeout
go func() {
time.Sleep(offerTimeout)
@ -41,7 +42,7 @@ func (peer *WebRTCPeerCtx) CreateOffer(ICETrickle bool, ICERestart bool) (*webrt
return nil, err
}
if !ICETrickle {
if !peer.iceTrickle {
// Create channel that is blocked until ICE Gathering is complete
gatherComplete := webrtc.GatheringCompletePromise(peer.connection)

View File

@ -39,7 +39,7 @@ func (h *MessageHandlerCtx) signalRestart(session types.Session) error {
return nil
}
offer, err := peer.CreateOffer(true, true)
offer, err := peer.CreateOffer(true)
if err != nil {
return err
}