sarxos / webcam-capture

The goal of this project is to allow integrated or USB-connected webcams to be accessed directly from Java. Using provided libraries users are able to read camera images and detect motion. Main project consist of several sub projects - the root one, which contains required classes, build-in webcam driver compatible with Windows, Linux and Mac OS, which can stream images as fast as your camera can serve them (up to 50 FPS). Main project can be used standalone, but user is able to replace build-in driver with different one - such as OpenIMAJ, GStreamer, V4L4j, JMF, LTI-CIVIL, FMJ, etc.
http://webcam-capture.sarxos.pl
MIT License
2.26k stars 1.11k forks source link

Discovery process being interrupted on start #558

Open nik-tripp opened 6 years ago

nik-tripp commented 6 years ago

I am using Webcam with the DefaultDriver and attempting to write my own background thread that will search for webcams on a 1s timeout with a 2s thread.sleep in between each call to Webcam.getWebcams(1000).

My issue is this: the majority of the time, when the system is brought up after being powered down, hibernating, or sleeping, it completely fails to search. I get the following error log

ERROR 17:46:58,128 [webcam-discovery-service] (com.github.sarxos.webcam.ds.buildin.WebcamDefaultDriver$WebcamNewGrabberTask:newGrabber,47) - Processor has been interrupted

once every second. I have tried resetting the driver when this occurs, but that call just hangs the entire system.

nik-tripp commented 6 years ago

I fixed an issue with my code that was causing the apparent skip of the two second wait, but the issue remains: After restarting the terminal, everything to do with the discovery service appears to enter an infinite loop or get interrupted by the system, which is resolved if the software is killed and restarted, which is bad if one is trying to write, for example, a kiosk-based system.