Re: [mediacapture-transform] How does generator.mute change track states? (#81)

>  If I mute and unmute a track a thousand times, I expect to see a thousand mute events ...
> If we change the prose to be:
> 
> run the following steps:
> 
> * For each live track sourced by this, queue a task to set a track’s muted state to [[IsMuted]].

Do you mean:
* For each live track sourced by this, queue a task to [set a track’s muted state](https://w3c.github.io/mediacapture-main/#set-track-muted) to [this](https://webidl.spec.whatwg.org/#this).[[isMuted]]?

That'll fire 1 event, not 1000, because of _"2. If track.[[[Muted]]](https://w3c.github.io/mediacapture-main/#dfn-muted) is already newState, then abort these steps."_

That's assuming generator.[[isMuted]] isn't modified by JS during the other 999 tasks, which would then fire ghost events. Action at a distance.

Or did you mean:
* Let _value_ be [this](https://webidl.spec.whatwg.org/#this).[[isMuted]].
* For each live track sourced by this, queue a task to [set a track’s muted state](https://w3c.github.io/mediacapture-main/#set-track-muted) to _value_?


This would produce the following: Time --->

| Task1 | Task2 | Task3 | Task4 | ... |
|--------------|-----------|------------|--------------|---|
| generator.muted = true;<br>generator.muted = false;<br>generator.muted = true;<br>... | onmuted<br>track.muted == true<br>generator.muted == false | onunmuted<br>track.muted == false<br>generator.muted == false | onmuted<br>track.muted == true<br>generator.muted == false | ... |

Let's hypothetically say each task takes 0.02 ms. That's 20 ms during which JS is led to believe the underlying device (generator) is flipping its muted state back and forth, when this isn't happening. That all happened on the _same_ task 19.98 milliseconds ago, which wasn't enough time for any real background device to have had any back-and-forth reaction.

Letting synchronous actions on a single task generate a (potentially unbounded) series of timed events like this seems like a bad idea. It also sets up a dissonance between what the JS observer sees and what is actually happening with the generator.

-- 
GitHub Notification of comment by jan-ivar
Please view or discuss this issue at https://github.com/w3c/mediacapture-transform/issues/81#issuecomment-1055619183 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 1 March 2022 16:22:56 UTC