libcamera: pipeline: rpi: Do not set timestamps to 0 if unavailable

`SensorTimestamp` and `FrameWallClock` should always be available. However,
if that ever changes or they are not available for some unforeseen reason,
setting them to 0 is not ideal. That makes it more complicated for the
application to detect these cases (since they have to check the existence
either way), and if an application blindly assumes e.g. that `SensorTimestamp`
is monotonically increasing, then receiving a timestamp of 0 will likely
cause issues.

So simply omit them from the request metadata if they are not available.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
This commit is contained in:
Barnabás Pőcze 2025-07-10 15:53:09 +02:00
parent 8726316e58
commit 1ef8981c39

View file

@ -1487,10 +1487,10 @@ void CameraData::checkRequestCompleted()
void CameraData::fillRequestMetadata(const ControlList &bufferControls, Request *request)
{
request->metadata().set(controls::SensorTimestamp,
bufferControls.get(controls::SensorTimestamp).value_or(0));
request->metadata().set(controls::FrameWallClock,
bufferControls.get(controls::FrameWallClock).value_or(0));
if (auto x = bufferControls.get(controls::SensorTimestamp))
request->metadata().set(controls::SensorTimestamp, *x);
if (auto x = bufferControls.get(controls::FrameWallClock))
request->metadata().set(controls::FrameWallClock, *x);
if (cropParams_.size()) {
std::vector<Rectangle> crops;