Merge pull request #544 from Portisch/amlogic_grabber_fixup

Amlogic grabber: fixup closing video device on each frame
This commit is contained in:
Rick164 2019-04-02 19:35:19 +02:00 committed by GitHub
commit ea0449778d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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;
} }