apps: qcam: Push the viewfinder role to vector

In commit ee2b011b65 ("apps: cam: Try raw role if default viewfinder
role fails"), the viewfinder role is specified as the default if no role
is yet chosen.

This was unfortunately added by directly accessing the vector rather
than extending the size when the vector is empty. Fix the code to push
the default viewfinder role on to the back of the vector, increasing the
size appropriately.

Fixes: ee2b011b65 ("apps: cam: Try raw role if default viewfinder role fails")
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Tested-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Kieran Bingham 2025-05-07 23:06:48 +02:00
parent e0405b171e
commit a799415017

View file

@ -357,7 +357,7 @@ int MainWindow::startCapture()
/* Verify roles are supported. */ /* Verify roles are supported. */
switch (roles.size()) { switch (roles.size()) {
case 0: case 0:
roles[0] = StreamRole::Viewfinder; roles.push_back(StreamRole::Viewfinder);
break; break;
case 1: case 1:
if (roles[0] != StreamRole::Viewfinder) { if (roles[0] != StreamRole::Viewfinder) {