Bug 245505 - www/chromium: chromium-80.0.3987.163_1 webcam works with fast green flicker
Summary: www/chromium: chromium-80.0.3987.163_1 webcam works with fast green flicker
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-chromium mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-10 15:00 UTC by Marcin Cieślak
Modified: 2020-05-27 12:59 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (chromium)


Attachments
chrome --enable-logging=stderr --v=1 'https://meet.jit.si/ChromiumTestForBSD' >/tmp/chrome.log 2>&1 (645.97 KB, text/plain)
2020-04-10 21:14 UTC, Marcin Cieślak
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcin Cieślak 2020-04-10 15:00:32 UTC
After https://reviews.freebsd.org/D24330 (related bug: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=245250) I get a fast green flicker on the webcam image when testing with https://meet.jit.si/ https://test.webrtc.org/ and https://zoom.us/

The video to demonstrate this: https://peertube.su/videos/watch/3c63d7be-a54a-400a-8dbd-dc09e493f2cf

There are no error messages in the Chromium window, except for DTLS-SRTP problem with Zoom:

[6747:101327:0410/165017.031144:ERROR:dtls_srtp_transport.cc(216)] No DTLS-SRTP selected crypto suite
[6747:101327:0410/165017.031341:ERROR:sctp_transport.cc(701)] SctpTransport->Connect(): Failed usrsctp_bind: [0x00000031] Can't assign requested address
[6747:101327:0410/165018.340507:ERROR:dtls_transport.cc(134)] DtlsTransport in connected state has incomplete TLS information

webcamd occasionally displays "uvcvideo: Failed to resubmit video URB (-6)."
(like once-twice per session)

# webcamd -d 3.2
IR NEC protocol handler initialized
IR RC5(x/sz) protocol handler initialized
IR RC6 protocol handler initialized
IR JVC protocol handler initialized
IR Sony protocol handler initialized
IR SANYO protocol handler initialized
IR XMP protocol handler initialized
b2c2-flexcop: B2C2 FlexcopII/II(b)/III digital TV receiver chip loaded successfully
USB Video Class driver (1.1.1)
cpia2: V4L-Driver for Vision CPiA2 based cameras v3.0.1
USBVision USB Video Device Driver for Linux : 0.9.11
Attached to ugen3.2[0]
uvcvideo: Found UVC 1.00 device  (05ca:18b0)
Creating /dev/video0
Creating /dev/video1
uvcvideo: Failed to resubmit video URB (-6).
uvcvideo: Failed to resubmit video URB (-6).
uvcvideo: Failed to resubmit video URB (-6).
uvcvideo: Failed to resubmit video URB (-6).

Webcam in question is

ugen3.2: <Ricoh co. Ltd. product 0x18b0> at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (100mA)

  idVendor = 0x05ca 
  idProduct = 0x18b0 
  bcdDevice = 0x0207 


Works very well and stable with firefox-74.0_5,1 (installed via pkg install)

OS:  FreeBSD 11.3-STABLE #0 r356413: Mon Jan  6 23:59:20 CET 2020

I don't know why both /dev/video0 and /dev/video1 are created. Firefox lets test.webrtc.org to choose one of them (by the way there is no device node name displayed, only ": Sony Visual Communication Cam"(era)
Comment 1 Conrad Meyer freebsd_committer 2020-04-10 15:34:20 UTC
Thanks.  Any chance you were running chromium with '--enable-logging=stderr --v=1'?  There might be additional logging information available (caution: I'd redirect it to a file, or else the browser will be quite slow).

Caveat: I know nothing about v4l, webcamd, etc.
Comment 2 Marcin Cieślak 2020-04-10 21:14:59 UTC
Created attachment 213264 [details]
chrome --enable-logging=stderr --v=1 'https://meet.jit.si/ChromiumTestForBSD' >/tmp/chrome.log 2>&1

Logfile - result from running chrome attached

chrome --enable-logging=stderr --v=1 'https://meet.jit.si/ChromiumTestForBSD' >/tmp/chrome.log 2>&1
Comment 3 Hans Petter Selasky freebsd_committer 2020-04-15 10:45:08 UTC
Comment on attachment 213264 [details]
chrome --enable-logging=stderr --v=1 'https://meet.jit.si/ChromiumTestForBSD' >/tmp/chrome.log 2>&1

Hi,

You need to track down this one:

[71549:101731:0410/231129.452139:WARNING:alsa_input.cc(176)] PcmAvailUpdate(): Broken pipe

Do you have a valid playback and recording device?
Comment 4 Hans Petter Selasky freebsd_committer 2020-04-15 10:55:02 UTC
Just tested https://meet.jit.si/ChromiumTestForBSD and the camera doesn't flicker here!
Comment 5 Hans Petter Selasky freebsd_committer 2020-04-15 10:57:11 UTC
Hi,

1) There is a new version of webcamd in ports.

Compile webcamd with debugging support and run it in the foreground. I will show more details for the bug.

2) There is a new version of lib V4L and friends.
   https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=245501

Chrome should use libv4l to get the picture!

CPU usage?

Ktrace?

--HPS
Comment 6 Hans Petter Selasky freebsd_committer 2020-04-15 10:58:33 UTC
I will note that hangouts is sometimes using a too-small audio buffer causing choppy audio. I'm not sure exactly where the problem is.
Comment 7 Hans Petter Selasky freebsd_committer 2020-04-15 11:00:45 UTC
WARNING pid 54996 (chrome): ioctl sign-extension ioctl ffffffffc0405602
WARNING pid 54996 (chrome): ioctl sign-extension ioctl ffffffffc0405602
WARNING pid 54996 (chrome): ioctl sign-extension ioctl ffffffffc0405602
WARNING pid 54996 (chrome): ioctl sign-extension ioctl ffffffffc02c564a
WARNING pid 54996 (chrome): ioctl sign-extension ioctl ffffffffc034564b

These look like V4L2 ioctls. This should be fixed!

Does chrome use own videodev2.h header file, or does it use the system one?

--HPS
Comment 8 Marcin Cieślak 2020-04-15 11:04:59 UTC
I have found out that other webcam:

ugen6.2: <vendor 0x046d product 0x08dd> at usbus6, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)

(Logitech Quickcam for Notebooks) works without green flicker even when connected to the FULL (12Mbps) port (the built-in Ricoh one is on spd=HIGH (480Mbps).

They use different webcamd drivers (Ricoh is UVC), any chance to figure out what Chrome is doing? Requesting webcam data too fast?
Comment 9 Marcin Cieślak 2020-04-15 11:09:04 UTC
Yes, I run webcamd compiled like this

===> The following configuration options are available for webcamd-5.3.7.1_1:
     COMPAT32=on: Enable 32-bit compatibility support
     DEBUG=on: Build with debugging support
     DVB=on: Build with USB DVB support (DVB-X, analog TV, ...)
     HAL=on: Build with HAL and DBUS support
     INPUT=on: Build with USB input support (tablet, joystick, HID, IR, ...)
     KEYBOARD=off: Build with USB keyboard support
     MOUSE=off: Build with USB mouse support
     RADIO=on: Build with USB radio support
     VT_CLIENT=off: Build with vTuner client support
     VT_SERVER=off: Build with vTuner server support
     WEBCAM=on: Build with USB webcam support (UVC, gspca, ...)
===> Use 'make config' to modify these settings


and I always run it in foreground with "webcamd -d ..." and the output is in this bug report.

Haven't tried ktrace yet.

Chrome bundles the headers but this might a bug in the chromium code that uses the ioctls. They have some fancy macros for this.
Comment 10 Hans Petter Selasky freebsd_committer 2020-04-15 11:12:07 UTC
Try to get some info from webcamd compiled with debug enabled.

It all boils down to the V4L2 ioctls.

work/chromium-81.0.4044.92/third_party/ffmpeg/doc/indevs.texi:@code{--enable-libv4l2} configure option), it is possible to use it with the
work/chromium-81.0.4044.92/third_party/ffmpeg/doc/indevs.texi:@code{-use_libv4l2} input device option.
work/chromium-81.0.4044.92/third_party/ffmpeg/doc/indevs.texi:@item use_libv4l2
work/chromium-81.0.4044.92/third_party/ffmpeg/doc/indevs.texi:Use libv4l2 (v4l-utils) conversion functions. Default is 0.
work/chromium-81.0.4044.92/third_party/ffmpeg/Changelog:- libv4l2 support (--enable-libv4l2)

--HPS
Comment 11 Hans Petter Selasky freebsd_committer 2020-04-15 11:17:19 UTC
(In reply to Hans Petter Selasky from comment #7)

The kernel will truncate the command argument, so its fine:

         if (uap->com > 0xffffffff) {
                printf(
                    "WARNING pid %d (%s): ioctl sign-extension ioctl %lx\n",
                    td->td_proc->p_pid, td->td_name, uap->com);
                uap->com &= 0xffffffff;
        }
        com = uap->com;

But the printf() is annoying.

--HPS
Comment 12 Hans Petter Selasky freebsd_committer 2020-04-15 11:19:12 UTC
Do these errors also happen using the latest 5.7.1.0 version of webcamd:

uvcvideo: Failed to resubmit video URB (-6).
uvcvideo: Failed to resubmit video URB (-6).
uvcvideo: Failed to resubmit video URB (-6).
uvcvideo: Failed to resubmit video URB (-6).

--HPS
Comment 13 Marcin Cieślak 2020-04-15 19:33:18 UTC
To sum up the troubleshooting we did with Hans Petter (thanks!)

webcamd has been updated to the newest 5.7.0.1 (same symptoms)

USB protocol dump produced with chromium (with flicker)

https://gist.github.com/saper/cadb3d423e86e840dde0ef452cd8b636

USB protocol dump produced with vlc v4l2:///dev/video0 (without flicker)

https://gist.github.com/saper/8ad8988d4ec6a8903bc9477c9b524658

I'll have a look at raw video data returned from the webcam
Comment 14 Marcin Cieślak 2020-04-15 23:32:16 UTC
Full config descriptor:

ugen3.2: <Ricoh co. Ltd. product 0x18b0> at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (100mA)


 Configuration index 0

    bLength = 0x0009 
    bDescriptorType = 0x0002 
    wTotalLength = 0x015d 
    bNumInterfaces = 0x0002 
    bConfigurationValue = 0x0001 
    iConfiguration = 0x0000  <no string>
    bmAttributes = 0x0080 
    bMaxPower = 0x0032 

    Additional Descriptor

    bLength = 0x08
    bDescriptorType = 0x0b
    bDescriptorSubType = 0x00
     RAW dump: 
     0x00 | 0x08, 0x0b, 0x00, 0x02, 0x0e, 0x03, 0x00, 0x02


    Interface 0
      bLength = 0x0009 
      bDescriptorType = 0x0004 
      bInterfaceNumber = 0x0000 
      bAlternateSetting = 0x0000 
      bNumEndpoints = 0x0001 
      bInterfaceClass = 0x000e  <Video device>
      bInterfaceSubClass = 0x0001 
      bInterfaceProtocol = 0x0000 
      iInterface = 0x0002  <Sony Visual Communication Camera>

      Additional Descriptor

      bLength = 0x0d
      bDescriptorType = 0x24
      bDescriptorSubType = 0x01
       RAW dump: 
       0x00 | 0x0d, 0x24, 0x01, 0x00, 0x01, 0x4d, 0x00, 0x00, 
       0x08 | 0x36, 0x6e, 0x01, 0x01, 0x01


      Additional Descriptor

      bLength = 0x12
      bDescriptorType = 0x24
      bDescriptorSubType = 0x02
       RAW dump: 
       0x00 | 0x12, 0x24, 0x02, 0x01, 0x01, 0x02, 0x03, 0x00, 
       0x08 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 
       0x10 | 0x00, 0x00


      Additional Descriptor

      bLength = 0x0b
      bDescriptorType = 0x24
      bDescriptorSubType = 0x05
       RAW dump: 
       0x00 | 0x0b, 0x24, 0x05, 0x02, 0x01, 0x00, 0x00, 0x02, 
       0x08 | 0x7f, 0x15, 0x00


      Additional Descriptor

      bLength = 0x1a
      bDescriptorType = 0x24
      bDescriptorSubType = 0x06
       RAW dump: 
       0x00 | 0x1a, 0x24, 0x06, 0x04, 0x10, 0x62, 0x41, 0x44, 
       0x08 | 0x89, 0x89, 0x46, 0x43, 0xaf, 0xb3, 0x20, 0xf3, 
       0x10 | 0x75, 0x90, 0x30, 0x4e, 0x01, 0x01, 0x02, 0x01, 
       0x18 | 0x01, 0x00


      Additional Descriptor

      bLength = 0x09
      bDescriptorType = 0x24
      bDescriptorSubType = 0x03
       RAW dump: 
       0x00 | 0x09, 0x24, 0x03, 0x03, 0x01, 0x01, 0x01, 0x04, 
       0x08 | 0x00

     Endpoint 0
        bLength = 0x0007 
        bDescriptorType = 0x0005 
        bEndpointAddress = 0x0081  <IN>
        bmAttributes = 0x0003  <INTERRUPT>
        wMaxPacketSize = 0x0040 
        bInterval = 0x0010 
        bRefresh = 0x0000 
        bSynchAddress = 0x0000 

      Additional Descriptor

      bLength = 0x05
      bDescriptorType = 0x25
      bDescriptorSubType = 0x03
       RAW dump: 
       0x00 | 0x05, 0x25, 0x03, 0x10, 0x00



    Interface 1
      bLength = 0x0009 
      bDescriptorType = 0x0004 
      bInterfaceNumber = 0x0001 
      bAlternateSetting = 0x0000 
      bNumEndpoints = 0x0000 
      bInterfaceClass = 0x000e  <Video device>
      bInterfaceSubClass = 0x0002 
      bInterfaceProtocol = 0x0000 
      iInterface = 0x0000  <no string>

      Additional Descriptor

      bLength = 0x0e
      bDescriptorType = 0x24
      bDescriptorSubType = 0x01
       RAW dump: 
       0x00 | 0x0e, 0x24, 0x01, 0x01, 0xa1, 0x00, 0x82, 0x01, 
       0x08 | 0x03, 0x01, 0x00, 0x00, 0x01, 0x00


      Additional Descriptor

      bLength = 0x1b
      bDescriptorType = 0x24
      bDescriptorSubType = 0x04
       RAW dump: 
       0x00 | 0x1b, 0x24, 0x04, 0x01, 0x04, 0x59, 0x55, 0x59, 
       0x08 | 0x32, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 
       0x10 | 0xaa, 0x00, 0x38, 0x9b, 0x71, 0x10, 0x01, 0x00, 
       0x18 | 0x00, 0x02, 0x00


      Additional Descriptor

      bLength = 0x1e
      bDescriptorType = 0x24
      bDescriptorSubType = 0x05
       RAW dump: 
       0x00 | 0x1e, 0x24, 0x05, 0x01, 0x01, 0x80, 0x02, 0xe0, 
       0x08 | 0x01, 0x00, 0x00, 0xca, 0x08, 0x00, 0x00, 0xca, 
       0x10 | 0x08, 0x00, 0x60, 0x09, 0x00, 0x2a, 0x2c, 0x0a, 
       0x18 | 0x00, 0x01, 0x2a, 0x2c, 0x0a, 0x00


      Additional Descriptor

      bLength = 0x1e
      bDescriptorType = 0x24
      bDescriptorSubType = 0x05
       RAW dump: 
       0x00 | 0x1e, 0x24, 0x05, 0x02, 0x01, 0x40, 0x01, 0xf0, 
       0x08 | 0x00, 0x00, 0x80, 0x32, 0x02, 0x00, 0x80, 0x32, 
       0x10 | 0x02, 0x00, 0x58, 0x02, 0x00, 0x15, 0x16, 0x05, 
       0x18 | 0x00, 0x01, 0x15, 0x16, 0x05, 0x00


      Additional Descriptor

      bLength = 0x1e
      bDescriptorType = 0x24
      bDescriptorSubType = 0x05
       RAW dump: 
       0x00 | 0x1e, 0x24, 0x05, 0x03, 0x01, 0xb0, 0x00, 0x90, 
       0x08 | 0x00, 0x00, 0xa0, 0xb9, 0x00, 0x00, 0xa0, 0xb9, 
       0x10 | 0x00, 0x00, 0xc6, 0x00, 0x00, 0x15, 0x16, 0x05, 
       0x18 | 0x00, 0x01, 0x15, 0x16, 0x05, 0x00


      Additional Descriptor

      bLength = 0x1e
      bDescriptorType = 0x24
      bDescriptorSubType = 0x05
       RAW dump: 
       0x00 | 0x1e, 0x24, 0x05, 0x04, 0x01, 0xa0, 0x00, 0x78, 
       0x08 | 0x00, 0x00, 0xa0, 0x8c, 0x00, 0x00, 0xa0, 0x8c, 
       0x10 | 0x00, 0x00, 0x96, 0x00, 0x00, 0x15, 0x16, 0x05, 
       0x18 | 0x00, 0x01, 0x15, 0x16, 0x05, 0x00



    Interface 1 Alt 1
      bLength = 0x0009 
      bDescriptorType = 0x0004 
      bInterfaceNumber = 0x0001 
      bAlternateSetting = 0x0001 
      bNumEndpoints = 0x0001 
      bInterfaceClass = 0x000e  <Video device>
      bInterfaceSubClass = 0x0002 
      bInterfaceProtocol = 0x0000 
      iInterface = 0x0000  <no string>

     Endpoint 0
        bLength = 0x0007 
        bDescriptorType = 0x0005 
        bEndpointAddress = 0x0082  <IN>
        bmAttributes = 0x0005  <ASYNC-ISOCHRONOUS>
        wMaxPacketSize = 0x13d4 
        bInterval = 0x0001 
        bRefresh = 0x0000 
        bSynchAddress = 0x0000 


    Interface 1 Alt 2
      bLength = 0x0009 
      bDescriptorType = 0x0004 
      bInterfaceNumber = 0x0001 
      bAlternateSetting = 0x0002 
      bNumEndpoints = 0x0001 
      bInterfaceClass = 0x000e  <Video device>
      bInterfaceSubClass = 0x0002 
      bInterfaceProtocol = 0x0000 
      iInterface = 0x0000  <no string>

     Endpoint 0
        bLength = 0x0007 
        bDescriptorType = 0x0005 
        bEndpointAddress = 0x0082  <IN>
        bmAttributes = 0x0005  <ASYNC-ISOCHRONOUS>
        wMaxPacketSize = 0x03c8 
        bInterval = 0x0001 
        bRefresh = 0x0000 
        bSynchAddress = 0x0000 


    Interface 1 Alt 3
      bLength = 0x0009 
      bDescriptorType = 0x0004 
      bInterfaceNumber = 0x0001 
      bAlternateSetting = 0x0003 
      bNumEndpoints = 0x0001 
      bInterfaceClass = 0x000e  <Video device>
      bInterfaceSubClass = 0x0002 
      bInterfaceProtocol = 0x0000 
      iInterface = 0x0000  <no string>

     Endpoint 0
        bLength = 0x0007 
        bDescriptorType = 0x0005 
        bEndpointAddress = 0x0082  <IN>
        bmAttributes = 0x0005  <ASYNC-ISOCHRONOUS>
        wMaxPacketSize = 0x0278 
        bInterval = 0x0001 
        bRefresh = 0x0000 
        bSynchAddress = 0x0000 


    Interface 1 Alt 4
      bLength = 0x0009 
      bDescriptorType = 0x0004 
      bInterfaceNumber = 0x0001 
      bAlternateSetting = 0x0004 
      bNumEndpoints = 0x0001 
      bInterfaceClass = 0x000e  <Video device>
      bInterfaceSubClass = 0x0002 
      bInterfaceProtocol = 0x0000 
      iInterface = 0x0000  <no string>

     Endpoint 0
        bLength = 0x0007 
        bDescriptorType = 0x0005 
        bEndpointAddress = 0x0082  <IN>
        bmAttributes = 0x0005  <ASYNC-ISOCHRONOUS>
        wMaxPacketSize = 0x0320 
        bInterval = 0x0001 
        bRefresh = 0x0000 
        bSynchAddress = 0x0000 




I did dump the incoming stream for both vlc and chrome using

$ sudo usbdump -i usbus3 -s 0 -f 2.130 -v -b chrome.dump

vlc stream starts like this:

00000000  0c 8c db 99 0e 1c ce d4  59 1c 41 04 32 71 33 90  |........Y.A.2q3.|
00000010  33 6b 32 8f 34 6a 33 8d  33 6a 33 8d 35 6d 36 8d  |3k2.4j3.3j3.5m6.|
00000020  35 75 36 8d 36 75 36 8d  37 75 37 8b 36 75 37 8a  |5u6.6u6.7u7.6u7.|
00000030  38 77 39 88 3d 79 3d 88  3e 7b 3e 88 3e 7a 41 88  |8w9.=y=.>{>.>zA.|
00000040  43 73 44 88 46 73 42 88  3f 75 3f 8d 3c 77 38 8d  |CsD.FsB.?u?.<w8.|
00000050  43 75 44 89 46 70 45 86  46 70 46 86 48 6f 47 87  |CuD.FpE.FpF.HoG.|


chrome stream starts like this:

00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
0000fca0  00 00 00 00 00 00 00 00  0c 8d 5b bc 39 25 7c 6b  |..........[.9%|k|
0000fcb0  c8 25 9a 03 31 7f 31 84  32 7b 32 84 33 7d 34 84  |.%..1.1.2{2.3}4.|
0000fcc0  36 7d 39 80 3a 7e 3a 7c  39 80 39 7c 3a 7e 34 7e  |6}9.:~:|9.9|:~4~|
0000fcd0  3a 7b 39 7f 3a 7a 3c 81  3b 79 3c 82 3d 73 3c 83  |:{9.:z<.;y<.=s<.|
0000fce0  3c 73 3d 82 3f 73 40 81  42 78 43 80 43 7e 42 81  |<s=.?s@.BxC.C~B.|
0000fcf0  45 7e 47 81 47 7a 45 81  45 79 46 80 45 82 3c 82  |E~G.GzE.EyF.E.<.|
0000fd00  4c 82 47 83 48 78 48 82  4a 78 4a 81 4b 81 4d 81  |L.G.HxH.JxJ.K.M.|
0000fd10  4c 82 4c 81 4c 81 4b 82  47 81 48 83 49 7d 49 82  |L.L.L.K.G.H.I}I.|
0000fd20  4a 7c 49 81 49 78 48 81  47 76 46 82 41 74 40 7d  |J|I.IxH.GvF.At@}|
0000fd30  3f 77 3e 7d 3f 77 3f 7d  40 83 40 7d 40 86 41 7c  |?w>}?w?}@.@}@.A||
0000fd40  3f 86 3f 7e 3e 83 3d 83  3e 78 3e 84 3f 77 3e 80  |?.?~>.=.>x>.?w>.|



I think both look like uncompressed streams, probably "YUY2" if I decode the interface description correctly...