ID -> SID

This commit is contained in:
David Zhao
2020-12-04 23:04:24 -08:00
parent 64b427a388
commit c401a6fdab
7 changed files with 72 additions and 69 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ func (m *RoomManager) CreateRoom(req *livekit.CreateRoomRequest) (r *Room, err e
}
m.roomLock.Lock()
defer m.roomLock.Unlock()
m.rooms[r.Id] = r
m.rooms[r.Sid] = r
return
}
+1 -1
View File
@@ -118,7 +118,7 @@ func (p *Participant) State() livekit.ParticipantInfo_State {
func (p *Participant) ToProto() *livekit.ParticipantInfo {
info := &livekit.ParticipantInfo{
Id: p.id,
Sid: p.id,
Name: p.name,
State: p.state,
}
+2
View File
@@ -112,6 +112,8 @@ func (r *Receiver) rtpWorker() {
for {
pkt, err := r.track.ReadRTP()
if err == io.EOF {
// this indicates the track is done on the server side
// we should remove the track
r.Close()
return
}
+3 -3
View File
@@ -29,7 +29,7 @@ func NewRoomForRequest(req *livekit.CreateRoomRequest, config *WebRTCConfig) (*R
return &Room{
Room: livekit.Room{
Id: utils.NewGuid(utils.RoomPrefix),
Sid: utils.NewGuid(utils.RoomPrefix),
EmptyTimeout: req.EmptyTimeout,
MaxParticipants: req.MaxParticipants,
CreationTime: time.Now().Unix(),
@@ -49,7 +49,7 @@ func (r *Room) GetParticipant(id string) *Participant {
func (r *Room) ToRoomInfo(node *livekit.Node) *livekit.RoomInfo {
return &livekit.RoomInfo{
Id: r.Id,
Sid: r.Sid,
NodeIp: node.Ip,
CreationTime: r.CreationTime,
Token: r.Token,
@@ -72,7 +72,7 @@ func (r *Room) Join(participant *Participant) error {
log.Infow("new participant joined",
"id", participant.ID(),
"name", participant.Name(),
"roomId", r.Id)
"roomId", r.Sid)
// subscribe participant to existing tracks
for _, p := range r.participants {