W3C home > Mailing lists > Public > public-webrtc-logs@w3.org > December 2017

Re: [webrtc-pc] When to fire events triggered by setRemoteDescription.

From: henbos via GitHub <sysbot+gh@w3.org>
Date: Thu, 28 Dec 2017 19:48:36 +0000
To: public-webrtc-logs@w3.org
Message-ID: <issue_comment.created-354347809-1514490515-sysbot+gh@w3.org>
But what about this?

let processedStreams = new Set();
pc.setRemoteDescription() with "stream: { track1, track2 }"
pc.ontrack = e => {
  e.streams.forEach(stream => {
    if (!processedStreams.has(stream)) {
      // New remote stream!

This will fire ontrack twice, once for "track1" and once for "track2", both are added to "stream".
If defer all operations, not just their events firing, then when track1's event fires stream.getTracks() will only contain track1. Only in the second event is stream.getTracks() representing the complete picture. And we have no idea of knowing when the last stream has been added.

processStream() would not be able to look at stream.getTracks() without getting confusing results. Any application wanting to process remote streams and be able to use getTracks() would have to:
1. Add all new streams to a list.
2. After SRD has resolved, then handle the processing of all new streams.

What about POLA-violation "_That's not what the remote stream looks like!_" at processStream()? There was never a remote stream that only contained track1; the event describes details of the machinery, not the final result.

GitHub Notification of comment by henbos
Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/1691#issuecomment-354347809 using your GitHub account
Received on Thursday, 28 December 2017 19:48:40 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:21:52 UTC