pipeline: rpi: ipa_base: Parse config files after platformRegister()

If a user uses a pipeline handler config file where a custom timeout
value is specified, it would lead to a segmentation fault when
loadPipelineConfiguration() tried to access the as yet uninitialised
V4L2VideoDevice object.

To fix this, parse the pipeline handler config file only after fully
initialising and registering the pipeline handler and V4L2VideoDevice
objects.

Fixes: 6c71ee1f15 ("pipeline: raspberrypi: Introduce PipelineHandlerBase class")
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Naushir Patuck 2023-05-23 13:02:08 +01:00 committed by Kieran Bingham
parent 7d5b38e2ef
commit 58f38082e1

View file

@ -888,16 +888,16 @@ int PipelineHandlerBase::registerCamera(std::unique_ptr<RPi::CameraData> &camera
} }
data->nativeBayerOrder_ = bayerFormat.order; data->nativeBayerOrder_ = bayerFormat.order;
ret = platformRegister(cameraData, frontend, backend);
if (ret)
return ret;
ret = data->loadPipelineConfiguration(); ret = data->loadPipelineConfiguration();
if (ret) { if (ret) {
LOG(RPI, Error) << "Unable to load pipeline configuration"; LOG(RPI, Error) << "Unable to load pipeline configuration";
return ret; return ret;
} }
ret = platformRegister(cameraData, frontend, backend);
if (ret)
return ret;
/* Setup the general IPA signal handlers. */ /* Setup the general IPA signal handlers. */
data->frontendDevice()->dequeueTimeout.connect(data, &RPi::CameraData::cameraTimeout); data->frontendDevice()->dequeueTimeout.connect(data, &RPi::CameraData::cameraTimeout);
data->frontendDevice()->frameStart.connect(data, &RPi::CameraData::frameStarted); data->frontendDevice()->frameStart.connect(data, &RPi::CameraData::frameStarted);