mirror of
https://github.com/livekit/livekit.git
synced 2026-08-24 20:29:44 +00:00
Move lock to addPendingTrack function. (#4617)
Wrapping the function with the lock outside in the only invocation was not needed.
This commit is contained in:
@@ -1340,9 +1340,7 @@ func (p *ParticipantImpl) AddTrack(req *livekit.AddTrackRequest) {
|
||||
return
|
||||
}
|
||||
|
||||
p.pendingTracksLock.Lock()
|
||||
ti := p.addPendingTrackLocked(req)
|
||||
p.pendingTracksLock.Unlock()
|
||||
ti := p.addPendingTrack(req)
|
||||
if ti == nil {
|
||||
return
|
||||
}
|
||||
@@ -2852,7 +2850,10 @@ func (p *ParticipantImpl) onSubscribedAudioCodecChange(
|
||||
return p.sendSubscribedAudioCodecUpdate(subscribedAudioCodecUpdate)
|
||||
}
|
||||
|
||||
func (p *ParticipantImpl) addPendingTrackLocked(req *livekit.AddTrackRequest) *livekit.TrackInfo {
|
||||
func (p *ParticipantImpl) addPendingTrack(req *livekit.AddTrackRequest) *livekit.TrackInfo {
|
||||
p.pendingTracksLock.Lock()
|
||||
defer p.pendingTracksLock.Unlock()
|
||||
|
||||
if req.Sid != "" {
|
||||
track := p.GetPublishedTrack(livekit.TrackID(req.Sid))
|
||||
if track == nil {
|
||||
|
||||
Reference in New Issue
Block a user