subscribe the right target participant

This commit is contained in:
David Zhao
2020-12-03 22:13:30 -08:00
parent c64ecc4603
commit 04dcdc3772
+4 -4
View File
@@ -119,16 +119,16 @@ func (r *Room) onTrackAdded(peer *Participant, track *Track) {
defer r.lock.RUnlock() defer r.lock.RUnlock()
// subscribe all existing participants to this mediaTrack // subscribe all existing participants to this mediaTrack
for _, p := range r.participants { for _, existingParticipant := range r.participants {
if p == peer { if existingParticipant == peer {
// skip publishing peer // skip publishing peer
continue continue
} }
if err := track.AddSubscriber(peer); err != nil { if err := track.AddSubscriber(existingParticipant); err != nil {
logger.GetLogger().Errorw("could not subscribe to mediaTrack", logger.GetLogger().Errorw("could not subscribe to mediaTrack",
"srcParticipant", peer.ID(), "srcParticipant", peer.ID(),
"mediaTrack", track.id, "mediaTrack", track.id,
"dstParticipant", p.ID()) "dstParticipant", existingParticipant.ID())
} }
} }
} }