SDL: testcamera: use the first available cameras

From 948b16533c271421ab6a7689e37aef5892aeba2d Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 26 Dec 2024 19:23:24 -0800
Subject: [PATCH] testcamera: use the first available cameras

---
 test/testcamera.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/test/testcamera.c b/test/testcamera.c
index 3855b3b1aff8a..f9a826ee175db 100644
--- a/test/testcamera.c
+++ b/test/testcamera.c
@@ -118,10 +118,14 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
         const SDL_CameraPosition position = SDL_GetCameraPosition(device);
         const char *posstr = "";
         if (position == SDL_CAMERA_POSITION_FRONT_FACING) {
-            front_camera = device;
+            if (!front_camera) {
+                front_camera = device;
+            }
             posstr = "[front-facing] ";
         } else if (position == SDL_CAMERA_POSITION_BACK_FACING) {
-            back_camera = device;
+            if (!back_camera) {
+                back_camera = device;
+            }
             posstr = "[back-facing] ";
         }
         if (camera_name && SDL_strcasecmp(name, camera_name) == 0) {