update server
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m34s
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m34s
This commit is contained in:
19
room.go
19
room.go
@@ -13,29 +13,14 @@ func NewRoom() *Room {
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Room) AddPeer(p *Peer) {
|
||||
func (r *Room) Add(p *Peer) {
|
||||
r.mu.Lock()
|
||||
defer r.mu.Unlock()
|
||||
|
||||
r.peers[p.ID] = p
|
||||
p.Room = r
|
||||
}
|
||||
|
||||
func (r *Room) RemovePeer(id string) {
|
||||
func (r *Room) Remove(id string) {
|
||||
r.mu.Lock()
|
||||
defer r.mu.Unlock()
|
||||
|
||||
delete(r.peers, id)
|
||||
}
|
||||
|
||||
func (r *Room) ForwardTrack(from *Peer, track *Track) {
|
||||
r.mu.Lock()
|
||||
defer r.mu.Unlock()
|
||||
|
||||
for _, peer := range r.peers {
|
||||
if peer.ID == from.ID {
|
||||
continue
|
||||
}
|
||||
peer.AddTrack(track)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user