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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
p.pendingTracksLock.Lock()
|
ti := p.addPendingTrack(req)
|
||||||
ti := p.addPendingTrackLocked(req)
|
|
||||||
p.pendingTracksLock.Unlock()
|
|
||||||
if ti == nil {
|
if ti == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -2852,7 +2850,10 @@ func (p *ParticipantImpl) onSubscribedAudioCodecChange(
|
|||||||
return p.sendSubscribedAudioCodecUpdate(subscribedAudioCodecUpdate)
|
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 != "" {
|
if req.Sid != "" {
|
||||||
track := p.GetPublishedTrack(livekit.TrackID(req.Sid))
|
track := p.GetPublishedTrack(livekit.TrackID(req.Sid))
|
||||||
if track == nil {
|
if track == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user