Re: [mediacapture-main] Garbage collection of live tracks (#910)

A clarifying question...

In the original code snippet, as long as `HandOff(stream)` is doing something with that stream that created a reference to it, *or that stream's child objects such as tracks*, `stream` would not be GC'ed in any circumstance today.  Is that correct?  If that is accurate, then I'd agree with @jan-ivar on this.  If the application has no way to actually use the stream anyway, as all references to it are gone, it makes sense to stop the stream and free up the capture resource.

However, if `stream` is at risk of being GC'ed simply because its first reference here is gone, then this would be a problem.  We used to experience bugs like this with the Web Audio API, where the AudioContext would disappear unless we tacked it to `window` or some other global, which was unexpected.  In those cases, we often had an AudioContext that had associated nodes.  The AudioContext itself wasn't referenced, but nodes attached to it were.  I worry we'd have a problem like this again, but with MediaStream if we GC it even though it has other references or usages.

-- 
GitHub Notification of comment by bradisbell
Please view or discuss this issue at https://github.com/w3c/mediacapture-main/issues/910#issuecomment-1726526487 using your GitHub account


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

Received on Tuesday, 19 September 2023 21:27:57 UTC