W3C home > Mailing lists > Public > public-webrtc-logs@w3.org > October 2019

[webrtc-pc] Racy setParameters()/getParameters() behavior (#2315)

From: Jan-Ivar Bruaroey via GitHub <sysbot+gh@w3.org>
Date: Tue, 01 Oct 2019 00:25:03 +0000
To: public-webrtc-logs@w3.org
Message-ID: <issues.opened-500591790-1569889501-sysbot+gh@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:
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:
function foo(pc) {
  if (bar()) {

const params = pc.getParameters();
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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:22:29 UTC