New issue
Advanced search Search tips

Issue 718387 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2017
Cc:
Components:
EstimatedDays: ----
NextAction: 2017-06-13
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

Only use video stabilization ON when supported

Reported by somcs...@gmail.com, May 4 2017

Issue description

Example URL:
https://webrtc.github.io/samples/src/content/getusermedia/gum/ 

Steps to reproduce the problem:
1.Launch Chrome
2.Go to https://webrtc.github.io/samples/src/content/getusermedia/gum/ 
3.	It will pop out dialogs for camera permission
4.Allow permissions for both “Allow Chrome to take pictures and record video” and “webrtc.github.io wants to use your camera”

What is the expected behavior?
Camera can be opened successful in Chrome

What went wrong?
1.Chrome has stopped at first time launch
2.After refresh the page, camera can’t be opened successful and only black screen is displayed
3.Camera can be opened successful with “Firefox” browser

Did this work before? N/A 

Is it a problem with Flash or HTML5? N/A

Does this work in other browsers? Yes

Chrome version: 58.0.3029.83  Channel: stable
OS Version: 
Flash Version: 

Contents of chrome://gpu: 

Root Cause: Chrome set CONTROL_VIDEO_STABILIZATION_MODE_ON to camera HAL layer directly.

05-04 06:17:43.120  3475  5913 I BroadcastQueue: am_broadcast_finished: [background,1,Intent { flg=0x14 (has extras) }]
05-04 06:17:43.131  2551 22872 E camera-hal: camera_device.cpp(3656):validateCaptureSettings: Unsupported video stabilization mode 1.
05-04 06:17:43.131  2551 22872 E camera-hal: camera_device.cpp(5509):validateCaptureSettings: validateCaptureSettings failed.
05-04 06:17:43.131  2551 22872 E camera-hal: camera_device.cpp(2819):processRequest: Invalid settings for capture. Device:1 Frame Number:0
05-04 06:17:43.131  2551 22872 E Camera3-Device: Camera 1: threadLoop: RequestThread: Unable to submit capture request 0 to HAL device: Invalid argument (-22)

From below code, Chrome setting a VSmode as ON 
https://cs.chromium.org/chromium/src/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera2.java?dr=CSs&l=337

Instead of setting the mode ON directly chrome should get what are the modes currently it is supported as below. 

int[] availableVSModes = characteristics.get(CameraCharacteristics.CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES);

Then from availableVSModesvariable it can set the stabilization mode as below

previewRequestBuilder.set(CaptureRequest.CONTROL_VIDEO_STABILIZATION_MODE, availableVSModesvariable[x]);
 
XperiaXCompact.txt
17.4 MB Download

Comment 1 by somcs...@gmail.com, May 8 2017

Additional Information:
Issue also reproduce in Xperia XZ
OS: Android
Version: 6.0.1 and 7.1
Components: Blink>WebRTC
Components: -Internals>Media -Blink>WebRTC Blink>GetUserMedia>Webcam
Cc: mcasas@chromium.org chfremer@chromium.org
Cc: magjed@chromium.org

Comment 6 by mcasas@chromium.org, May 20 2017

Cc: -mcasas@chromium.org -magjed@chromium.org
Owner: mcasas@chromium.org
Status: Started (was: Unconfirmed)
Summary: Only use video stabilization ON when supported (was: Unable to launch camera successful in Chrome browser.)
Project Member

Comment 7 by bugdroid1@chromium.org, May 22 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/776023a087ef75be3994cb863aad523cdf5f92da

commit 776023a087ef75be3994cb863aad523cdf5f92da
Author: Miguel Casas-Sanchez <mcasas@chromium.org>
Date: Mon May 22 17:55:21 2017

Video capture android 2: only configure CONTROL_VIDEO_STABILIZATION_MODE_ON when available

This CL changes the video stabilization mode to only configure 
CameraMetadata.CONTROL_VIDEO_STABILIZATION_MODE_ON where supported, after
reports from the field (see bug) where this is not the case, and the setting
of cameraSession upsets the underlying logic.

Bug:  718387 
Change-Id: I3992e371a6d733d804d427c88a7b149abd70cf4b
Reviewed-on: https://chromium-review.googlesource.com/510005
Reviewed-by: Christian Fremerey <chfremer@chromium.org>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#473617}
[modify] https://crrev.com/776023a087ef75be3994cb863aad523cdf5f92da/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera2.java

Comment 8 by mcasas@chromium.org, May 22 2017

NextAction: 2017-05-29
Status: Fixed (was: Started)
somcsas1@gmail.com, since this is hardware-specific, could you 
please confirm #7 solves the problem, when this CL lands in Canary?
([1] will tell the concrete version when it lands).

[1] https://storage.googleapis.com/chromium-find-releases-static/index.html#r473617

Comment 9 by somcs...@gmail.com, May 23 2017

Can you please share the Chrome apk (60.0.3108.0).

Comment 11 by somcs...@gmail.com, May 24 2017

#7: We have tested with Chrome Canary (60.0.3108.0),Still issue exists.
And also we observed continuous crash on Chrome Canary while performing the steps mentioned in description.
Attached bugreport for your reference.
bugreport.zip
3.2 MB Download
Status: Assigned (was: Fixed)
#11: can you please upload the adb logcat? There might
be some information as to why the camera doesn't like the
configuration we're trying to make. 

The current code is here [1] FTR, do you spot some bug?


[1] https://cs.chromium.org/chromium/src/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera2.java?q=VideoCaptureCamera2.java&sq=package:chromium&dr&l=369

Comment 13 by somcs...@gmail.com, May 26 2017

#12 Please find the adb logcat for your reference.
ChromeCanary.txt
1.0 MB View Download
somcsas1@, thanks for the logs; I still see the same failing lines:


05-26 00:58:35.742   824 12185 E camera-hal: camera_device.cpp(3656):validateCaptureSettings: Unsupported video stabilization mode 1.
05-26 00:58:35.742   824 12185 E camera-hal: camera_device.cpp(5509):validateCaptureSettings: validateCaptureSettings failed.
05-26 00:58:35.742   824 12185 E camera-hal: camera_device.cpp(2819):processRequest: Invalid settings for capture. Device:1 Frame Number:0

as trying to set CONTROL_VIDEO_STABILIZATION_MODE_ON (== 1), but given
the current code [1], it means that it's listed as supported by the HAL,

        final int[] stabilizationModes = cameraCharacteristics.get(
                CameraCharacteristics.CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES);
        for (int mode : stabilizationModes) {
            if (mode == CameraMetadata.CONTROL_VIDEO_STABILIZATION_MODE_ON) {
                mPreviewRequestBuilder.set(CaptureRequest.CONTROL_VIDEO_STABILIZATION_MODE,
                        CameraMetadata.CONTROL_VIDEO_STABILIZATION_MODE_ON);
                break;
            }
        }

Do you think your smartphone is giving us a false list of
|stabilizationModes|? :-)



[1] https://cs.chromium.org/chromium/src/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera2.java?q=VideoCaptureCamera2.java&sq=package:chromium&dr&l=373
The NextAction date has arrived: 2017-05-29
NextAction: 2017-06-06
#14 We checked in latest SW for XperiaXZ. we can not get the error info like Unsupported video stabilization mode 1.
But continuous crash happens in Chrome Canary app. 
And also below error we got.  

06-01 17:46:52.501 19470 21669 W System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
06-01 17:46:52.501 19470 21669 W System.err: 	at org.chromium.media.VideoCaptureCamera2.getPhotoCapabilities(VideoCaptureCamera2.java:334)
06-01 17:46:52.508 19470 21669 F chromium: [FATAL:jni_android.cc(243)] Please include Java exception stack in crash report
06-01 17:46:52.608  1764 21933 I cald    : 1093654104786 excal_iq_ctrl.cpp                 (1146) 21933 I [INF] [P] IqCtrl::doLcPrepared
06-01 17:46:52.868  1913  1913 V battery_logging: --- battery_logging battery event ---
06-01 17:46:52.961  2246  2297 W MessageQueue: Timeout messages: 179
06-01 17:46:52.961  2246  2297 W MessageQueue:   Message 0: { when=-2s217ms callbac


After allowing canary to take picture, continous crash happening we couldnt go further for streaming.

06-01 17:46:54.220 19470 21669 F libc    : Fatal signal 5 (SIGTRAP), code 1 in tid 21669 (Thread-11)
06-01 17:46:54.225   480   480 W         : debuggerd: handling request: pid=19470 uid=10208 gid=10208 tid=21669
06-01 17:46:54.320 22058 22058 D clmlib  : Got activities:0x0000000E
06-01 17:46:54.320 22058 22058 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
06-01 17:46:54.320 22058 22058 F DEBUG   : UUID: 7f04e86d-de14-4293-a0b4-faba224c6ac5
06-01 17:46:54.320 22058 22058 F DEBUG   : Build fingerprint: 'Sony/F8331/F8331:7.1.1/41.2.A.9.29/68013014:userdebug/release-keys'
06-01 17:46:54.320 22058 22058 F DEBUG   : Revision: '0'

Can you please check in XperiaXZ or XperiaXCompact device from your end also.
XperiaXZ_Canary.txt
1.1 MB View Download

Comment 18 by aluo@chromium.org, Jun 1 2017

First started seeing these in version 58.0.3015.0, it's in M59, M60, and M61.
Can any of you guys add some of the chrome://crashes reports please?
(otherwise it's hard to trace the crash line to the source code).
aluo@ thanks for opening https://crbug.com/728735 with the crash report.

somcsas1@ I believe the crash you're seeing now is unrelated to this bug's
root cause.  Can you please upload a few of the last crash ids in your
Canary to double check it's indeed the same crash? Thanks
Can you please help us to dubug, still issue is exist. After giving permission, chrome canary is continuously crashing (already shared the log of same) so we couldn't check further. can you specify what exactly you are asking.
#21: I tried on Fri with an Xperia Z5 E6653 and could not repro the crash,
so could you please navigate to chrome://crashes in a recent Canary and
copy-paste here some of the crash id's (e.g. the last 3 or 4), so I can
try and correlate those? Thanks

#21: Can you please try in XperiaXZ or XperiaXCompact devices, Since issue is reproducing in X series device and not in Z5 because We have given some work around, the same patch was not involved in XperiaXZ and XperiaXCompact. 

Work around for Xperia Z5:
/* set control data to VS mode_off, if mode_on is not supported */
                if ((staticData.dataCount == 1) && (staticData.data[0] == ControlVideoStabilizationMode_Off ))
                    data = ControlVideoStabilizationMode_Off;

We made an upload of few crashes for your reference.
Crash Report ID: d4d70bc1f0000000 and 60a9d92e40000000

Please let me know if you need any information from our side.
Thanks!
The NextAction date has arrived: 2017-06-06
Yeah so those crashes are also https://crbug.com/728735;
it's weird because the crash is systematically reported to be 
 java.lang.NullPointerException: 
  Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
    at org.chromium.media.VideoCaptureCamera2.getPhotoCapabilities	(VideoCaptureCamera2.java:340 )

but at such line [1] we're not in getPhotoCapabilities() (and never
were), so we'll need to dig some more.

At any rate, it seems like the current crash is not stabilization
related, so this very issue should be fixed, unless you can give 
some more information?

[1] https://cs.chromium.org/chromium/src/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera2.java?q=VideoCaptureCamera2.java&sq=package:chromium&dr&l=340
Yeah so those crashes are also https://crbug.com/728735;
it's weird because the crash is systematically reported to be 
 java.lang.NullPointerException: 
  Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
    at org.chromium.media.VideoCaptureCamera2.getPhotoCapabilities	(VideoCaptureCamera2.java:340 )

but at such line [1] we're not in getPhotoCapabilities() (and never
were), so we'll need to dig some more.

At any rate, it seems like the current crash is not stabilization
related, so this very issue should be fixed, unless you can give 
some more information?

[1] https://cs.chromium.org/chromium/src/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera2.java?q=VideoCaptureCamera2.java&sq=package:chromium&dr&l=340
Can you please let us know what information do you need from our side.
Thanks!
#27: while I try to get my hands on one of these devices, perhaps you could 
either compile and run a Chromium build [1] or just download it from [2],
run it and figure out where is the crashing line?

[1] https://chromium.googlesource.com/chromium/src/+/master/docs/android_build_instructions.md
[2] https://download-chromium.appspot.com/?platform=Android&type=snapshots
#28 Installed both apk using command adb install <apk path>
org.chromium.chrome is crashing while opening. And in ContentShell apk, after enter URL ( https://webrtc.github.io/samples/src/content/getusermedia/gum/)
camera is not opening.
#29: What would be the culprit line(s) and/or the adb
log cat?
NextAction: 2017-06-13
horo@ has been kind enough to repro on a Xperia XZ (F8332) and landed 
a fix that should be available in Canary soon: 
https://storage.googleapis.com/chromium-find-releases-static/index.html#r478515
could you please verify it when it lands? Thanks!
Status: Fixed (was: Assigned)
The crashes seem to have subsided after 61.0.3127.0, so I'm going to
tentatively mark this issue as Fixed, let me know if you experience
this issue any further !


Cc: mcasas@chromium.org
 Issue 729674  has been merged into this issue.
The NextAction date has arrived: 2017-06-13

Comment 35 by somcs...@gmail.com, Feb 20 2018

This issue is still reproducing in Xperia XZ with Chrome 64.0.3282.137.
Device: Xeria XZ 
Android : 7.1.1 and 8.0.0

Sign in to add a comment