android: Check if Stream configurations were generated correctly
The libcamera Android Camera HAL generates camera configurations for the StillCapture, Raw and ViewFinder stream roles. But there is only a check if the configuration generation failed, for the StillCapture stream role. This could lead to a NULL pointer dereference if a pipeline handler fails to generate a default configuration for one of the other two stream roles. Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
828f0d97be
commit
0ce723fc8b
1 changed files with 12 additions and 1 deletions
|
@ -408,6 +408,11 @@ CameraCapabilities::initializeYUVResolutions(const PixelFormat &pixelFormat,
|
|||
std::vector<Size> supportedResolutions;
|
||||
std::unique_ptr<CameraConfiguration> cameraConfig =
|
||||
camera_->generateConfiguration({ StreamRole::Viewfinder });
|
||||
if (!cameraConfig) {
|
||||
LOG(HAL, Error) << "Failed to get supported YUV resolutions";
|
||||
return supportedResolutions;
|
||||
}
|
||||
|
||||
StreamConfiguration &cfg = cameraConfig->at(0);
|
||||
|
||||
for (const Size &res : resolutions) {
|
||||
|
@ -431,11 +436,17 @@ CameraCapabilities::initializeYUVResolutions(const PixelFormat &pixelFormat,
|
|||
std::vector<Size>
|
||||
CameraCapabilities::initializeRawResolutions(const PixelFormat &pixelFormat)
|
||||
{
|
||||
std::vector<Size> supportedResolutions;
|
||||
std::unique_ptr<CameraConfiguration> cameraConfig =
|
||||
camera_->generateConfiguration({ StreamRole::Raw });
|
||||
if (!cameraConfig) {
|
||||
LOG(HAL, Error) << "Failed to get supported Raw resolutions";
|
||||
return supportedResolutions;
|
||||
}
|
||||
|
||||
StreamConfiguration &cfg = cameraConfig->at(0);
|
||||
const StreamFormats &formats = cfg.formats();
|
||||
std::vector<Size> supportedResolutions = formats.sizes(pixelFormat);
|
||||
supportedResolutions = formats.sizes(pixelFormat);
|
||||
|
||||
return supportedResolutions;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue