fix
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m35s
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m35s
This commit is contained in:
11
peer.go
11
peer.go
@@ -63,13 +63,8 @@ func NewPeer(conn *websocket.Conn, room *Room) *Peer {
|
||||
pc.OnTrack(func(remote *webrtc.TrackRemote, _ *webrtc.RTPReceiver) {
|
||||
local := NewTrack(remote)
|
||||
|
||||
p.Room.mu.Lock()
|
||||
for _, other := range p.Room.peers {
|
||||
if other.ID != p.ID {
|
||||
other.AddTrack(local)
|
||||
}
|
||||
}
|
||||
p.Room.mu.Unlock()
|
||||
// 🔥 регистрируем трек в комнате
|
||||
p.Room.AddTrack(p, local)
|
||||
|
||||
for {
|
||||
pkt, _, err := remote.ReadRTP()
|
||||
@@ -95,7 +90,7 @@ func (p *Peer) AddTrack(track *Track) {
|
||||
func (p *Peer) ReadLoop() {
|
||||
defer func() {
|
||||
p.Conn.Close()
|
||||
p.Room.Remove(p.ID)
|
||||
p.Room.RemovePeer(p.ID)
|
||||
p.PC.Close()
|
||||
}()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user