Skip to content

Commit

Permalink
pipeline: rpi: Fix invalid access to CameraData::sensorInfo_
Browse files Browse the repository at this point in the history
sensorInfo_ currently gets populated in configureIPA(), but is possibly
referenced in platformConfigure() which is called first. Fix this by
populating sensorInfo_ straight after configuring the sensor in
configure(), ensuring the fields are valid in the call to
platformConfigure().

Signed-off-by: Naushir Patuck <[email protected]>
  • Loading branch information
naushir committed Sep 6, 2024
1 parent 48fe316 commit 69a894c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/libcamera/pipeline/rpi/common/pipeline_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,13 @@ int PipelineHandlerBase::configure(Camera *camera, CameraConfiguration *config)
if (ret)
return ret;

/* We store the IPACameraSensorInfo for digital zoom calculations. */
ret = data->sensor_->sensorInfo(&data->sensorInfo_);
if (ret) {
LOG(RPI, Error) << "Failed to retrieve camera sensor info";
return ret;
}

/*
* Platform specific internal stream configuration. This also assigns
* external streams which get configured below.
Expand Down Expand Up @@ -1201,13 +1208,6 @@ int CameraData::configureIPA(const CameraConfiguration *config, ipa::RPi::Config
if (ret)
return ret;

/* We store the IPACameraSensorInfo for digital zoom calculations. */
ret = sensor_->sensorInfo(&sensorInfo_);
if (ret) {
LOG(RPI, Error) << "Failed to retrieve camera sensor info";
return ret;
}

/* Always send the user transform to the IPA. */
Transform transform = config->orientation / Orientation::Rotate0;
params.transform = static_cast<unsigned int>(transform);
Expand Down

1 comment on commit 69a894c

@oxivanisher
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this on my Rpi 4 64bit and it worked.

Please sign in to comment.