bytedeco / javacv

Java interface to OpenCV, FFmpeg, and more
Other
7.39k stars 1.56k forks source link

Using the FFmpegFrameGrabber.start() method, one thread is blocked。 #2200

Open Aismy opened 4 months ago

Aismy commented 4 months ago

You can see that one thread is blocked in the avformat_open_input method after entering the start() method, causing other threads to be unable to acquire the lock to process all the BLOCKED states.

"media-87" #217 prio=5 os_prio=0 cpu=2532193.98ms elapsed=3003.56s tid=0x00007fd42c003000 nid=0x366c08 runnable [0x00007fd21c66e000] java.lang.Thread.State: RUNNABLE at org.bytedeco.ffmpeg.global.avformat.avformat_open_input(Native Method) at org.bytedeco.javacv.FFmpegFrameGrabber.startUnsafe(FFmpegFrameGrabber.java:972)

"media-92" #222 prio=5 os_prio=0 cpu=68.47ms elapsed=2963.55s tid=0x00007fd320003000 nid=0x36762f waiting for monitor entry [0x00007fd21c16e000] java.lang.Thread.State: BLOCKED (on object monitor) at org.bytedeco.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:902)

this is my code: FFmpegFrameGrabber grabber = new FFmpegFrameGrabber("http://xxxxx"); grabber.start();

saudet commented 4 months ago

Please try to call startUnsafe() instead of start().

Aismy commented 3 months ago

startUnsafe() will also acquire the lock ah, my method is blocked in the startUnsafe() method inside ah, and blocked for several days!

Aismy commented 3 months ago

Now blocking at avformat_open_input() in startUnsafe()

saudet commented 3 months ago

Make sure to set a timeout value