mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
add iceTrickle for restart from config.
This commit is contained in:
parent
09fdea1b11
commit
7df642a346
@ -9,7 +9,7 @@ type ICEServer struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type WebRTCPeer interface {
|
type WebRTCPeer interface {
|
||||||
CreateOffer(ICETrickle bool, ICERestart bool) (*webrtc.SessionDescription, error)
|
CreateOffer(ICERestart bool) (*webrtc.SessionDescription, error)
|
||||||
SignalAnswer(sdp string) error
|
SignalAnswer(sdp string) error
|
||||||
SignalCandidate(candidate webrtc.ICECandidateInit) error
|
SignalCandidate(candidate webrtc.ICECandidateInit) error
|
||||||
|
|
||||||
|
@ -239,6 +239,7 @@ func (manager *WebRTCManagerCtx) CreatePeer(session types.Session, videoID strin
|
|||||||
connection: connection,
|
connection: connection,
|
||||||
changeVideo: changeVideo,
|
changeVideo: changeVideo,
|
||||||
dataChannel: dataChannel,
|
dataChannel: dataChannel,
|
||||||
|
iceTrickle: manager.config.ICETrickle,
|
||||||
}
|
}
|
||||||
|
|
||||||
cursorImage := func(entry *cursor.ImageEntry) {
|
cursorImage := func(entry *cursor.ImageEntry) {
|
||||||
@ -343,7 +344,7 @@ func (manager *WebRTCManagerCtx) CreatePeer(session types.Session, videoID strin
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
session.SetWebRTCPeer(peer)
|
session.SetWebRTCPeer(peer)
|
||||||
return peer.CreateOffer(manager.config.ICETrickle, false)
|
return peer.CreateOffer(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (manager *WebRTCManagerCtx) mediaEngine(videoID string) (*webrtc.MediaEngine, error) {
|
func (manager *WebRTCManagerCtx) mediaEngine(videoID string) (*webrtc.MediaEngine, error) {
|
||||||
|
@ -15,9 +15,10 @@ type WebRTCPeerCtx struct {
|
|||||||
connection *webrtc.PeerConnection
|
connection *webrtc.PeerConnection
|
||||||
dataChannel *webrtc.DataChannel
|
dataChannel *webrtc.DataChannel
|
||||||
changeVideo func(videoID string) error
|
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
|
// offer timeout
|
||||||
go func() {
|
go func() {
|
||||||
time.Sleep(offerTimeout)
|
time.Sleep(offerTimeout)
|
||||||
@ -41,7 +42,7 @@ func (peer *WebRTCPeerCtx) CreateOffer(ICETrickle bool, ICERestart bool) (*webrt
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if !ICETrickle {
|
if !peer.iceTrickle {
|
||||||
// Create channel that is blocked until ICE Gathering is complete
|
// Create channel that is blocked until ICE Gathering is complete
|
||||||
gatherComplete := webrtc.GatheringCompletePromise(peer.connection)
|
gatherComplete := webrtc.GatheringCompletePromise(peer.connection)
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ func (h *MessageHandlerCtx) signalRestart(session types.Session) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
offer, err := peer.CreateOffer(true, true)
|
offer, err := peer.CreateOffer(true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user