participant key (#106)
* participant key * update fake router * WriteRTCMessage * move sink closing * unused code
This commit is contained in:
@@ -29,9 +29,6 @@ type RedisRouter struct {
|
||||
ctx context.Context
|
||||
isStarted utils.AtomicFlag
|
||||
|
||||
// map of connectionId => SignalNodeSink
|
||||
signalSinks map[string]*SignalNodeSink
|
||||
|
||||
pubsub *redis.PubSub
|
||||
cancel func()
|
||||
}
|
||||
@@ -40,7 +37,6 @@ func NewRedisRouter(currentNode LocalNode, rc *redis.Client) *RedisRouter {
|
||||
rr := &RedisRouter{
|
||||
LocalRouter: *NewLocalRouter(currentNode),
|
||||
rc: rc,
|
||||
signalSinks: make(map[string]*SignalNodeSink),
|
||||
}
|
||||
rr.ctx, rr.cancel = context.WithCancel(context.Background())
|
||||
return rr
|
||||
@@ -139,7 +135,7 @@ func (r *RedisRouter) StartParticipantSignal(ctx context.Context, roomName strin
|
||||
|
||||
// create a new connection id
|
||||
connectionId = utils.NewGuid("CO_")
|
||||
pKey := ParticipantKey(roomName, pi.Identity)
|
||||
pKey := participantKey(roomName, pi.Identity)
|
||||
|
||||
// map signal & rtc nodes
|
||||
if err = r.setParticipantSignalNode(connectionId, r.currentNode.Id); err != nil {
|
||||
@@ -171,14 +167,15 @@ func (r *RedisRouter) StartParticipantSignal(ctx context.Context, roomName strin
|
||||
return connectionId, sink, resChan, nil
|
||||
}
|
||||
|
||||
func (r *RedisRouter) CreateRTCSink(ctx context.Context, roomName, identity string) (MessageSink, error) {
|
||||
pkey := ParticipantKey(roomName, identity)
|
||||
func (r *RedisRouter) WriteRTCMessage(ctx context.Context, roomName, identity string, msg *livekit.RTCNodeMessage) error {
|
||||
pkey := participantKey(roomName, identity)
|
||||
rtcNode, err := r.getParticipantRTCNode(pkey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return err
|
||||
}
|
||||
|
||||
return NewRTCNodeSink(r.rc, rtcNode, pkey), nil
|
||||
rtcSink := NewRTCNodeSink(r.rc, rtcNode, pkey)
|
||||
return r.writeRTCMessage(roomName, identity, msg, rtcSink)
|
||||
}
|
||||
|
||||
func (r *RedisRouter) startParticipantRTC(ss *livekit.StartSession, participantKey string) error {
|
||||
|
||||
Reference in New Issue
Block a user