Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

RSTP video stream freezes the program while connection is lost..

$
0
0
Helo, I have a fairly simple Java app which connects to few cameras through rstp stream, grabs the image and shows it in swing JFrame usnig OpenCV SwingWorker. My reconnect() method looks like this: public void reconnect(String address) { System.out.println("connecting..."); if (new ConnectionTester().pingHost(NETWORK_HOST, NETWORK_PORT, 50)) capturedVideo.open(address); // networkAddress System.out.println("Still running"); if (!capturedVideo.isOpened()) { System.out.println("Error while opening the camera!"); } } Because of a weak WiFi signal ( connection breaks) between the camera and my pc I sometimes get result like: connecting... Connection avaliable and the program hangs while performing capturedVideo.open(address); or on VideoCapture.read() method: if (isOpened) { capturedVideo.read(cameraMat); Is there any way to avoid such situations by maybe waiting a set amount of time before stopping everything and reconnect again ? Thanks!

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>