Amlogic grabber: fixup closing video device on each frame

This commit is contained in:
Portisch 2019-03-14 11:55:17 +01:00
parent 91054d8d70
commit 46cad16305

View File

@ -117,7 +117,11 @@ int AmlogicGrabber::grabFrame(Image<ColorRgb> & image)
} }
else if (_device == "amvideocap0") else if (_device == "amvideocap0")
{ {
grabFrame_amvideocap(image); if (grabFrame_amvideocap(image) < 0)
{
closeDev(_videoDev);
closeDev(_captureDev);
}
} }
} }
else else
@ -131,8 +135,6 @@ int AmlogicGrabber::grabFrame(Image<ColorRgb> & image)
_fbGrabber.grabFrame(image); _fbGrabber.grabFrame(image);
} }
closeDev(_videoDev);
return 0; return 0;
} }
@ -176,6 +178,7 @@ int AmlogicGrabber::grabFrame_amvideocap(Image<ColorRgb> & image)
// Read of snapshot failed // Read of snapshot failed
ErrorIf(_lastError != 4, _log,"Capture failed to grab entire image [bytesToRead(%d) != bytesRead(%d)]", _bytesToRead, bytesRead); ErrorIf(_lastError != 4, _log,"Capture failed to grab entire image [bytesToRead(%d) != bytesRead(%d)]", _bytesToRead, bytesRead);
closeDev(_captureDev); closeDev(_captureDev);
_lastError = 4;
return -1; return -1;
} }