Re: [mediacapture-main] Move "global" internal slots to MediaDevices, and fix "relevant object" links (#939)

> My understanding is a [source](https://w3c.github.io/mediacapture-main/#dfn-source) _"can be a physical webcam"_, making it a singleton in the entire user agent.

Ah, this is where we are not aligned.
I do not think the spec works well with source as a singleton.
For instance, it is useful to be able to have all tracks of a document tracks being muted while tracks of another document tracks are not muted, even if they both are using the same camera. Safari is using this for instance to have only one tab capturing at a time. If the source was a singleton, it would not be possible.

AIUI, the main (only) requirement is that cloned tracks have to share the same source.
This is the minimum granularity that all UAs adhere to and this is what we can use as a basis.

> This fails to:
> 
> 1. queue a task

We should dig into this, stopping the sources happen when the document gets unloaded, it is not clear whether queueing a task at this time will ensure the task will be executed.

> 2. consider the same source may be tied to multiple global objects

It works as follows:
- the source has tracks in different global objects
- only one global object will trigger stopping the source when global object gets unloaded
- all tracks that are not in the source global object will get ended after the source is stopped (with an ended event).

> 3. include tracks that have been transferred away to other global objects that now should end (since [track source lifetime management remains tied to the context that created it](https://w3c.github.io/mediacapture-extensions/#transferable-mediastreamtrack))

See above, this is handled.

> 4. consider tracks that have been transferred _here_ from _other_ global objects (which get included here), but if this was the last reference, it needs to [end](https://www.w3.org/TR/mediacapture-streams/#ends-nostop) that reference and stop the source in those other global objects)

As per above, I am not sure why this would be needed.

-- 
GitHub Notification of comment by youennf
Please view or discuss this issue at https://github.com/w3c/mediacapture-main/pull/939#issuecomment-1459665968 using your GitHub account


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

Received on Wednesday, 8 March 2023 07:36:30 UTC