Keep media controller's life cycle as the same as its corresponding top-level browsing context
Categories
(Core :: Audio/Video: Playback, task, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox74 | --- | fixed |
People
(Reporter: alwu, Assigned: alwu)
References
Details
Attachments
(5 files, 1 obsolete file)
As each media controller corresponds to a tab (a browsing context tree), so the controller's life cycle should be equal to the tab. Currently we use the top-level browsing context to represent a tab, so when that browsing context is being destroyed, we should also destroy the corresponding media controller.
That can fix some problems,
(1) to make sure all controllers in MediaControlSerivce are valid
We add media controller to the service when it becomes active, and remove it from the service when it becomes inactive.
However, in order to inactivate a controller, we need to receive the notification from the content process, which is used to update the controlled media number. But this notification might fail to sent in some cases [1]. If the corresponding browsing context has been discarded, then we couldn't receive the correct update to remove the media controller from the service.
Therefore, if the life of media controller is controlled by its corresponding context, then we can ensure to remove the controller from the service when the browsing context is going to be destroyed.
(2) to avoid unneccesary creation and destruction of the media controller
Currently the controller would be destroyed when it become inactive (no controlled media existing), and it might be recreated again later if we have other new created controlled media.
We should reuse same media controller all the time until the tab is going to be destroyed.
(3) to support the implementation of bug1592037
In order to support adding metadata on the media controller, we have to keep media controller alive even if we don't start any controlled media. Current implementation can only keep media controller alive when it has controlled media, but the metadata can be set before having any controlled media.
Therefore, we have to change the controller's life cycle in order to store metadata before any controlled media starts.
Assignee | ||
Comment 1•5 years ago
|
||
Assignee | ||
Comment 2•5 years ago
|
||
Assignee | ||
Comment 3•5 years ago
|
||
Updated•5 years ago
|
Assignee | ||
Comment 4•5 years ago
|
||
Assignee | ||
Comment 5•5 years ago
|
||
Updated•5 years ago
|
Updated•5 years ago
|
Assignee | ||
Comment 6•5 years ago
|
||
We should ensure that controllers has been removed from the service when it destroys. Therefore, we remove the assertion in MediaControlService::RegisterActiveMediaController()
and MediaControlService::UnregisterActiveMediaController()
, and return the result to allow caller to know if it has been registered or unregistered or not in order to do error handling or add assertions.
Updated•5 years ago
|
Comment 8•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/1b9a35a629b3
https://hg.mozilla.org/mozilla-central/rev/f41cb58b7afc
https://hg.mozilla.org/mozilla-central/rev/45684b8d59e1
https://hg.mozilla.org/mozilla-central/rev/20e34fd5fa51
https://hg.mozilla.org/mozilla-central/rev/4e4e597e9281
Description
•