Skip to content

Commit c790299

Browse files
committed
Fix return code in case of timeout
1 parent 6ffc487 commit c790299

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

modules/videoio/src/cap_v4l.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ static int mainloop_v4l2(CvCaptureCAM_V4L* capture) {
911911
if(returnCode == -1)
912912
return -1;
913913
if(returnCode == 1)
914-
break;
914+
return 1;
915915
}
916916
}
917917
return 0;
@@ -956,15 +956,15 @@ static bool icvGrabFrameCAM_V4L(CvCaptureCAM_V4L* capture) {
956956
#if defined(V4L_ABORT_BADJPEG)
957957
// skip first frame. it is often bad -- this is unnotied in traditional apps,
958958
// but could be fatal if bad jpeg is enabled
959-
if(mainloop_v4l2(capture) == -1)
959+
if(mainloop_v4l2(capture) != 1)
960960
return false;
961961
#endif
962962

963963
/* preparation is ok */
964964
capture->FirstCapture = 0;
965965
}
966966

967-
if(mainloop_v4l2(capture) == -1) return false;
967+
if(mainloop_v4l2(capture) != 1) return false;
968968

969969
return true;
970970
}

0 commit comments

Comments
 (0)