-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accurate audio track counting #477
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it still possible for a track that's already stopped to call stopCapture
? in the case everything is already at 0 this won't matter, but if if the values are greater than 0 it could cause miscounting.
a more durable approach may be to store sets of the active track ids, instead of counts, and it will prevent miscounts in the case of extra starts or stops for a single track.
(But this looks like it will fix the issue as reported, where we reached -1 before anything got published, so this should be good to merge)
start/stopCapture is guarded by a trackState lock so it should be ok: client-sdk-swift/Sources/LiveKit/Track/Track.swift Lines 225 to 251 in 8f3da0a
But I agree there with more work I can make it more solid. |
@hiroshihorie yeah that's perfect - this should probably work as it is then |
Ok when I look again it's still not race proof stop() could get executed concurrently |
Not sure what can cause trackDidStop to be called unbalanced with trackDidStart but better guard this.Accurate counting of audio tracks instead of counting publish / unpublish.