javacv
javacv copied to clipboard
Using the FFmpegFrameGrabber.start() method, one thread is blocked。
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) - locked <0x00000005becf30f8> (a org.bytedeco.javacv.FFmpegFrameGrabber) at org.bytedeco.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:903) - locked <0x00000000807230b0> (a java.lang.Class for org.bytedeco.ffmpeg.global.avcodec) at org.bytedeco.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:898) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750)
"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) - waiting to lock <0x00000000807230b0> (a java.lang.Class for org.bytedeco.ffmpeg.global.avcodec) at org.bytedeco.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:898) at reactor.core.publisher.LambdaMonoSubscriber.onNext(LambdaMonoSubscriber.java:137) at reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:192) at reactor.core.publisher.FluxSubscribeOnValue$ScheduledScalar.run(FluxSubscribeOnValue.java:178) at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:50) at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:27) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750)
this is my code: FFmpegFrameGrabber grabber = new FFmpegFrameGrabber("http://xxxxx"); grabber.start();
Please try to call startUnsafe() instead of start().
startUnsafe() will also acquire the lock ah, my method is blocked in the startUnsafe() method inside ah, and blocked for several days!
Now blocking at avformat_open_input() in startUnsafe()
Make sure to set a timeout value