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
Possibly racy replaceTrack() #1728
Comments
Note: I'm assuming that removeTrack() which changes direction would cause the "check if negotiation is needed" to reject the promise. Question: Do we need to add a clause for (direction != currentDirection) or say that "if direction is recvonly or inactive, reject the promise"? |
Are you imagining
I don't think the "determine if negotiation is needed" here is intended to take direction into account. It should be legal to call But that's rather confusing, since section 4.7 defines what "negotiation needed" means, which includes direction. Given all the recent discussion, I think this step needs to be worded differently/expanded upon. |
Does that mean it should be valid to replaceTrack() after removeTrack(sender)? I suppose removeTrack() is just a sync way of doing If so these tests are wrong to assert that the promise is rejected? |
Possibly, depending on the result of this discussion. Sorry for not thinking about this enough when reviewing the test... |
I can agree to that having both sync (add/removeTrack) and async methods (replaceTrack) operating on the same thing is not very clean. However, perhaps we can live with it?
is not what you should do (adding |
Given that |
Roughly speaking, replaceTrack() does this:
I think there's two issues with determining if negotiation is needed in parallel and then queuing a task to complete the operation:
I can see this code snippet resolving or rejecting the
promise
depending on a race. Do we care?The text was updated successfully, but these errors were encountered: