Closed
Bug 1420585
Opened 6 years ago
Closed 6 years ago
getUserMedia hangs when constraints can't be met
Categories
(Core :: WebRTC: Audio/Video, defect, P3)
Tracking
()
RESOLVED
FIXED
mozilla59
Tracking | Status | |
---|---|---|
firefox59 | --- | fixed |
People
(Reporter: john357smith, Assigned: mchiang, NeedInfo)
Details
(Whiteboard: [need info mchiang 2017-12-12])
Attachments
(17 files)
1.69 KB,
text/html
|
Details | |
1.68 KB,
text/html
|
Details | |
5.99 MB,
video/mp4
|
Details | |
5.69 MB,
video/mp4
|
Details | |
1.03 MB,
application/zip
|
Details | |
1.64 MB,
application/zip
|
Details | |
956.95 KB,
application/zip
|
Details | |
1.07 MB,
application/zip
|
Details | |
1.04 MB,
application/zip
|
Details | |
1.56 MB,
application/zip
|
Details | |
485.68 KB,
image/png
|
Details | |
1.42 MB,
application/zip
|
Details | |
1010.10 KB,
application/zip
|
Details | |
1.02 MB,
application/zip
|
Details | |
1.06 MB,
application/zip
|
Details | |
59 bytes,
text/x-review-board-request
|
jib
:
review+
|
Details |
59 bytes,
text/x-review-board-request
|
jib
:
review+
|
Details |
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.102 Safari/537.36 Vivaldi/1.93.955.48 Steps to reproduce: Set constraints to low max width/height and repeat call of navigator.mediaDevices.getUserMedia() with higher width/height in case an error Promise is returned. Code example is attached. Tested with success: desktop Firefox, tablet iGET G71, desktop Chrome and Chrome Android Tested with no success: Samsung S6 Edge, Huawei P8, Samsung Galaxy Nexus Actual results: An error Promise is returned for the first time but repeated call with different constraints just hangs and no Promise is returned even with page reloaded. You have to quit Firefox and start again to get same behaviour. Expected results: An error Promise is returned for each unsuccessful call until constraints are satisfied in which case a success Promise is returned.
Reporter | ||
Comment 1•6 years ago
|
||
It has been almost 2 weeks and no response ... will somebody look at this problem? Thanks.
Assignee | ||
Comment 3•6 years ago
|
||
This is because you set a constraint which limits max resolution size to 160x120. width: { max: 160 }, height: { max: 120 } Enlarge the resolution or change max to ideal could fix this problem.
Component: Audio/Video → WebRTC: Audio/Video
Flags: needinfo?(mchiang)
Product: Firefox for Android → Core
Version: Firefox 57 → 57 Branch
Reporter | ||
Comment 4•6 years ago
|
||
I'm aware how constraints work but that's not what this is problem about - if you set very low resolution size which can't be met a navigator.mediaDevices.getUserMedia() should return an error promise. But it doesn't - instead it hangs infinitely without returning anything. This happens under one condition - it's a repeated call of function. Use case is described in description of this bug and attached is a code where you can test it. Example: 1. set constraints to some really very low values - let's say 10 and 10. 2. call navigator.mediaDevices.getUserMedia() with these constraints 3. an error promise should be returned (unless your cam is able to handle such a resolution which most probably doesn't ...) 4. change constraints to 20 and 20 and call it again 5. navigator.mediaDevices.getUserMedia()never returns anything - just hangs until you restart browser (page reload doesn't help) Doesn't work on all my phones (see above), works with one tablet ...
Assignee | ||
Comment 5•6 years ago
|
||
This attachment works well on my Pixel device. I got numerous Overconstraint error. May need to borrow a Samsung device.
Comment 6•6 years ago
|
||
Friendly reminder to go back on it when you get a chance.
Flags: needinfo?(mchiang)
Updated•6 years ago
|
Whiteboard: [need info mchiang 2017-12-12]
Reporter | ||
Comment 7•6 years ago
|
||
(In reply to Munro Mengjue Chiang [:mchiang] from comment #5) > Created attachment 8936416 [details] > index.html > > This attachment works well on my Pixel device. > I got numerous Overconstraint error. > > May need to borrow a Samsung device. Yes with the first run I also got a lot of Overconstraint errors but after the page reload just got "Testing 10" and nothing happened. But there is one weird behaviour - if all constraints will be invalid (could not be met) you can repeat it as many times as you want. But once there is success met and you get permission dialog to access your cam you never get a success promise nor your can't repeat it.
Assignee | ||
Comment 8•6 years ago
|
||
I will try to find a Samsung device and reproduce it today.
Flags: needinfo?(mchiang)
Assignee | ||
Comment 9•6 years ago
|
||
Cannot repro this bug with Samsung S7.
Reporter | ||
Comment 10•6 years ago
|
||
Hmm, that's weird ... Did you end up with permission dialog to cam (success)? And after page refresh you were still able to see it again? Is there any chance you could test it on another device?
Assignee | ||
Comment 11•6 years ago
|
||
Assignee | ||
Comment 12•6 years ago
|
||
(In reply to john357smith from comment #10) > Hmm, that's weird ... Did you end up with permission dialog to cam > (success)? And after page refresh you were still able to see it again? Yes, please see the attached video. Could you also record a clip showing how you repro this bug? > Is there any chance you could test it on another device? I have test Google Pixel / Samsung S7 / Samsung S8 edge. All of them works fine. The models you listed are quite old that I cannot find any of them.
Assignee | ||
Comment 13•6 years ago
|
||
I put more log and build a test build (https://queue.taskcluster.net/v1/task/Z1EFZIBPTlm_RthjdEAn2g/runs/0/artifacts/public/build/target.apk). Could you help me run attachment 8936416 [details] and collect adb logcat log? There should be some "Munro Test" pattern in it.
Flags: needinfo?(john357smith)
Reporter | ||
Comment 14•6 years ago
|
||
Thanks for your patience. I installed Firefox Nightly as you proposed above, run attachment and record the screen (attached) - currently only for Samsung S6 Edge (as a newest one). Let me know if you need the same procedure also for other devices.
Flags: needinfo?(john357smith)
Reporter | ||
Comment 15•6 years ago
|
||
Assignee | ||
Comment 16•6 years ago
|
||
Thanks for the video. Could you also provide the adb logcat log?
Flags: needinfo?(john357smith)
Reporter | ||
Comment 17•6 years ago
|
||
Flags: needinfo?(john357smith)
Reporter | ||
Comment 18•6 years ago
|
||
ADB logcat attached.
Assignee | ||
Comment 19•6 years ago
|
||
Thanks for the log. It looks like gUM was stuck and never return. Could you help me install the below test build and collect logs again? https://queue.taskcluster.net/v1/task/OSNP06F4TEStO9jjCfEGeA/runs/0/artifacts/public/build/target.apk Please also provide the bugreport (adb bugreport).
Flags: needinfo?(john357smith)
Reporter | ||
Comment 20•6 years ago
|
||
Flags: needinfo?(john357smith)
Reporter | ||
Comment 21•6 years ago
|
||
Reporter | ||
Comment 22•6 years ago
|
||
New build installed, tested, bugreport and logcat attached.
Assignee | ||
Comment 23•6 years ago
|
||
We are very close. From the log, when we request webrtcUI shows the permission dialog, it doesn't show it. And we are waiting for the user's approval or denial. Please help me confirm this with the final test build, then I will loop in front-end team to help check. No bugreport needed. https://queue.taskcluster.net/v1/task/D84AB_ZGTMuBZY2xS1Medw/runs/0/artifacts/public/build/target.apk
Flags: needinfo?(john357smith)
Reporter | ||
Comment 24•6 years ago
|
||
Flags: needinfo?(john357smith)
Reporter | ||
Comment 25•6 years ago
|
||
Sure, no problem. New build installed, tested and just to be sure a new logcat attached. Thanks.
Assignee | ||
Comment 26•6 years ago
|
||
Looks like MediaManager thread is stuck. Please help collect more log with https://queue.taskcluster.net/v1/task/beH8TxKvSaaMxnlrzcC_xQ/runs/0/artifacts/public/build/target.apk
Flags: needinfo?(john357smith)
Reporter | ||
Comment 27•6 years ago
|
||
Flags: needinfo?(john357smith)
Reporter | ||
Comment 28•6 years ago
|
||
New build installed, tested a logcat attached. Thanks.
Assignee | ||
Comment 29•6 years ago
|
||
May I know which rom you flash to your Samsung S6 edge device? According to the log, it seems this device is running Android Oreo, but I don't find any official announcement that this device has been updated to Oreo officially.
Flags: needinfo?(john357smith)
Reporter | ||
Comment 30•6 years ago
|
||
I don't know what do you mean but I didn't flash my phone or did anything like that. I bought it sometime in April/May this year (as a new one) and let regular updates to keep going. Nothing else ... Should I try my second device Huwaei P8? Thanks.
Flags: needinfo?(john357smith)
Reporter | ||
Comment 31•6 years ago
|
||
BTW - I looked into the "SW info" in my phone and it's claiming running on Android 7.0 (Nougat). According to these articles it's possible to get 8.0 for S6 but probably it will take some time: http://www.rootupdate.com/2017/03/names-of-samsung-devices-updating-to-android-8-0-oreo.html http://www.trustedreviews.com/news/samsung-galaxy-s6-android-oreo-update-3343072
Assignee | ||
Comment 32•6 years ago
|
||
Thanks for your information. Could you help 1) collect log with the apk (running attachment 8936416 [details]) https://queue.taskcluster.net/v1/task/Pl3SmQvRQFy4ly1x0Jd9Gg/runs/0/artifacts/public/build/target.apk 2) use the apk to browse the website https://mozilla.github.io/webrtc-landing/gum_test.html ; press "Video", grant the permission and check if you can see camera preview. 3) Install the app "Open Camera" in Google Play and see if you can see camera preview while running this app.
Flags: needinfo?(john357smith)
Reporter | ||
Comment 33•6 years ago
|
||
Flags: needinfo?(john357smith)
Reporter | ||
Comment 34•6 years ago
|
||
1) app installed but crashed first time I started it. After restart it started OK (result same as with previous versions) 2) https://mozilla.github.io/webrtc-landing/gum_test.html - without FF restarting no cam permission but after FF restart it showed permission dialog (same behaviour as with testing of 8936416 attachment) 3) app installed - when this app is running gum_test.html is not working (either black screen or just freezed picture when I start "Open Camera" after). Same behaviour with opposite order. logcat attached from whole sessions of testing above. Thanks.
Assignee | ||
Comment 35•6 years ago
|
||
2) For the gum_test case, after you see the permission dialog and grant the permission, can you see camera preview like the attachment?
Assignee | ||
Updated•6 years ago
|
Flags: needinfo?(john357smith)
Reporter | ||
Comment 36•6 years ago
|
||
Yes I was able to see cam preview (after I approved it in permission dialog) till I started "Open Camera" app - then picture freezed. But - permission dialog was shown after I restarted FF (same problem as with point 1).
Flags: needinfo?(john357smith)
Assignee | ||
Comment 37•6 years ago
|
||
Please help run attachment 8936416 [details] with the debug apk https://queue.taskcluster.net/v1/task/SbtLnZbRS76gCO7Ca1sFtA/runs/0/artifacts/public/build/target.apk
Flags: needinfo?(john357smith)
Reporter | ||
Comment 38•6 years ago
|
||
Flags: needinfo?(john357smith)
Reporter | ||
Comment 39•6 years ago
|
||
App installed and tested - now it behaves differently. It doesn't hang (after reload) but asking me for permission twice (or even three times) despite I allowed it (clicked on "share"). Logcat attached. Thanks.
Assignee | ||
Updated•6 years ago
|
Assignee: nobody → mchiang
Assignee | ||
Comment 40•6 years ago
|
||
Please help use chrome on your S6 edge to browse this web page. https://jsfiddle.net/z2vpambc/ Please collect logs and also let me know if you can see the camera preview.
Flags: needinfo?(john357smith)
Reporter | ||
Comment 41•6 years ago
|
||
Flags: needinfo?(john357smith)
Reporter | ||
Comment 42•6 years ago
|
||
Log attached. Web loaded in Chrome: - Enumerate!: output of devices was shown - gUM!: preview of my front cam was shown Thanks.
Assignee | ||
Comment 43•6 years ago
|
||
(In reply to john357smith from comment #42) > Log attached. Web loaded in Chrome: > > - Enumerate!: output of devices was shown > - gUM!: preview of my front cam was shown > > Thanks. Sorry, I want to test back camera. Please help test again with https://jsfiddle.net/munrochiang/z2vpambc/6/
Flags: needinfo?(john357smith)
Reporter | ||
Comment 44•6 years ago
|
||
Flags: needinfo?(john357smith)
Reporter | ||
Comment 45•6 years ago
|
||
Test repeated, result is same - list of devices and back camera was shown. Thanks.
Assignee | ||
Comment 46•6 years ago
|
||
Please help me install the apk and collect logs. https://queue.taskcluster.net/v1/task/aR_IKw0kRRmIt_cuNvAEJg/runs/0/artifacts/public/build/target.apk
Flags: needinfo?(john357smith)
Reporter | ||
Comment 47•6 years ago
|
||
Flags: needinfo?(john357smith)
Reporter | ||
Comment 48•6 years ago
|
||
App installed and started, behaviour is same as with official FF release - hangs after page reload. Logcat attached.
Assignee | ||
Comment 49•6 years ago
|
||
This should be Samsung S6 Edge android.hardware.camera interface bug. It doesn't support the resolution 176x144 although it claims it does. For long term, Firefox should use android.hardware.camera2 since android.hardware.camera was deprecated. For now, I will implement a patch which would reject the promise when we encounter this problem.
Reporter | ||
Comment 50•6 years ago
|
||
Thanks. After you make a patch can you send me an apk so I can test it on other devices where this problem also occurred (P8 amd Nexus)?
Assignee | ||
Comment 51•6 years ago
|
||
The critical part of the patch has been contained in Comment 37. You can use it to test first.
Assignee | ||
Comment 52•6 years ago
|
||
(In reply to john357smith from comment #39) > App installed and tested - now it behaves differently. It doesn't hang > (after reload) but asking me for permission twice (or even three times) > despite I allowed it (clicked on "share"). > > Logcat attached. > > Thanks. You are asked for permission multiple times because We keep encountering the 176x144 bug and reject the promise, and your code keep trying with larger resolution.
Assignee | ||
Updated•6 years ago
|
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Assignee | ||
Updated•6 years ago
|
Priority: -- → P3
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Assignee | ||
Comment 55•6 years ago
|
||
mozreview-review |
Comment on attachment 8940084 [details] Bug 1420585 - remove unnecessary stopCapture which causes deadlock. https://reviewboard.mozilla.org/r/210364/#review216114 ::: media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java (Diff revision 1) > - if (camera != null) { > - Exchanger<Boolean> resultDropper = new Exchanger<Boolean>(); > - stopCaptureOnCameraThread(resultDropper); > - exchange(resultDropper, false); > - } For some specific device, e.g., Samsung s6 edge, camera.setParameters(parameters) would throw an exception when the resolution is set to 176 x 144. and then this snippet will be executed. stopCaptureOnCameraThread() is supposed to be called by MediaManager thread like we did at [1]. It uses Exchanger [2] to synchronize and swap datas with MediaManager thread. Calling this function directly in CameraThread, like what this snippet does, will make it block at [3]. There is no need to call stopCapture here. The state will still be correct. So we remove this snippet. [1] https://searchfox.org/mozilla-central/rev/652fbd6270de0d3ec424d2b88f8375ff546f949f/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java#267 [2] https://developer.android.com/reference/java/util/concurrent/Exchanger.html [3] https://searchfox.org/mozilla-central/rev/652fbd6270de0d3ec424d2b88f8375ff546f949f/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java#309
Assignee | ||
Comment 56•6 years ago
|
||
s/will make it block at [3]./will make it block at [3] and also block MediaManager thread.
Comment 57•6 years ago
|
||
mozreview-review |
Comment on attachment 8940084 [details] Bug 1420585 - remove unnecessary stopCapture which causes deadlock. https://reviewboard.mozilla.org/r/210364/#review216256 ::: media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java (Diff revision 1) > - if (camera != null) { > - Exchanger<Boolean> resultDropper = new Exchanger<Boolean>(); > - stopCaptureOnCameraThread(resultDropper); > - exchange(resultDropper, false); > - } Maybe leave a code comment here about this?
Attachment #8940084 -
Flags: review?(jib) → review+
Comment 58•6 years ago
|
||
mozreview-review |
Comment on attachment 8940085 [details] Bug 1420585 - refine logs. https://reviewboard.mozilla.org/r/210366/#review216282 ::: dom/media/webrtc/MediaEngineRemoteVideoSource.cpp:301 (Diff revision 1) > + LOG(("ChooseCapability(kFitness) for mTargetCapability and mCapability ++")); > if (!ChooseCapability(aNetConstraints, aPrefs, aDeviceId, mCapability, kFitness)) { Log message says "for mTargetCapability and mCapability" but arg is only mCapability... can you explain?
Attachment #8940085 -
Flags: review?(jib) → review+
Assignee | ||
Comment 59•6 years ago
|
||
mozreview-review |
Comment on attachment 8940085 [details] Bug 1420585 - refine logs. https://reviewboard.mozilla.org/r/210366/#review218436 ::: dom/media/webrtc/MediaEngineRemoteVideoSource.cpp:301 (Diff revision 1) > + LOG(("ChooseCapability(kFitness) for mTargetCapability and mCapability ++")); > if (!ChooseCapability(aNetConstraints, aPrefs, aDeviceId, mCapability, kFitness)) { Please see my below comment. ::: dom/media/webrtc/MediaEngineRemoteVideoSource.cpp:307 (Diff revision 1) > if (!ChooseCapability(aNetConstraints, aPrefs, aDeviceId, mCapability, kFitness)) { > *aOutBadConstraint = FindBadConstraint(aNetConstraints, *this, aDeviceId); > return NS_ERROR_FAILURE; > } > + LOG(("ChooseCapability(kFitness) for mTargetCapability and mCapability --")); > mTargetCapability = mCapability; Because we assign mCapability to mTargetCapability here.
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment 62•6 years ago
|
||
Pushed by mchiang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f5b452454285 remove unnecessary stopCapture which causes deadlock. r=jib https://hg.mozilla.org/integration/autoland/rev/0e8dc361a38f refine logs. r=jib
Comment 63•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/f5b452454285 https://hg.mozilla.org/mozilla-central/rev/0e8dc361a38f
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox59:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
Comment 64•6 years ago
|
||
You can also take a look at this tool from the samsung. You can upgrade or flash your firmware as well as install Custom ROM's using the odin tool by samsung. Here is the link to download: https://www.androidstrike.com/download-odin/
Comment 65•6 years ago
|
||
unable to access http://beststockbrokerindia.com through mozilla firefox but is accessible through internet explorer ..why?
Comment 66•6 years ago
|
||
you can check samsung galaxy s9 plus full feature and check all the details of samsung galaxy s9 plus https://www.latesttechmedia.in/2018/08/samsung-galaxy-s9.html
Flags: needinfo?(udhbhav.tanwer05)
Comment 67•6 years ago
|
||
Yes with the first run I also got a lot of Overconstraint errors but after the page reload just got "Testing 10" and nothing happened. But there is one weird behaviour - if all constraints will be invalid (could not be met) you can repeat it as many times as you want. But once there is success met and you get permission dialog to access your cam you never get a success promise nor your can't repeat it.Gujarati Movie Download https://broadposts.com/download-gujarati-movies/
Flags: needinfo?(broadposts)
Comment 68•5 years ago
|
||
Yes with the first run I also got a lot of Overconstraint errors but after the page reload just got "Testing 10" and nothing happened.
https://allthetechnews.yolasite.com
https://mirrorsitelist.jimdosite.com/
Comment 69•5 years ago
|
||
Get More Information About it on GeekTrickz
Comment 70•5 years ago
|
||
This is because you set a constraint which limits max resolution size to 160x120.
width: max: 160
height: max: 120
Enlarge the resolution or change max to ideal could fix this problem.
Comment hidden (spam) |
Comment hidden (spam) |
Comment hidden (spam) |
Comment hidden (spam) |
Comment hidden (spam) |
You need to log in
before you can comment on or make changes to this bug.
Description
•