I’m using Unity 5.5.0xb5Linux on Ubuntu 16.10. It seems that there’s a problem in closing the webcam device in Linux editors. In the both of the following cases, webcam will be left in an unstable state which can’t be opened anymore.
Case I:
Using WebCamTexture, everything works fine but when I run and stop the game multiple times, suddenly it says that webcam can’t be open. (also other programs can’t open it like cheese on Ubuntu)
Case II:
Creating a native plugin which uses OpenCV’s VideoCapture to open the webcam and sends back frame data in a byte array. I tested my plugin (.so file) with other programs, and it works pretty fine. For instance, I’ve created a Qt app which uses my native plugin to show the webcam preview. But in Unity Editor, only the first time my plugin works correctly and other times it tells that it couldn’t open the camera.
When the camera is left unclosed, lsmod | grep uvcvideo shows 1, even though my webcam is off (its LED is off).