-
Notifications
You must be signed in to change notification settings - Fork 514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing VIDIOC_STREAMON may cause loss of V4L2_CAP_VIDEO_OUTPUT #470
Labels
needs triage
new issues
Comments
BenBE
added a commit
to BenBE/deepbacksub
that referenced
this issue
Apr 1, 2022
This ensures the opener of the fd in the kernel module is updated to be a WRITER. Failing to do so causes the video output capability to be lost when closing the fd. Cf. floe#133 Cf. umlaeute/v4l2loopback#470 Also this commit introduces a proper loopback_free function to release any resources and provide a central point for cleanup before closing the fd.
phlash
pushed a commit
to floe/backscrub
that referenced
this issue
Apr 3, 2022
This ensures the opener of the fd in the kernel module is updated to be a WRITER. Failing to do so causes the video output capability to be lost when closing the fd. Cf. #133 Cf. umlaeute/v4l2loopback#470 Also this commit introduces a proper loopback_free function to release any resources and provide a central point for cleanup before closing the fd.
phlash
pushed a commit
to floe/backscrub
that referenced
this issue
Apr 3, 2022
This ensures the opener of the fd in the kernel module is updated to be a WRITER. Failing to do so causes the video output capability to be lost when closing the fd. Cf. #133 Cf. umlaeute/v4l2loopback#470 Also this commit introduces a proper loopback_free function to release any resources and provide a central point for cleanup before closing the fd.
This was referenced Jun 22, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Step 1: Read this
Done.
Step 2: Describe your environment
v4l2loopback
version: 0.12.5 (dkms from distro:0.12.5-1ubuntu3
, also present onmain
in git [untested])Step 3: Describe the problem:
The v4l2loopback dev will loose its
V4L2_CAP_VIDEO_OUTPUT
when failing to do anioctl
with operationVIDIOC_STREAMON
before writing any frames.Steps to reproduce:
int fdwr = open(device, O_RDWR|O_CLOEXEC);
ret_code = ioctl(fdwr, VIDIOC_QUERYCAP, &vid_caps);
fdwr
close(fdwr);
Observed Results:
v4l2-ctl -D
is now missingV4L2_CAP_VIDEO_OUTPUT
EINVAL
Expected Results:
V4L2_CAP_VIDEO_OUTPUT
if it was removed during operation of the device (which it is inside thev4l2_loopback_write
handler AFAIC).ENOTTY
to force proper state transitions.Relevant Code:
Cf. https://github.com/floe/backscrub/blob/395ac39776e1c54f33d1b5d565834590caadd707/videoio/loopback.cc#L29-L82
Runs standalone if
-Dstandalone
is provided for compilation of that single file.Problem remarks:
Looking through the code I noticed that the driver leaves quite a bit of leeway for performing operations without proper pre-condition checks, like allowing to write frame data while not streaming, reading frames on an opener of type WRITER, writing on an opener of type READER, or starting streaming as WRITER, but closing things of as an READER. All those lax checks should be made much more strict to enforce arguments to be consistent with internal state and enforcing proper protocol (start streaming before writing actual frame data or at least updating the opener to be an WRITER when dropping the ready_for_output state as a consequence of the write operation).
The text was updated successfully, but these errors were encountered: