Prepare for dispatching devicechange events even without an actively capturing MediaStreamTrack
Categories
(Core :: WebRTC: Audio/Video, enhancement, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox97 | --- | fixed |
People
(Reporter: karlt, Assigned: karlt)
References
Details
Attachments
(12 files, 6 obsolete files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
Gecko currently dispatches "devicechange" events only when
- there is an actively capturing MediaStreamTrack, or
- the origin has a permission for permanent access to a camera or microphone.
"fully active and has focus" has subsequently been added to the spec as a sufficient condition. This provides for "audiooutput" devices even when getUserMedia()
is not used.
The permissions check was replaced in the spec with a [[canExposeDeviceInfo]] MediaDevices slot, set on getUserMedia()
grant.
This makes the actively capturing test redundant as a track cannot become active without a getUserMedia()
grant.
Removing the actively capturing test will resolve a defect where actively capturing tracks can be prematurely GC'd causing loss of "devicechange" events.
With provision of "devicechange" events in more circumstances, we should only add events for devices that should be exposed.
Assignee | ||
Comment 1•3 years ago
|
||
"User Agents MAY add fuzzing on the timing of events to avoid cross-origin activity correlation."
Waiting for focus before dispatch would provide the best protection against cross-origin activity correlation. With the plan to wait for focus in enumerateDevices()
, there would be little value in dispatching "devicechange" before enumerateDevices()
could proceed.
Assignee | ||
Comment 2•3 years ago
|
||
"devicechange" events should be dispatched only when devices are physically added or removed rather then when they become exposed to content through getUserMedia()
or selectAudioOutput()
. To provide this, a record of the ordered set of system physical devices at the time when devicechange event decisions were last performed will be kept on each MediaDevices object. This record can be compared with subsequent sets to determine whether the changes should be exposed in a "devicechange" event.
This approach overcomes a number of issues with the spec's approach of keeping a [[storedDeviceList]] that includes only exposed devices and is reset on exposure decision changes.
To reduce to memory footprint of these device set records, the sets will be shared across Window
/MediaDevices
objects where appropriate.
Assignee | ||
Comment 3•3 years ago
|
||
Depends on D132893
Assignee | ||
Comment 4•3 years ago
|
||
to aid in debugging.
Depends on D132894
Assignee | ||
Comment 5•3 years ago
|
||
and ignore fake:false so that it behaves like a missing/default fake parameter
and does not override "media.navigator.streams.fake".
Neither of these combinations are required in tests, but the fake:true
override provides simpler testing of real-world scenarios, such as bug
1743524, even when loopback prefs are set, as is the preferred default test
configuration.
Also, adjusting the logic in this way so that fake: in getUserMedia()
behaves similarly to ShouldResistFingerprinting() in enumerateDevices() will
allow simplification of EnumerateDevicesImpl() parameters and moving the logic
for the effect of preferences on enumeration to one place.
Depends on D132895
Assignee | ||
Comment 6•3 years ago
|
||
"media.navigator.permission.disabled" exists for controlling the permission
prompt separately.
This will allow consolidation of camera and microphone preference handling
into EnumerateRawDevices(). Although auto-disabling permission with
"media.navigator.streams.fake" is sometimes useful for tests, it is actually
easier to consider them independently because sometimes the auto-disabling
needs to be overridden.
The logic to disable the permission prompt with content-exposed fake:true
parameter is maintained as is.
The CamerasParent usage of "media.navigator.permission.fake" seems to have
been a misunderstanding in
https://hg.mozilla.org/mozilla-central/rev/c5d6c3e00c91dd0595a12b145c66cf4f2a890591#l6.129
Depends on D132896
Assignee | ||
Comment 7•3 years ago
|
||
This is performed for
"media.navigator.streams.fake"
"media.video_loopback_dev"
"media.audio_loopback_dev"
Depends on D132897
Assignee | ||
Comment 8•3 years ago
|
||
reducing the complexity in EnumerateDevicesImpl() and facilitating a future
call to perform a similar operation in an enumerateDevices() refactor for
device-change event analysis.
Depends on D132898
Assignee | ||
Comment 9•3 years ago
|
||
EventTarget::SetEventHandler() will cause EventListenerAdded() to be called.
Depends on D132899
Assignee | ||
Comment 10•3 years ago
|
||
MediaDevices are suitable for use on any thread.
This will support a simple override of devices from enumerateDevices() when
resistFingerprinting is set.
Depends on D132900
Assignee | ||
Comment 11•3 years ago
|
||
Provides that the list added must match the list removed.
Depends on D132901
Assignee | ||
Comment 12•3 years ago
|
||
The same list of physical devices can, in a subsequent patch, be returned to
multiple Windows, so that their MediaDevices objects can efficiently keep (and
share) a record of the set of devices when the last "devicechange" event was
queued.
Depends on D132902
Assignee | ||
Comment 13•3 years ago
|
||
enumerateDevices() and devicechange events both require focus.
Focus emulation facilitates running tests on developer machines.
Depends on D132903
Assignee | ||
Comment 14•3 years ago
|
||
The device MUST be uniquely identified by its identifier and its kind.
https://w3c.github.io/mediacapture-main/#dom-mediadeviceinfo-deviceid
A change in name now behaves like a change in device, which is useful for
devicechange event tests.
Depends on D132904
Assignee | ||
Comment 15•3 years ago
|
||
"media.ondevicechange.fakeDeviceChangeEvent.enabled" does not change any
devices and so will not generate any events if/when no-op devicechange events
are filtered out.
The test is rearranged to reduce the wait for no event and run some steps in
parallel, so that the test runs in half the time. This benefit will
accumulate as more scenarios are added to the test.
Depends on D132905
Assignee | ||
Comment 16•3 years ago
|
||
There was little value in dispatching devicechange before enumerateDevices
could proceed.
Depends on D132906
Assignee | ||
Comment 17•3 years ago
|
||
"fully active and has focus" is now a sufficient condition for dispatching "devicechange" events if the change in devices should be visible from enumerateDevices().
https://github.com/w3c/mediacapture-main/pull/574/files#diff-1217ca1c44ff30a33dd50c49d03b5cadc9633c789df8ff9370ed4a42859e1211R3146
Permissions checks are replaced with [[canExposeCameraInfo]] and [[canExposeMicrophoneInfo]] slots set by getUserMedia().
https://github.com/w3c/mediacapture-main/pull/641
https://github.com/w3c/mediacapture-main/pull/773
The "media.navigator.permission.disabled" pref is no longer involved in "devicechange" dispatch decisions.
Depends on D132907
Assignee | ||
Comment 18•3 years ago
|
||
Depends on D132908
Assignee | ||
Comment 19•3 years ago
|
||
Depends on D132910
Assignee | ||
Comment 20•3 years ago
|
||
The fake MediaStreamConstraints dictionary member has no effect on screen and
window sharing because it affects only microphones and cameras since
https://hg.mozilla.org/mozilla-central/rev/39c9062db9d9
Updated•3 years ago
|
Assignee | ||
Updated•3 years ago
|
Comment 21•3 years ago
|
||
Comment 22•3 years ago
|
||
Backed out for causing failures at test_bug386782.html.
Backout link: https://hg.mozilla.org/integration/autoland/rev/f9aa1b75c0bf4ca99838fb1b90e510a0ee087d01
Failure log: https://treeherder.mozilla.org/logviewer?job_id=362023394&repo=autoland&lineNumber=2563
Comment 23•3 years ago
|
||
Assignee | ||
Updated•3 years ago
|
Comment 24•3 years ago
|
||
bugherder |
Comment 25•3 years ago
|
||
Comment 26•3 years ago
|
||
bugherder |
Comment 27•3 years ago
|
||
Comment 28•3 years ago
|
||
bugherder |
Comment 29•3 years ago
|
||
Comment 30•3 years ago
|
||
bugherder |
Assignee | ||
Comment 31•3 years ago
|
||
I'll move the remaining patches to bug 1753131.
Updated•3 years ago
|
Comment 32•3 years ago
|
||
Comment on attachment 9253816 [details]
Bug 1732409 provide a method to return a cached list of physical devices r?jib
Revision D132903 was moved to bug 1753131. Setting attachment 9253816 [details] to obsolete.
Comment 33•3 years ago
|
||
Comment on attachment 9253819 [details]
Bug 1732409 use fake device name changes to test devicechange events r?jib
Revision D132906 was moved to bug 1753131. Setting attachment 9253819 [details] to obsolete.
Comment 34•3 years ago
|
||
Comment on attachment 9253820 [details]
Bug 1732409 wait for focus before dispatching devicechange events r?jib
Revision D132907 was moved to bug 1753131. Setting attachment 9253820 [details] to obsolete.
Comment 35•3 years ago
|
||
Comment on attachment 9253821 [details]
Bug 1732409 Dispatch devicechange events even without an actively capturing MediaStreamTrack r?jib
Revision D132908 was moved to bug 1753131. Setting attachment 9253821 [details] to obsolete.
Comment 36•3 years ago
|
||
Comment on attachment 9253822 [details]
Bug 1732409 test devicechange events when first device is added or last is removed r?jib
Revision D132909 was moved to bug 1753131. Setting attachment 9253822 [details] to obsolete.
Comment 37•3 years ago
|
||
Comment on attachment 9254991 [details]
Bug 1732409 test "devicechange" event with different exposure timing r?jib
Revision D133604 was moved to bug 1753131. Setting attachment 9254991 [details] to obsolete.
Description
•