handles RTC join

This commit is contained in:
David Zhao
2020-10-31 00:09:46 -07:00
parent 36dd195ca3
commit 54b59f00e2
6 changed files with 170 additions and 42 deletions
+3 -2
View File
@@ -28,7 +28,7 @@ type WebRTCPeer struct {
// OnOffer - offer is ready for remote peer
OnOffer func(webrtc.SessionDescription)
// OnIceCandidate - ice candidate discovered for local peer
OnICECandidate func(c *webrtc.ICECandidate)
OnICECandidate func(c *webrtc.ICECandidateInit)
OnClose func(*WebRTCPeer)
}
@@ -76,7 +76,8 @@ func NewWebRTCPeer(id string, me *MediaEngine, conf WebRTCConfig) (*WebRTCPeer,
return
}
if peer.OnICECandidate != nil {
peer.OnICECandidate(c)
ci := c.ToJSON()
peer.OnICECandidate(&ci)
}
})
+2
View File
@@ -52,6 +52,8 @@ func (r *Room) ToRoomInfo(node *livekit.Node) *livekit.RoomInfo {
}
func (r *Room) Join(peerId string, token string, sdp string) (peer *WebRTCPeer, err error) {
// TODO: check token and reject
r.lock.Lock()
defer r.lock.Unlock()