New issue
Advanced search Search tips

Issue 881300 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Oct 18
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug

Blocking:
issue 852302



Sign in to add a comment

capture_unittests doesn't work correctly on VM

Project Member Reported by keiichiw@chromium.org, Sep 6

Issue description

OS: ChromeOS, amd64-generic VM

What steps will reproduce the problem?
(1) SSH into amd64-generic VM
(2) Run 'stop ui'
(3) [Optional] Load vivid by 'modprobe vivid n_devs=1 node_types=0x1'
(4) Run './capture_unittests --single-process-tests'.

What is the expected result?
Regardless of whether vivid was loaded at (3) or not, capture_unittests will pass all the test cases.
If vivid is not loaded, several cases should be skipped.
(e.g. early return from https://cs.chromium.org/chromium/src/media/capture/video/video_capture_device_unittest.cc?l=446&rcl=d593de53f6739989189f258ff99a9a5064c1edd6)
Otherwise, vivid should be used as an external camera for tests.

After step (4), cros_camera_service should still work properly.

What happens instead?

While capture_unittests will pass all the test cases, vivid is not used for tests even if (3) is executed.
In addition, cros_camera_service won't detect vivid even when it is loaded after (4). This happened regardless of whether (3) is skipped or not.


During (4), the following message appeared in /var/log/messages: 

ERR cros_camera_service[2443]: CreateClientUnixDomainSocket(): connect /run/camera/camera3.sock: Permission denied
WARNING cros_camera_service[2443]: CreateMojoChannelToParentByUnixDomainSocket(): Failed to connect to /run/camera/camera3.sock
WARNING cros_camera_service[2443]: OnSocketFileStatusChange(): Failed to create Mojo Channel to/run/camera/camera3.sock
INFO cros_camera_service[2443]: OnSocketFileStatusChange(): Connected to CameraHalDispatcher
INFO cros_camera_service[2443]: RegisterCameraHal(): Try to load camera hal /usr/lib64/camera_hal/usb.so
INFO cros_camera_service[2443]: RegisterCameraHal(): Running camera HAL adapter on 3
INFO cros_camera_service[2443]: StartOnThread(): Camera module 0 has 0 cameras
INFO cros_camera_service[2443]: StartOnThread(): SuperHAL started with 1 modules and 0 built-in cameras
INFO cros_camera_service[2443]: RegisterCameraHal(): Registered camera HAL
INFO cros_camera_service[2443]: OnQueryVersionOnThread(): Bridge ready (version=1)
INFO cros_camera_service[2443]: message repeated 11 times: [ OnQueryVersionOnThread(): Bridge ready (version=1)]
INFO cros_camera_service[2443]: OnServiceMojoChannelError(): Mojo connection to CameraHalDispatcher is broken
INFO cros_camera_service[2442]: main(): Child exited: status=104
WARNING kernel: [  108.903388] init: cros-camera main process ended, respawning

---
I guess while capture_unittests running, something in HALv3 was broken.
 crbug.com/871185  might be related.
This problem is a blocker of crbug.com/852302.
 

Comment 1 Deleted

Cc: bpastene@chromium.org
maybe a dumb question: what if you try running "restart cros-camera" in the vm right after loading the kernel module?
Summary: capture_unittest doesn't work correctly on VM (was: cature_unittest doesn't work correctly on VM)
Project Member

Comment 4 by bugdroid1@chromium.org, Sep 14

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/arc-camera/+/40387e4196caec4e46c37c0ca824d7f16b29fa3f

commit 40387e4196caec4e46c37c0ca824d7f16b29fa3f
Author: Shik Chen <shik@chromium.org>
Date: Fri Sep 14 19:08:38 2018

hal_adapter: fix vivid detection after service is restarted

The udev property (ID_V4L_PRODUCT) we used to detect vivid device is
stored in /run/udev/data, so we need to bind it inside the sandbox.

BUG= chromium:871185 , chromium:881300 ,chromium:852302
TEST=On amd64-generic VM, do:
       1. $ modprobe vivid n_devs=1 node_types=0x1
       2. Check vivid is detected
       3. $ restart cros-camera
       4. Check vivid is still detected

Change-Id: Ibfe4b974ed73ae88f42eeb70517ed6fdcf9621dc
Reviewed-on: https://chromium-review.googlesource.com/1214903
Commit-Ready: Shik Chen <shik@chromium.org>
Tested-by: Shik Chen <shik@chromium.org>
Tested-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>

[modify] https://crrev.com/40387e4196caec4e46c37c0ca824d7f16b29fa3f/hal_adapter/init/cros-camera.conf

Blocking: 852302
Status: Started (was: Untriaged)
Summary: capture_unittests doesn't work correctly on VM (was: capture_unittest doesn't work correctly on VM)
Now, we have the following problems:
1. When we use an external camera for capture_unittests, it's necessary to wait until the camera is reported from camera service, but capture_unittests doesn't wait now.
2. capture_unittests requires 320x240 resolution for VideoCaptureDeviceTest.TakePhoto, but vivid doesn't support the resolution.

For 1, as a quick hack, we can make it work by adding "sleep(1)" before this lock(...):
https://cs.chromium.org/chromium/src/media/capture/video/chromeos/camera_hal_delegate.cc?l=174&rcl=813051f36fe0f7bb0f4dd4710ebc7afb607a20dd
With this hack, capture_unittests will start using vivid as an external camera.
But, we want to deal with this in a non-hacky way if possible. shik@ will work for this problem.

For 2, quick hack is to change the constants in capture_unittests.
Actually, capture_unittests seems to be working well with these two hacks.
I think we're also able to extend vivid to support 320x240 resolutions. Since capture_unittests are used on various platforms, I think changing vivid is better than changing tests.
Let me try writing a patch for vivid.
#2: Sorry for late replay, Ben. I overlooked your comment.
At that time, "restart cros-camera" didn't work because of luck of the commit in comment #4.
And, currently, two hacks in #6 would fix the problem. I guess cros_camera_service was broken by illegal use (i.e. not wait for camera to be reported).
About problem 2 in #6:
If the device doesn't support required frame size, tests in capture_unittests should be skipped. So, I created crrev.com/c/1124972.

But, our purpose is to test camera features by vivid. So, it should be reasonable to extend vivid to be satisfied required spec.
crrev.com/c/1249541 is a CL for this. I think this CL is somehow ad-hoc. If there is a better way, please let me know.
Project Member

Comment 9 by bugdroid1@chromium.org, Oct 1

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

commit a49cac786f142bd2d6b2ad9408fc21fec267e724
Author: Keiichi Watanabe <keiichiw@chromium.org>
Date: Mon Oct 01 18:57:00 2018

[Video Capture, Tests]: Use supported frame size in TakePhoto/GetPhotoState

Instead of using a fixed frame size 320x240, use a size that is
supported by the device.

BUG= chromium:881300 
TEST=run capture_unittests on kevin
TEST=run capture_unittests with another fix in chromium:881300
     on amd64-generic VM

Change-Id: I3a9ec8b781675b05f6a98d0221ae9dbb0a9c4694
Reviewed-on: https://chromium-review.googlesource.com/1249469
Reviewed-by: Christian Fremerey <chfremer@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595481}
[modify] https://crrev.com/a49cac786f142bd2d6b2ad9408fc21fec267e724/media/capture/video/video_capture_device_unittest.cc

Project Member

Comment 10 by bugdroid1@chromium.org, Oct 15

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

commit 62d2bd99255082967be127282cd2ecc0ce5fcc7e
Author: Shik Chen <shik@chromium.org>
Date: Mon Oct 15 17:22:30 2018

[Video Capture, Chrome OS] Wait until vivid is detected in ChromeOS VM

BUG= chromium:881300 ,chromium:852302
TEST=Pass capture_unittests with/without vivid enabled on amd64-generic
     VM, and verify vivid is used when it's enabled.
TEST=Pass capture_unittests on teemo (a Chromebox), and verify it
     doesn't wait for camera.

Change-Id: I2a11a848639eba426daa4db2f8d22b90c01e08b9
Reviewed-on: https://chromium-review.googlesource.com/c/1260806
Reviewed-by: Ricky Liang <jcliang@chromium.org>
Reviewed-by: Christian Fremerey <chfremer@chromium.org>
Commit-Queue: Shik Chen <shik@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599658}
[modify] https://crrev.com/62d2bd99255082967be127282cd2ecc0ce5fcc7e/media/capture/video/chromeos/camera_hal_delegate.cc
[modify] https://crrev.com/62d2bd99255082967be127282cd2ecc0ce5fcc7e/media/capture/video/chromeos/camera_hal_delegate.h

Status: Fixed (was: Started)
Status: Started (was: Fixed)
Reopened this issue, because capture_unittests fails with vivid on VM for test cases that require the frame size 1280x720:
https://ci.chromium.org/p/chromium/builders/luci.chromium.try/chromeos-amd64-generic-rel/110955

The cause should be that vivid started to use 12.5FPS for 1280x720 by crrev.com/c/1270698.
Camera HAL has a problem for handling floating point FPSs.

Shik already created a CL for fixing this problem
crrev.com/c/1286024

Project Member

Comment 13 by bugdroid1@chromium.org, Oct 18

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/arc-camera/+/93ec054211ddbdce6e1221c7bc3be87b57f1ed29

commit 93ec054211ddbdce6e1221c7bc3be87b57f1ed29
Author: Shik Chen <shik@chromium.org>
Date: Thu Oct 18 13:16:22 2018

usb: fix StreamOn for non integer fps

BUG=chromium:852302, chromium:881300 
TEST=Run capture_unittests with vivid on VM, which uses 1280x720 in 12.5
     fps.

Change-Id: I76f09c4a9a5de0b1cb2bf43c3a4184446e678bfc
Reviewed-on: https://chromium-review.googlesource.com/1286024
Commit-Ready: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Heng-ruey Hsu <henryhsu@chromium.org>

[modify] https://crrev.com/93ec054211ddbdce6e1221c7bc3be87b57f1ed29/hal/usb/v4l2_camera_device.cc

Status: Fixed (was: Started)

Sign in to add a comment