Try to move devicechange event internals to higher order functions
Categories
(Core :: WebRTC: Audio/Video, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox72 | --- | fixed |
People
(Reporter: pehrsons, Assigned: pehrsons)
References
Details
Attachments
(10 files)
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details |
With bug 1572281 we'll have two separate paths triggering devicechange events through MediaManager (CamerasChild and CubebDeviceEnumerator). I think these paths would benefit by going from the manual, raw listener handling they're using today, to higher order functionality like MediaEvents. This bug is meant to investigate whether that would work in a nice fashion.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 1•5 years ago
|
||
Assignee | ||
Comment 2•5 years ago
|
||
This lets us dispatch tasks already in the MediaManager ctor.
Depends on D48512
Assignee | ||
Comment 3•5 years ago
|
||
Depends on D48513
Assignee | ||
Comment 4•5 years ago
|
||
Depends on D48514
Assignee | ||
Comment 5•5 years ago
|
||
This does three major things:
- Moves the DeviceChange events from manual callbacks/listeners to
MediaEventSource/MediaEventListener. This is the reason this patch is so
large, as it traverses a lot of files.
There are four layers (from low to high):- CamerasChild for camera device list changes, and CubebDeviceEnumerator for
microphone and speaker device list changes - MediaEngineWebRTC, which gathers these into a single listener
- MediaManager, which owns the MediaEngineWebRTC backend
- MediaDevices, where the events from MediaManager are exposed to js
- CamerasChild for camera device list changes, and CubebDeviceEnumerator for
- Changes the fake event triggering from starting a 30-event burst on setting
the js event listener, to a toggle, so that while the pref is on the events
keep coming. - Moves the fake event generation from CamerasChild to MediaEngineWebRTC, since
that's the lowest level where we are aware of both video and audio events.
The fake event generation is also greatly simplified. From being a dedicated
thread with periodic runnables, it is now a periodic timer on main thread
that fires while fake events are enabled. MediaEventProducer gracefully
handles thread safety.
Depends on D48515
Assignee | ||
Comment 6•5 years ago
|
||
This allows the mochitest to finish several seconds faster.
Depends on D48516
Assignee | ||
Comment 7•5 years ago
|
||
If MediaDevices received recurring devicechange events from MediaManager, the
FuzzTimer would be restarted for each one, to coalesce them into the same js
event. If the internal events kept coming sooner than the fuzz timer timeout,
the fuzz timer would never fire.
This patch inverts the logic, so that the first scheduled fuzz timer fires, and
any intermediate internal events are ignored. After it has fired, a new internal
event triggers a new fuzz timer.
Depends on D48517
Assignee | ||
Comment 8•5 years ago
|
||
This makes rejections reject with an Error so that stacks make sense on failure.
It also changes some let
to const
since they're never assigned to.
Depends on D48519
Assignee | ||
Comment 9•5 years ago
|
||
Depends on D48520
Assignee | ||
Comment 10•5 years ago
|
||
Depends on D48521
Updated•5 years ago
|
Comment 11•5 years ago
|
||
Comment 12•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/d40bb93b5d83
https://hg.mozilla.org/mozilla-central/rev/bc24be7e8e9c
https://hg.mozilla.org/mozilla-central/rev/5e4230f6c609
https://hg.mozilla.org/mozilla-central/rev/2652d06847e6
https://hg.mozilla.org/mozilla-central/rev/c5d1b1d238f7
https://hg.mozilla.org/mozilla-central/rev/dc65cac4d9fd
https://hg.mozilla.org/mozilla-central/rev/d6f3399cc0ab
https://hg.mozilla.org/mozilla-central/rev/1d6e24866948
https://hg.mozilla.org/mozilla-central/rev/350b2c44853c
https://hg.mozilla.org/mozilla-central/rev/02ea16355197
Description
•