getUserMedia Video/Camera broken due to preview/picture size mismatch

VERIFIED FIXED in Firefox 38

Status

()

VERIFIED FIXED
4 years ago
4 years ago

People

(Reporter: CristinaM, Assigned: gcp)

Tracking

Trunk
mozilla38
ARM
Android
Points:
---

Firefox Tracking Flags

(firefox38 verified, fennec38+)

Details

Attachments

(2 attachments)

Build: Firefox for Android 38.0a1 (2015-02-03)
Device: Samsung Galaxy S4 (Android 4.4.2)

Steps to reproduce:
1. Go to http://mozilla.github.com/webrtc-landing/gum_test.html;
2. Choose one option Video/ Audio/ Audio&Video;
3. Choose 'Share' option from the doorhanger.

Expected results: A video appears showing the content from the camera and an audio stream from the built-in microphone is heard. Visible indicators are present indicating that the camera and mic are active.

Actual results: The content of the device camera and the audio is not shown. 

Regression:
Last good: 29b05d283b00
First bad: d7e156a7a0a6
Pushlog: https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=29b05d283b00&tochange=d7e156a7a0a6

Bug 1109248 caused this?
getUserMedia works for me on my SII, Nexus 5 & Nexus 6, trunk Nightly 02/04. No
Component: General → WebRTC
Product: Firefox for Android → Core
Summary: Selecting 'Share' option from the permission prompt does not show the content of the device camera and the audio active → getUserMedia broken on Android?
Comment #1

(In reply to Aaron Train [:aaronmt] from comment #1)
> No problems here.
(Assignee)

Comment 3

4 years ago
Logcat please?
Flags: needinfo?(cristina.madaras)
(Reporter)

Comment 4

4 years ago
Created attachment 8559184 [details]
logs.txt

I attached the logs.
Flags: needinfo?(cristina.madaras)
(Assignee)

Comment 5

4 years ago
Thanks. Relevant part:

02-04 17:55:04.040: D/WEBRTC-JC(20946): Camera orientation: 0 .Device orientation: 270
02-04 17:55:04.050: D/WEBRTC-JC(20946): isVideoStabilizationSupported: false
02-04 17:55:04.050: D/WEBRTC-JC(20946): Camera preview mfps range: 1000 - 30000
02-04 17:55:04.050: W/ServiceManager(292): Permission failure: com.sonyericsson.permission.CAMERA_EXTENDED from uid=10204 pid=20946
02-04 17:55:04.050: W/ServiceManager(292): Permission failure: com.sonyericsson.permission.CAMERA_EXTENDED from uid=10204 pid=20946
02-04 17:55:04.050: E/cald(292): 1921720197 excal_cam_ctrl.cpp                (3085) 21690 E [EXC] [COMP] [CamCtrl         056] Not support snapshot primary ImageSize(720 x 480)
02-04 17:55:04.060: E/WEBRTC-JC(20946): startCapture failed
02-04 17:55:04.060: E/WEBRTC-JC(20946): java.lang.RuntimeException: setParameters failed
02-04 17:55:04.060: E/WEBRTC-JC(20946):         at android.hardware.Camera.native_setParameters(Native Method)
02-04 17:55:04.060: E/WEBRTC-JC(20946):         at android.hardware.Camera.setParameters(Camera.java:1707)
02-04 17:55:04.060: E/WEBRTC-JC(20946):         at org.webrtc.videoengine.VideoCaptureAndroid.access$100(VideoCaptureAndroid.java:48)
02-04 17:55:04.060: E/WEBRTC-JC(20946):         at org.webrtc.videoengine.VideoCaptureAndroid$1.run(VideoCaptureAndroid.java:188)
02-04 17:55:04.060: E/WEBRTC-JC(20946):         at android.os.Handler.handleCallback(Handler.java:733)
02-04 17:55:04.060: E/WEBRTC-JC(20946):         at android.os.Handler.dispatchMessage(Handler.java:95)
02-04 17:55:04.060: E/WEBRTC-JC(20946):         at android.os.Looper.loop(Looper.java:212)
02-04 17:55:04.060: E/WEBRTC-JC(20946):         at org.webrtc.videoengine.VideoCaptureAndroid$CameraThread.run(VideoCaptureAndroid.java:162)
Assignee: nobody → gpascutto
tracking-fennec: --- → ?
(Assignee)

Updated

4 years ago
Summary: getUserMedia broken on Android? → getUserMedia Video/Camera broken on Samsung Galaxy S4
(Assignee)

Comment 6

4 years ago
The relevant change from the webrtc 40 update is this:

-      parameters.setPreviewSize(width, height)

+      parameters.setPictureSize(width, height);
+      parameters.setPreviewSize(width, height);

The setPictureSize is excepting. I need to look a bit why upstream made this change though. I'm a bit worried we're trying to start the camera at a resolution it didn't even report as being supported.

Comment 7

4 years ago
Also reproducible on Samsung Galaxy R (Android 2.3.4);

Error thrown in logs:

startCapture failed
java.lang.RuntimeException: No preview surface for Camera.
at org.webrtc.videoengine.VideoCaptureAndroid.access$100(VideoCaptureAndroid.java:48)
at org.webrtc.videoengine.VideoCaptureAndroid$1.run(VideoCaptureAndroid.java:188)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at org.webrtc.videoengine.VideoCaptureAndroid$CameraThread.run(VideoCaptureAndroid.java:162)
Summary: getUserMedia Video/Camera broken on Samsung Galaxy S4 → getUserMedia Video/Camera broken on some devices
(Assignee)

Comment 8

4 years ago
Hmm, I find no evidence we're doing it wrong. I couldn't reproduce the original issue on my Galaxy S3, but I tried to force things:

I/WebRTC  (26084):   Capture Device Index 0, Name Camera 0, Facing back, Orientation 90
I/WebRTC  (26084): Number of Capabilities 5
I/WebRTC  (26084): type=12 width=960 height=720 maxFPS=30
I/WebRTC  (26084): type=12 width=1280 height=720 maxFPS=30
I/WebRTC  (26084): type=12 width=640 height=480 maxFPS=30
I/WebRTC  (26084): type=12 width=352 height=288 maxFPS=30         <===========
I/WebRTC  (26084): type=12 width=320 height=240 maxFPS=30
I/WebRTC  (26084):   Capture Device Index 1, Name Camera 1, Facing front, Orientation 270
I/WebRTC  (26084): Number of Capabilities 7
I/WebRTC  (26084): type=12 width=960 height=720 maxFPS=30
I/WebRTC  (26084): type=12 width=1280 height=720 maxFPS=30
I/WebRTC  (26084): type=12 width=704 height=704 maxFPS=30         <= wtf
I/WebRTC  (26084): type=12 width=352 height=288 maxFPS=30         <===========
I/WebRTC  (26084): type=12 width=640 height=480 maxFPS=30
I/WebRTC  (26084): type=12 width=320 height=320 maxFPS=30
I/WebRTC  (26084): type=12 width=320 height=240 maxFPS=30

I then changed the default width/height to 500x300 which doesn't match anything.

D/WEBRTC-JC(26084): startCapture: 352x288@30000:30000        <= closest match so constraints doing their job
D/WEBRTC-JC(26084): Camera orientation: 90. Device orientation: 0
D/SecCameraCoreManager( 1940): getParameters
D/WEBRTC-JC(26084): isVideoStabilizationSupported: true
D/WEBRTC-JC(26084): Camera preview mfps range: 30000 - 30000
D/SecCameraCoreManager( 1940): setParameters
V/ShotSingle( 1940): setParameters(0)
D/ISecCameraHardware( 1940): setPreviewSize: preview 352x288
W/ISecCameraHardware( 1940): setPictureSize: warning, not supported size(352x288)  <= wut??
D/ISecCameraHardware( 1940): setPictureSize: 640x480
V/ISecCameraHardware( 1940): setFrameRate: 30000,30000
V/ISecCameraHardware( 1940): setFrameRate val: 30000
E/ISecCameraHardware( 1940): android::status_t android::ISecCameraHardware::checkArea(ssize_t, ssize_t, ssize_t, ssize_t, ssize_t, int): All values are zero
V/ISecCameraHardware( 1940): setVideoStabilization: true
V/ISecCameraHardware( 1940): setAntiBanding=50hz
E/ISecCameraHardware( 1940): FocusMode=continuous-video, PrevFocusMode=auto
V/ISecCameraHardware( 1940): setFocusMode: continuous-video
V/ISecCameraHardware( 1940): mFocusMode: 11
V/ISecCameraHardware( 1940): setCityid : null value
D/ISecCameraHardware( 1940): setParameters X: success

So the problem is that there's a mismatch between the probed capabilities and what the camera supports in setPictureSize. Checking the upstream code, the bug is there: the camera capabilities are queried with getSupportedPreviewSizes but then the code tries to do a setPictureSize with a value that's not necessarily supported.
(Assignee)

Comment 9

4 years ago
(In reply to Flaviu Cos, QA [:flaviu] from comment #7)
> Also reproducible on Samsung Galaxy R (Android 2.3.4);
> 
> Error thrown in logs:
> 
> startCapture failed
> java.lang.RuntimeException: No preview surface for Camera.

Please file a new bug, this is a different problem.
(Assignee)

Updated

4 years ago
Summary: getUserMedia Video/Camera broken on some devices → getUserMedia Video/Camera broken due to preview/picture size mismatch

Comment 11

4 years ago
(In reply to Gian-Carlo Pascutto [:gcp] from comment #9)
> 
> Please file a new bug, this is a different problem.

I filed Bug 1129858 for that issue.
(Assignee)

Comment 12

4 years ago
Can you test this build and see if it fixes the issue?
https://dl.dropboxusercontent.com/u/32496746/fennec-camera-fix.apk
Flags: needinfo?(cristina.madaras)
(Assignee)

Comment 13

4 years ago
Created attachment 8559756 [details] [diff] [review]
Don't assume setPictureSize supports the same sizes as setPreviewSize

This should preserve the workaround for the Nexus 7 while
not causing issues on the other devices.
Attachment #8559756 - Flags: review?(rjesup)
(In reply to Gian-Carlo Pascutto [:gcp] from comment #12)
> Can you test this build and see if it fixes the issue?
> https://dl.dropboxusercontent.com/u/32496746/fennec-camera-fix.apk

I am not able to reproduce the issue on this build. All options Video/Audio/Audio&Video works as expected. Tested with Samsung Galaxy S4 (Android 4.4.2).
Flags: needinfo?(cristina.madaras)
Attachment #8559756 - Flags: review?(rjesup) → review+
tracking-fennec: ? → 38+
https://hg.mozilla.org/mozilla-central/rev/2d28d627b6a2
Status: NEW → RESOLVED
Last Resolved: 4 years ago
status-firefox38: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
Verified as fixed in Firefox for Android 38.0a1 (2015-02-06);
Device: Samsung Galaxy S4 (Android 4.4.2).
Status: RESOLVED → VERIFIED
status-firefox38: fixed → verified
You need to log in before you can comment on or make changes to this bug.