Skip to content

Commit c7f0445

Browse files
authored
fix race in audio track subscription (#938)
1 parent 2f7e92b commit c7f0445

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pkg/pipeline/source/sdk.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,11 +471,10 @@ func (s *SDKSource) onTrackSubscribed(track *webrtc.TrackRemote, pub *lksdk.Remo
471471

472472
s.mu.Lock()
473473
s.writers[ts.TrackID] = writer
474-
s.mu.Unlock()
475-
476474
if !s.initialized.IsBroken() {
477475
s.AudioTracks = append(s.AudioTracks, ts)
478476
}
477+
s.mu.Unlock()
479478

480479
case types.MimeTypeH264, types.MimeTypeVP8, types.MimeTypeVP9:
481480
s.VideoEnabled = true

0 commit comments

Comments
 (0)