rework multi-node routing, cleaner design for reconnection

This commit is contained in:
David Zhao
2021-01-30 22:24:08 -08:00
parent 28e73bd109
commit 2cf2c448be
23 changed files with 702 additions and 661 deletions
+10 -2
View File
@@ -75,14 +75,14 @@ func NewPeerConnection(conf *WebRTCConfig) (*webrtc.PeerConnection, error) {
return pc, err
}
func NewParticipant(participantId, identity string, pc types.PeerConnection, rs routing.MessageSink, receiverConfig ReceiverConfig) (*ParticipantImpl, error) {
func NewParticipant(identity string, pc types.PeerConnection, rs routing.MessageSink, receiverConfig ReceiverConfig) (*ParticipantImpl, error) {
// TODO: check to ensure params are valid, id and identity can't be empty
me := &webrtc.MediaEngine{}
me.RegisterDefaultCodecs()
ctx, cancel := context.WithCancel(context.Background())
participant := &ParticipantImpl{
id: participantId,
id: utils.NewGuid(utils.ParticipantPrefix),
identity: identity,
peerConn: pc,
responseSink: rs,
@@ -184,6 +184,14 @@ func (p *ParticipantImpl) ToProto() *livekit.ParticipantInfo {
return info
}
func (p *ParticipantImpl) GetResponseSink() routing.MessageSink {
return p.responseSink
}
func (p *ParticipantImpl) SetResponseSink(sink routing.MessageSink) {
p.responseSink = sink
}
// callbacks for clients
func (p *ParticipantImpl) OnTrackPublished(callback func(types.Participant, types.PublishedTrack)) {
p.onTrackPublished = callback