Comment 9 for bug 1946660

Revision history for this message
You-Sheng Yang (vicamo) wrote (last edit ):

The first open has:
```
[17047.368576] v4l2-loopback[1992]: opened dev:00000000c093a43d with image:0000000000000000
[17047.368577] /var/lib/dkms/v4l2loopback/0.12.5/build/v4l2loopback.c:1993[v4l2_loopback_open]
[17047.368582] video10: VIDIOC_QUERYCAP: driver=v4l2 loopback, card=OBS Video Source, bus=platform:v4l2loopback-000, version=0x00050f07, capabilities=0x
85200002, device_caps=0x05200002
```

The second open has:
```
[17091.427287] /var/lib/dkms/v4l2loopback/0.12.5/build/v4l2loopback.c:1964[v4l2_loopback_open]
[17091.427292] v4l2-loopback[1992]: opened dev:00000000c093a43d with image:0000000000000000
[17091.427293] /var/lib/dkms/v4l2loopback/0.12.5/build/v4l2loopback.c:1993[v4l2_loopback_open]
[17091.427297] video10: VIDIOC_QUERYCAP: driver=v4l2 loopback, card=OBS Video Source, bus=platform:v4l2loopback-000, version=0x00050f07, capabilities=0x85200000, device_caps=0x05200000
[17091.427304] video10: VIDIOC_G_FMT: error -22: type=vid-out, width=4294966992, height=4294967295, pixelformat=.... little-endian (0x00000000), field=any, bytesperline=1401200640, sizeimage=4288352138, colorspace=-744513136, flags=0xfffffed0, ycbcr_enc=0, quantization=0, xfer_func=0
```

As indicated in the capabilities field returned from the VIDIOC_QUERYCAP call, 0x85200000 means no V4L2_CAP_VIDEO_CAPTURE(0x01) neither V4L2_CAP_VIDEO_OUTPUT(0x02) is set. And since it reports neither, kernel `check_fmt` in "drivers/media/v4l2-core/v4l2-ioctl.c" will evaluate variable is_vid to false, and therefore returns -EINVAL at the next `VIDIOC_G_FMT` call with type=`V4L2_BUF_TYPE_VIDEO_OUTPUT`.

This is a direct result from https://github.com/umlaeute/v4l2loopback/commit/9a77eb6 merged in https://github.com/umlaeute/v4l2loopback/pull/415.