Application hangs when RTSP stream breaks (Bug #235)


Added by grzesiek grz almost 15 years ago. Updated over 12 years ago.


Status:Done Start date:
Priority:High Due date:
Assignee:- % Done:

0%

Category:highgui-video
Target version:-
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

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


main.cpp (475 Bytes) grzesiek grz, 2010-03-28 12:35 pm


Associated revisions

Revision 24dcfa1a
Added by Vadim Pisarevsky almost 14 years ago

removed confusing CvCapture::queryFrame(); rewritten cvQueryFrame() (ticket #235)

Revision 48f19fba
Added by Andrey Kamaev about 12 years ago

Merge pull request #235 from asmorkalov:doc_manager_selection

Revision 77457907
Added by Vadim Pisarevsky about 10 years ago

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

Also available in: Atom PDF