Closed Bug 1284683 Opened 8 years ago Closed 8 years ago

Unable to use device ids from the content process to call getUserMedia on the chrome process

Categories

(Core :: WebRTC: Audio/Video, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla51
Tracking Status
firefox51 --- fixed

People

(Reporter: florian, Assigned: jib)

References

Details

Attachments

(2 files)

In order to implement previews for the screensharing permission prompt, I've tried to get device ids from the content process (from the device list returned by mozGetUserMediaDevices) to use them in a gUM call in priviledged code running in the chrome process. This fails with a "OverconstrainedError: Constraints could be not satisfied." error.

I'm not sure why yet, but it could be that I'm getting per-origin ids that aren't usable from the chrome process.
Attaching the WIP patch I used to uncover this bug, just in case it could help with debugging.
Blocks: 1284877
jib - can you help out here?
Rank: 21
Component: Audio/Video → WebRTC: Audio/Video
Flags: needinfo?(jib)
Priority: -- → P2
So two things are going on here:

 1. gUM deviceIds are unique per origin, so they're not easily reusable in browser chrome.
 2. We don't support the deviceId constraint in gUM for screensharing.

Screensharing "devices" only have an id as an internal side-effect, since they're not exposed in navigator.mediaDevices.enumerateDevices(). The id's are also not stable AFAIK.

That said, we might be able to slap something together specifically for this, that is:

 1. Don't anonymize internal screensharing id's.
 2. Enable gUM deviceId constraint for screensharing only in browser chrome.
Assignee: nobody → jib
Flags: needinfo?(jib)
(In reply to Jan-Ivar Bruaroey [:jib] from comment #3)

> That said, we might be able to slap something together specifically for
> this, that is:
> 
>  1. Don't anonymize internal screensharing id's.
>  2. Enable gUM deviceId constraint for screensharing only in browser chrome.

In the future I would like to experiment with showing a preview for cameras too (not automatically though, I think it should require a user click on the preview area), so it would be nice if we could find a solution that isn't restricted to screensharing.
OK in that case we should probably consider passing out a raw id as a separate chrome-only argument that would work when used as a constraint in chrome only. Then it would work the same for both camera and screenshare.
(In reply to Jan-Ivar Bruaroey [:jib] from comment #5)
> OK in that case we should probably consider passing out a raw id as a
> separate chrome-only argument that would work when used as a constraint in
> chrome only. Then it would work the same for both camera and screenshare.

That probably makes sense.

Note that all camera and screensharing access is done via CamerasParent in the Master Process; so that may lead to possible optimizations for preview.  Conversely, tab capture (which isn't exposed, and may never be) is done from Content.
Rank: 21 → 15
Priority: P2 → P1
Comment on attachment 8782276 [details]
Bug 1284683 - add unanonymized nsIMediaDevice.rawId for browser-chrome use.

https://reviewboard.mozilla.org/r/72478/#review70252
Attachment #8782276 - Flags: review?(rjesup) → review+
Rebased.
Pushed by jbruaroey@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fe29ddf5a719
add unanonymized nsIMediaDevice.rawId for browser-chrome use. r=jesup
https://hg.mozilla.org/mozilla-central/rev/fe29ddf5a719
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: