cam: improve error checking when capturing

The return value when start() and stop() the camera should be checked
and handled.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Niklas Söderlund 2019-02-19 17:16:19 +01:00
parent 24cb563853
commit dd14f1ec2c

View file

@ -180,11 +180,18 @@ static int capture()
} }
std::cout << "Capture until user interrupts by SIGINT" << std::endl; std::cout << "Capture until user interrupts by SIGINT" << std::endl;
camera->start();
ret = camera->start();
if (ret) {
std::cout << "Failed to start capture" << std::endl;
goto out;
}
ret = loop->exec(); ret = loop->exec();
camera->stop(); ret = camera->stop();
if (ret)
std::cout << "Failed to stop capture" << std::endl;
out: out:
camera->freeBuffers(); camera->freeBuffers();