centralized media control service in chrome process
Categories
(Core :: Audio/Video: Playback, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox70 | --- | fixed |
People
(Reporter: alwu, Assigned: alwu)
References
Details
Attachments
(7 files, 1 obsolete file)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
In the past, we use AudioChannelService to manage all media within one process, we did play, pause, stop those media and managed audio focus all in AudioChannelService.
However, since e10s, we have had multiple content processes and will have more in Fission. AudioChannelService no longer has an ability to manage media together which might started in different processes.
Therefore, we will implement a new service in chrome process which can manage media among different processes. In the first step, we would start from supporting play, pause and stop which we already have supported on Android by using the media control interface or managing audio focus among tabs.
In the future, we can extend the service to support hardware media key, using media key to control all (or one) tabs at the same time, or support something like having a media control in desktop. Like what Chrome did [1].
Assignee | ||
Comment 1•5 years ago
|
||
Here is my current draft, in case that someone has an interest about it.
Will add some tests and split patches later.
Comment 2•5 years ago
|
||
Bugbug thinks this bug is a enhancement, but please change it back in case of error.
Assignee | ||
Comment 3•5 years ago
|
||
It's actually a defect, because we have this feature long time ago but it has been broken since we switch to e10s.
Assignee | ||
Comment 4•5 years ago
|
||
In order to have a centralized audio control in the parent process, we create two new classes here.
-
MediaController
MediaController is a class used to control certain amount of media in the content process. Every controller corresponds to a browsing context.
For example, TabMediaController would correspond to the top level browsing context, which mean it can control all media in the specific tab. -
MediaControlService
As there might be multiple tabs playing audio, so there would be multiple controllers. MediaControlService is a place to manage all of them, you can access specific controller through MediaControlService by providing controller ID.
Everytime a controller becomes active, which means there is a media starts in corresponding browsing context, then controller would be added into the list of the MediaControlService. And it would be removed from the list when the media in corresponding browsering context stopped.
Assignee | ||
Comment 5•5 years ago
|
||
In order to support audio competing among different tabs, we implement a new class AudioFocusManager.
AudioFocusManager is used to assign the audio focus to different requester and decide which requester can own audio focus when audio competing happens.
When the audio competing happens, the last request would be a winner who can still own the audio focus, and all the other requesters would lose the audio focus.
Now MediaController is the onlt requester, it would request the audio focus when it becomes audible and revoke the audio focus when the controller is no longer active.
Assignee | ||
Comment 6•5 years ago
|
||
We don't want to enable audio competing by default, so hide this feature behind a static pref.
Assignee | ||
Comment 7•5 years ago
|
||
We implement some helpful functions in MediaControlUtils which can be used to notify controller when media starts/stops playing or become audible/inaudible.
For now, we can temporarily notify these changes in AudioChannelService where we have already known when media has these kinds of status changing.
Assignee | ||
Comment 8•5 years ago
|
||
This patch implements how to use MediaController to control corresponding media in content processes.
Assignee | ||
Comment 9•5 years ago
|
||
Assignee | ||
Comment 10•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Comment 11•5 years ago
|
||
Comment 12•5 years ago
|
||
Backed out 7 changesets (Bug 1565689) for browser chrome failures
Backout link: https://hg.mozilla.org/integration/autoland/rev/82db0cb5779d84929e6ffed33c7b879cf04394ec
Failure log:
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=260017370&repo=autoland&lineNumber=3658
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=260024667&repo=autoland&lineNumber=10440
Comment 13•5 years ago
|
||
I think this was also introduced by these changes:
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=260017559&repo=autoland&lineNumber=30849
Assignee | ||
Comment 14•5 years ago
|
||
Have updated the fix, waiting for the try result and will push them again if all results are good.
Comment 15•5 years ago
|
||
Comment 16•5 years ago
|
||
Backed out for assertion failure at MediaControlUtils.h
Push that started the failures https://treeherder.mozilla.org/#/jobs?repo=autoland&resultStatus=testfailed%2Cbusted%2Cexception&revision=9ebf6f8a4fda6267d3f44fd3cd775474e1fb1002
Push with failures https://treeherder.mozilla.org/#/jobs?repo=autoland&selectedJob=260250811&resultStatus=testfailed%2Cbusted%2Cexception&revision=562d312e70e2dfebbfb32fc6194bb24f51d321d6
Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=260250811&repo=autoland&lineNumber=23184
Backout: https://hg.mozilla.org/integration/autoland/rev/e0029fe751e0fea1ee69549a9414d26dac1548f4
Assignee | ||
Comment 17•5 years ago
|
||
From the push result [1], although there are some orange failures, but all of them seem not related with my change, and I didn't see any assertion or suspious failure this time.
Comment 18•5 years ago
|
||
Comment 19•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/f6383bdf9dfd
https://hg.mozilla.org/mozilla-central/rev/c1a2ecc4098e
https://hg.mozilla.org/mozilla-central/rev/2642920cf299
https://hg.mozilla.org/mozilla-central/rev/5790ef015c5b
https://hg.mozilla.org/mozilla-central/rev/d138720d49a9
https://hg.mozilla.org/mozilla-central/rev/bd22cb43dc59
https://hg.mozilla.org/mozilla-central/rev/8016ae836490
Assignee | ||
Updated•5 years ago
|
Description
•