sendFrames method
override
Reads a frame from the camera and sends it to the dashboard.
Checks for multiple errors along the way:
- If the camera does not respond, alerts the dashboard
- If the frame is too large, reduces the quality (increases JPG compression)
- If the quality is already low, alerts the dashboard
Implementation
@override
void sendFrames() {
final matrix = camera.getFrame();
if (matrix == nullptr) return;
// detectAndAnnotateFrames(matrix);
final frame = encodeJpg(matrix, quality: details.quality);
matrix.dispose();
if (frame == null) { // Error getting the frame
sendLog(LogLevel.warning, "Camera $name didn't respond");
updateDetails(CameraDetails(status: CameraStatus.CAMERA_NOT_RESPONDING));
return;
}
sendFrame(frame);
fpsCount++;
}