If I understand correctly your code, libcamera driver resolution is not updated with resolution update messages coming from indi server
Maybe adding/editing the following lines could help:
bool INDILibCamera::Connect()
{
try
{
...
// stillOptions->width = 1920;
// stillOptions->height = 1080;
// Get resolution from indi:ccd (whatever is settled when we are connecting), and update libcamera driver resolution
stillOptions->width = PrimaryCCD.getXRes();
stillOptions->height = PrimaryCCD.getYRes();
...
bool INDILibCamera::UpdateCCDFrame(int x, int y, int w, int h)
{
...
// Always set BINNED size
Streamer->setSize(subW, subH);
// Set libcamera resolution as defined in update message
auto stillOptions = m_StillApp->GetOptions();
stillOptions->width = w;
stillOptions->height = h;
...