-
Notifications
You must be signed in to change notification settings - Fork 115
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
Fix broken RTCPeerConnection's operations array to work with promises. #307
Conversation
@ekr @adam-be @pthatcherg can you comment? |
This doesn't seem to me to be an improvement. |
#299 does not contain a complete description. |
I've updated #299 with a better summary. |
<code>setRemoteDescription</code> executing at any given time. If | ||
<code>setLocalDescription</code>, <code>createAnswer</code>, | ||
<code>setRemoteDescription</code> and <code>addIceCandidate</code> | ||
executing at any given time. If |
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.
Mentioning addIceCandidate seems like a good thing.
Btw, here it is in code: _runOperation: function(operation) {
this._throwIfClosed();
let p = (!this._operationsLength)? operation() : this._operations.then(operation);
this._operationsLength++;
let decrement = () => this._operationsLength--;
this._operations = p.then(decrement, decrement);
return p;
}, |
I like the rewrite; it looks more accurate and precise than the current text. |
OK, I've looked into this more deeply and I think it's trying to do 3 different things, 2 of which are good, 1 of which is not good.
To keep the first 2, but not the 3rd, I created https://github.com/w3c/webrtc-pc/pull/314/files. I still think #3 is ugly, and I still don't see what it buys us. As far as I can tell, it's only there to try and address this use case: var senderX = pc.addTrack(trackX); But I don't see how this PR fixes that use case. The fundamental problem with that use case is that addTrack isn't in the queue with the rest of the operations, not that the queue is defined in terms of a queue or a promise chain. |
Yikes, somehow my text got garbled. The three were supposed to be:
|
By the way, I think in this case: var senderX = pc.addTrack(trackX); The answer should be that the offer has the first track but not the second. Previously, you said that the "promise chain" approach would make it be the opposite, where the offer would include both. I think that would be broken. |
It solves #299.
Not so. Compare to #222 to see what was added to solve that use-case.
It solves it by executing operation synchronously when chainLength is
That sounds like another solution rather than a fundamental statement ( |
s/sprint/spring/ |
On Wed, Sep 23, 2015 at 6:36 AM, jan-ivar [email protected] wrote:
I wrote the is PR: #314 to address
But I don't see how this PR fixes that use case.
I still don't see how the behavior of PR 307 is different than PR 314.
|
It actually says: "the old text doesn't return any promises is the problem, or allow the synchronous parts of the operations to run, and they need to run synchronously, since they're the ones creating the promises." Please let me know what is not clear about that. |
Well, that's the 3rd comment down after a reference to a giant comment on a On Wed, Sep 23, 2015 at 10:20 AM, jan-ivar [email protected] wrote:
|
Each of the five _operation_s: Look at
(I'm leaving out the remaining steps which are all about what step 4 launched in parallel). Before it returns, this function:
p is important, as without p you have no handle on when the asynchronous part set up by Without calling these steps you have no p. Furthermore, in the typical call (where nothing is queued) the steps must be called synchronously, by which I mean that the steps must have executed before the call from content JS returns, and p must be returned to content JS. That's what I mean by synchronous. |
Great. I'm striving to get better at boiling stuff down. I see you made additional comments elsewhere, so let me catch up. |
Addressed feedback from @adam-be in #314 (comment) |
Simplified for fair comparison with #314. |
Closing as the discussion seems to have moved to #314 and in addition seems to have converged over there. |
I'm resubmitting this PR for consideration as a solution to #299, and I respectfully request that people take another look, as I don't see any competing PRs to solve this issue.