Application hangs when RTSP stream breaks (Bug #235)
Description
Hi !
It seems that there is a problem in cvQueryFrame(), cvGrabFrame() or supporting functions/modules.
When RTSP stream breaks (for ex. due to camera failure), application hangs - cvQueryFrame() does not return.
Proof on concept code (also attached):
#include <iostream> #include <sstream> #include <unistd.h> #include <opencv/cv.h> #include <opencv/highgui.h> [[CvCapture]] * capture; int count = 0; int main(){ capture = cvCreateFileCapture("rtsp://l:[email protected]"); for ( ; ; ) { [[IplImage]] * frame = cvQueryFrame(capture); std::cout << "tick " << count << std::endl; std::ostringstream name; name << count++ <<".jpg"; cvSaveImage((name.str()).c_str(), frame); usleep(50000); } return 0; }
This occur only when cvGrabFrame reaches last frame in cvCapture.
cvQueryFrame should return NULL in that case.
Regards,
Grzesiek22
Associated revisions
removed confusing CvCapture::queryFrame(); rewritten cvQueryFrame() (ticket #235)
Merge pull request #235 from asmorkalov:doc_manager_selection
Merge pull request #235 from jet47:cuda-imgproc-fixes
History
Updated by grzesiek grz almost 15 years ago
Of course camera connection should be broken during this example application execution.
Updated by grzesiek grz almost 15 years ago
Maybe someone has solution for this problem ? This is currently blocker in my application :/.
Thanks in advance !
Updated by anonymous - almost 15 years ago
Did you have tried with gstreamer backend?
Updated by grzesiek grz almost 15 years ago
Yes, gstreamer backend is enabled.
Updated by grzesiek grz over 14 years ago
This problem does not occur when using C++ class VideoCapture and '<<' operator for grabbing next frame.
Changing priority to minor. It would be nice if somebody confirmed this bug.
Updated by Vadim Pisarevsky almost 14 years ago
cvQueryFrame() rewritten to explicitly use Grab + Retrieve (r5243). So, once C++ works for you, C interface should now work too.
- Status changed from Open to Done
- (deleted custom field) set to fixed
Updated by Andrey Kamaev over 12 years ago
- Category changed from highgui-images to highgui-video