Webcam cannot start after interrupted access with "VIDIOC_STREAMON: Invalid argument"

Bug #1518726 reported by Saren Taşçıyan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
v4l-utils (Ubuntu)
New
Undecided
Unassigned

Bug Description

Hi,

I am trying to make my first application in C++ with OpenCV, where I am trying to capture images from the built-in webcam on my Lenovo T450s. I use Eclipse CDT as my IDE to write code and debug. During several trials, sometimes I need to STOP running applications via Eclipse (probably through some interrupt signal). Whenever the application is interrupted, during the next run it cannot access the webcam and is returning
"VIDIOC_STREAMON: Invalid argument"

Apparently this is because resources are not released due to the interrupt. Also VLC cannot access webcam after I start seeing this error.

Apparently there are 1-2 reports about this issue related to OpenCV and kernel, and there is also a workaround by handling SIGINT properly and correctly exiting. I could not work that solution in Eclipse, because probably Eclipse STOP button does not send SIGINT but some other signal. Nevertheless, I was expecting kernel to handle this in another way, so that resources would be released automatically to allow other applications to access webcam.
However, webcam cannot be accessed after a program is interrupted.

lsb_release -rd
Description: Ubuntu 14.04.3 LTS
Release: 14.04

uname -r
3.13.0-68-generic

References:
http://answers.opencv.org/question/28929/acquiring-video-from-webcam-problems/
http://askubuntu.com/questions/683327/libv4l2-error-turning-on-stream-invalid-argument-vidioc-streamon-invalid-argu
https://lawlorcode.wordpress.com/2014/04/08/opencv-fix-for-v4l-vidioc_s_crop-error/
http://ubuntuforums.org/showthread.php?t=2298140

Please don't hesitate to ask for more information about the issue and correct me if my report isn't useful or sufficient.

Update: After further testing, I realized Eclipse is sending SIGTERM signal, which if handled does not cause above mentioned issue. However, a program may still crash or terminated without handling it properly. This should not cause any issue for other applications.

Tags: webcam
affects: xawtv (Ubuntu) → v4l-utils (Ubuntu)
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.