From c790299906ca4af7c94ef8a289a8c76849468afb Mon Sep 17 00:00:00 2001 From: Eugene Mikhantiev Date: Wed, 7 Mar 2018 17:26:34 +0700 Subject: [PATCH] Fix return code in case of timeout --- modules/videoio/src/cap_v4l.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/videoio/src/cap_v4l.cpp b/modules/videoio/src/cap_v4l.cpp index 700a7a706b..e0db6f1ae9 100644 --- a/modules/videoio/src/cap_v4l.cpp +++ b/modules/videoio/src/cap_v4l.cpp @@ -911,7 +911,7 @@ static int mainloop_v4l2(CvCaptureCAM_V4L* capture) { if(returnCode == -1) return -1; if(returnCode == 1) - break; + return 1; } } return 0; @@ -956,7 +956,7 @@ static bool icvGrabFrameCAM_V4L(CvCaptureCAM_V4L* capture) { #if defined(V4L_ABORT_BADJPEG) // skip first frame. it is often bad -- this is unnotied in traditional apps, // but could be fatal if bad jpeg is enabled - if(mainloop_v4l2(capture) == -1) + if(mainloop_v4l2(capture) != 1) return false; #endif @@ -964,7 +964,7 @@ static bool icvGrabFrameCAM_V4L(CvCaptureCAM_V4L* capture) { capture->FirstCapture = 0; } - if(mainloop_v4l2(capture) == -1) return false; + if(mainloop_v4l2(capture) != 1) return false; return true; }