Open leifengfeng opened 11 months ago
Try to set a smaller timeout
tks. would you tell me the default value of timeout please?I found that it hangs on for hours when I did not set timeout option. now I have set timeout option to 2 seconds like this: grabber.setOption("rw_timeout", "2000000"); I will watch if it works. thanks again~
The default depends on the protocol that you're using: https://github.com/bytedeco/javacv/blob/master/samples/FFmpegStreamingTimeout.java
When ffmpeg reads rtsp image frames normally, the timeout attribute is set to 1 second, rw_timeout attribute is 500 milliseconds, then If there is a network connection issue and the disconnection time exceeds this threshold, the grabber can jump out and release resources. If the network recovers before this threshold, the grabber cannot jump out and release resources
it seems to happen at the moment that camera has been turned off suddenly.
the jstack command show this:
"192.168.0.100:554" #82 prio=5 os_prio=0 cpu=3774013.63ms elapsed=97735.35s tid=0x00007fc6040012f0 nid=0x36f312 runnable [0x00007fc8469fe000] java.lang.Thread.State: RUNNABLE at org.bytedeco.ffmpeg.global.avformat.av_read_frame(Native Method) at org.bytedeco.javacv.FFmpegFrameGrabber.grabFrame(FFmpegFrameGrabber.java:1421)