Camera device list empty due to NPE in Camera2Enumerator::convertSizes in libwebrtc sdk
Categories
(Core :: WebRTC: Audio/Video, defect, P3)
Tracking
()
People
(Reporter: benedictpak, Unassigned)
References
Details
Steps to reproduce:
Using Fenix 101.2.0, or GeckoView-example on Samsung Galaxy Note 10+ on Android 12:
- Visit https://mozilla.github.io/webrtc-landing/gum_test.html
- Click Camera
- Allow permission for Firefox to use the camera while using the application
Actual results:
"NotFoundError: The object cannot be found here." appears.
Expected results:
Fenix should prompt "Allow the site to use your camera", then the camera should start capturing.
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Comment 1•2 years ago
|
||
Thanks Benedict for filing! This seems device dependent, as I'm unable to reproduce on my (admittedly ancient) Samsung S9. Maybe others on our team have newer devices to test with...
Do you happen to have the line number for the exception in convertSizes?
And lastly, did this work before in an earlier version? Determining if it's a regression would help us find it and also help escalate priority. Thanks
Reporter | ||
Comment 2•2 years ago
|
||
Hi Jan, thanks for the response!
I'm not sure if it worked in an earlier version since I only recently started trying out Firefox Mobile. Do you have a Samsung Galaxy S20? This issue could be reproduceable on that device as well.
The line number for the exception is on line 246, when enumerating cameraSizes
. The value of cameraSizes
is null
, because of line 158 for camera ID 4. The fix is actually available here in mozilla's libwebrtc:
https://github.com/mozilla/libwebrtc/commit/1460e15a45525a2d2f5b6957b79c8a84dd94d4ce
I tested it on my local build of fenix, and it works fine. There is an additional fix to be made for GeckoView Example for Android 12 when testing, in GeckoViewActivity.java line 2389 - just set the flag to be FLAG_IMMUTABLE
.
getUserMedia
works fine on Chrome 103 for Samsung Note 10+. I never had an issue with it. I suspect that Google had already merged a fix sometime before.
I was searching for this issue online and these are the relevant issues I have found:
https://github.com/twilio/twilio-video.js/issues/1264
https://github.com/mozilla-mobile/fenix/issues/18368
https://deepinout.com/android-camera-official-documentation/android-camera2-api/android-camera2-api-streamconfigurationmap-coding-1.html (The reference here is in Chinese (Mandarin), but there's code below indicating that camera ID 4 throws this error on Samsung Note 10+ and Galaxy S20.)
Apologies for not making a pull request - I found it very complex to do so here. I hope you can apply this patch soon!
Updated•2 years ago
|
Updated•2 years ago
|
Comment 3•2 years ago
|
||
Fixed by bug 1766646: https://hg.mozilla.org/mozilla-central/rev/0a6a2710e4da9a23f237c33a982b9685edb243d5
Description
•