- From: Jan-Ivar Bruaroey via GitHub <sysbot+gh@w3.org>
- Date: Tue, 01 Oct 2019 00:25:02 +0000
- To: public-webrtc@w3.org
jan-ivar has just created a new issue for https://github.com/w3c/webrtc-pc: == Racy setParameters()/getParameters() behavior == ### Problem A The following may race with a remote simulcast offer: ```js const params = pc.getParameters(); await wait(0); await pc.setParameters(params); // Intermittent InvalidStateError ``` ...because SRD clears [[[LastReturnedParameters]]](https://w3c.github.io/webrtc-pc/#dfn-lastreturnedparameters) if it gets an initial simulcast offer. ### Problem B A related issue: *getParameters()* is not a true/idempotent getter, because it modifies state, which may cause surprising action at a distance: ```js function foo(pc) { if (bar()) { console.log(JSON.stringify(pc.getParameters()); } } const params = pc.getParameters(); foo(); await pc.setParameters(params); // InvalidStateError if bar() == true ``` ### Proposed solutions 1. Queue a task in *getParameters* to clear [[LastReturnedParameters]]. 2. Only increment [transactionId](https://w3c.github.io/webrtc-pc/#dom-rtcrtpsendparameters-transactionid) when [[LastReturnedParameters]] is `null`. This makes **B** always work, and **A** always fail with `InvalidStateError` (not intermittently). Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/2315 using your GitHub account
Received on Tuesday, 1 October 2019 00:25:04 UTC