mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-09 04:25:38 +00:00
Bug 779721. Part 5: Add a comment explaining more about how MediaStream lifetimes are managed. r=jesup
This commit is contained in:
parent
481c2bc36d
commit
8184332b0d
@ -202,6 +202,25 @@ class SourceMediaStream;
|
||||
*
|
||||
* We make them refcounted only so that stream-related messages with MediaStream*
|
||||
* pointers can be sent to the main thread safely.
|
||||
*
|
||||
* The lifetimes of MediaStreams are controlled from the main thread.
|
||||
* For MediaStreams exposed to the DOM, the lifetime is controlled by the DOM
|
||||
* wrapper; the DOM wrappers own their associated MediaStreams. When a DOM
|
||||
* wrapper is destroyed, it sends a Destroy message for the associated
|
||||
* MediaStream and clears its reference (the last main-thread reference to
|
||||
* the object). When the Destroy message is processed on the graph
|
||||
* manager thread we immediately release the affected objects (disentangling them
|
||||
* from other objects as necessary).
|
||||
*
|
||||
* This could cause problems for media processing if a MediaStream is
|
||||
* destroyed while a downstream MediaStream is still using it. Therefore
|
||||
* the DOM wrappers must keep upstream MediaStreams alive as long as they
|
||||
* could be being used in the media graph.
|
||||
*
|
||||
* At any time, however, a set of MediaStream wrappers could be
|
||||
* collected via cycle collection. Destroy messages will be sent
|
||||
* for those objects in arbitrary order and the MediaStreamGraph has to be able
|
||||
* to handle this.
|
||||
*/
|
||||
class MediaStream {
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user