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.25k stars 1.11k forks source link

core dump on raspberry pi #588

Open jinyeluo opened 6 years ago

jinyeluo commented 6 years ago

I am trying to play with the latest code, 0.3.12-SNAPSHOT on the latest Raspberry Pi, with java 8_56 and experiencing a core dump. I would like to know if someone else is having the same problem, or it just happens to me.

Basically here is my code, and it crashes with a core dump :

     Webcam.setDriver(new V4l4jDriver());
     cam = Webcam.getDefault();
        cam.addWebcamListener(new WebcamListener() {
            public void webcamOpen(WebcamEvent aWebcamEvent) {
                System.out.println("open");
            }

            public void webcamClosed(WebcamEvent aWebcamEvent) {
                System.out.println("close");

            }

            public void webcamDisposed(WebcamEvent aWebcamEvent) {
                System.out.println("disposed");
            }

            public void webcamImageObtained(WebcamEvent aWebcamEvent) {
            }
        });

        WebcamMotionDetector detector = new WebcamMotionDetector(cam);
        detector.setInterval(5000); // one check per 500 ms
        detector.addMotionListener(this);
        detector.start();

I traced all the way to the method V4l4jDevice#getImage. Here is the method call that crashes and I am not able to trace deeper: BufferedImage exchange = exchanger.exchange(null, timeout, TimeUnit.SECONDS);

Looking at the error log, it seems failing on method (see the log file) "au.edu.jcu.v4l4j.BaseVideoFrame.prepareForDelivery".

Here is the error log file: hs_err_pid858.log

And here is the log printed on the screen:

 [main] DEBUG com.github.sarxos.webcam.Webcam - Setting new capture driver V4l4jDriver
get default
[webcam-discovery-service] DEBUG com.github.sarxos.webcam.ds.v4l4j.V4l4jDriver - Video file detected /dev/video0
[webcam-discovery-service] DEBUG com.github.sarxos.webcam.ds.v4l4j.V4l4jDevice - Creating V4L4J device from file /dev/video0
[ libvideo.c:68 ] Using libvideo version 0.9-UNKNOWN
[webcam-discovery-service] TRACE com.github.sarxos.webcam.ds.v4l4j.V4l4jDevice - Get video device info
[webcam-discovery-service] TRACE com.github.sarxos.webcam.ds.v4l4j.V4l4jDevice - Support BGR conversion true
[webcam-discovery-service] TRACE com.github.sarxos.webcam.ds.v4l4j.V4l4jDevice - Support JPG conversion true
[webcam-discovery-service] TRACE com.github.sarxos.webcam.ds.v4l4j.V4l4jDevice - Support RGB conversion true
[webcam-discovery-service] TRACE com.github.sarxos.webcam.ds.v4l4j.V4l4jDevice - Support YUV conversion true
[webcam-discovery-service] TRACE com.github.sarxos.webcam.ds.v4l4j.V4l4jDevice - Support YVU conversion true
[webcam-discovery-service] TRACE com.github.sarxos.webcam.ds.v4l4j.V4l4jDevice - Testing JPEG (DISCRETE)
[webcam-discovery-service] TRACE com.github.sarxos.webcam.ds.v4l4j.V4l4jDevice - Testing RGB24 (UNSUPPORTED)
[webcam-discovery-service] TRACE com.github.sarxos.webcam.ds.v4l4j.V4l4jDevice - Testing BGR24 (UNSUPPORTED)
[webcam-discovery-service] TRACE com.github.sarxos.webcam.ds.v4l4j.V4l4jDevice - Testing YUV420 (UNSUPPORTED)
[webcam-discovery-service] DEBUG com.github.sarxos.webcam.ds.v4l4j.V4l4jDevice - Best image format match JPEG - 49
[main] INFO com.github.sarxos.webcam.WebcamDiscoveryService - Discovery will not run - driver V4l4jDriver does not support this feature
get default done
[main] TRACE com.github.sarxos.webcam.WebcamLock - Lock timestamp 1511731173991 now 1511731247649 for Webcam /dev/video0
[main] DEBUG com.github.sarxos.webcam.WebcamLock - Lock Webcam /dev/video0
[main] INFO com.github.sarxos.webcam.WebcamTask - processor.process
[atomic-processor-1] INFO com.github.sarxos.webcam.ds.cgt.WebcamOpenTask - Opening webcam /dev/video0
[atomic-processor-1] DEBUG com.github.sarxos.webcam.ds.v4l4j.V4l4jDevice - Opening V4L4J device /dev/video0
[atomic-processor-1] DEBUG com.github.sarxos.webcam.ds.v4l4j.V4l4jDevice - Constructing V4L4J frame grabber
[atomic-processor-1] ERROR com.github.sarxos.webcam.ds.v4l4j.V4l4jDevice - Resolution mismatch 160x120 vs 320x240, setting new one
[atomic-processor-1] DEBUG com.github.sarxos.webcam.ds.v4l4j.V4l4jDevice - Starting V4L4J frame grabber
[atomic-processor-1] DEBUG com.github.sarxos.webcam.ds.v4l4j.V4l4jDevice - Webcam V4L4J is now open
[main] DEBUG com.github.sarxos.webcam.Webcam - Webcam is now open /dev/video0
open

= A fatal error has been detected by the Java Runtime Environment:

  SIGSEGV (0xb) at pc=0x7410a858, pid=913, tid=1680032880

 JRE version: Java(TM) SE Runtime Environment (8.0_65-b17) (build 1.8.0_65-b17)
 Java VM: Java HotSpot(TM) Client VM (25.65-b01 mixed mode linux-arm )
 Problematic frame:
 j  au.edu.jcu.v4l4j.BaseVideoFrame.prepareForDelivery(IIJJ)V+0

 Core dump written. Default location: /home/pi/learn/core or core.913

 An error report file with more information is saved as:
 /home/pi/learn/hs_err_pid913.log
[thread 1679377520 also had an error]

 If you would like to submit a bug report, please visit:
   http://bugreport.java.com/bugreport/crash.jsp

Aborted (core dumped)
sarxos commented 6 years ago

Yes. I also had some problems with V4L4J on RasPi :( It offers more possibilities when compared to default driver, but is somehow unstable...