libcamera: Fix crash caused by reading uninitialised delayed controls

The cause is that we read out delayed values using a frame's sequence
number (DelayedControls::get). But we fill the values up
(DelayedControls::applyControls) incrementing writeCount by only one
even if the sequence number has jumped by several since last
time. This is exactly what happens when frames are being dropped.

So the fix is to increment writeCount by "as much as the sequence
number has jumped since last time", which means that we just follow
the sequence number directly.

Signed-off-by: David Plowman <>
Reviewed-by: Laurent Pinchart <>
Reviewed-by: Naushir Patuck <>
Tested-by: Naushir Patuck <>
Tested-by: Jacopo Mondi <>
Reviewed-by: Jacopo Mondi <>
Signed-off-by: Laurent Pinchart <>
1 file changed