Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 08 Aug 2019 20:36:09 +0200
From:      Jan Beich <jbeich@FreeBSD.org>
To:        Frederic Chardon <chardon.frederic@gmail.com>
Cc:        chromium@freebsd.org
Subject:   Re: No webcam in chrome (works in firefox)
Message-ID:  <o90z-tsh2-wny@FreeBSD.org>
In-Reply-To: <CAMODbkmYqnhq8cyHukBmttAEkrPE6xcVPrVgzgUN34BRGgMLqQ@mail.gmail.com> (Frederic Chardon's message of "Mon, 29 Jul 2019 22:46:51 %2B0200")
References:  <CAMODbkmYqnhq8cyHukBmttAEkrPE6xcVPrVgzgUN34BRGgMLqQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
(redirecting to a better list)

Frederic Chardon <chardon.frederic@gmail.com> writes:

> Hi
>
> I can't make chrome to recognize my webcam. webcamd is running, pwcview,
> firefox or mpv all works
> Ports are at revision 507476 and base at 350255 (amd64).
>
> There is no camera listed in chrome://media-internals and typing
> "navigator.mediaDevices.getUserMedia({video:true});" in the javascript
> console throw a NotFoundError.
>
> ktrace shows that open() succeed
>  83513 chrome   CALL  openat(AT_FDCWD,0x81812d101,0<O_RDONLY>)
>  83513 chrome   NAMI  "/dev/video0"
>  83513 chrome   RET   openat 159/0x9f
>  83513 chrome   CALL  ioctl(0x9f,0x40685600,0x7fffde9f2aa8)

0x40685600 is probably VIDIOC_QUERYCAP, used by Chromium in a number of places.
https://cs.chromium.org/search/?q=VIDIOC_QUERYCAP

Firefox also uses VIDIOC_QUERYCAP but doesn't seem to check capabilities.
https://searchfox.org/mozilla-central/search?q=VIDIOC_QUERYCAP

>  83513 chrome   RET   ioctl 0
>  83513 chrome   CALL  close(0x9f)
>  83513 chrome   RET   close 0
>
> So this is rather not a permission issue (and anyway, the other programs
> all work)

Can you show output from the following? I don't have a camera, so no
clue which capabilities Chromium wants.

$ cat a.c
#include <linux/videodev2.h>
#include <err.h>
#include <fcntl.h>

int main(void)
{
    int fd;
    if ((fd = open("/dev/video0", O_RDWR)) == -1)
	err(1, "failed to open /dev/video0");

    struct v4l2_capability cap = {};
    if (ioctl(fd, VIDIOC_QUERYCAP, &cap) == -1)
	err(1, "VIDIOC_QUERYCAP failed");

    warnx("/dev/video0 capabilities: %#x", cap.capabilities);
    if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE))
        warnx("V4L2_CAP_VIDEO_CAPTURE is missing");
    if (cap.capabilities & V4L2_CAP_VIDEO_OUTPUT)
        warnx("V4L2_CAP_VIDEO_OUTPUT is present, not allowed for delegation");
    if (!(cap.capabilities & V4L2_CAP_STREAMING))
        warnx("V4L2_CAP_STREAMING is missing");
    if (!(cap.capabilities & V4L2_CAP_VIDEO_M2M_MPLANE))
        warnx("V4L2_CAP_VIDEO_M2M_MPLANE is missing, required for streaming");

    return 0;
}

$ pkg install v4l_compat
$ cc a.c -isystem/usr/local/include
$ ./a.out

>
> Is it a known issue? Or am I missing something?
> Thanks

Did previous www/chromium major versions work fine?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?o90z-tsh2-wny>