Files
BPI-M2C/imx258-oemut-preview-dump-robustness-20260921.patch
T

75 lines
2.0 KiB
Diff
Raw Normal View History

2026-09-22 09:38:26 +08:00
--- a/source_sync_rls_25c/source/unisoc/multimedia/camera/libcamera/UT/OemUnitTest/OemUnitTest.cpp
+++ b/source_sync_rls_25c/source/unisoc/multimedia/camera/libcamera/UT/OemUnitTest/OemUnitTest.cpp
@@ -303,6 +303,7 @@
int OemUnitTest::zslSnapshot() {
int ret = CMR_CAMERA_SUCCESS;
+ Sprd_camera_state preview_state = getPreviewState();
/*
* ZSL is disabled on the current single-camera SBC bring-up path. Keep the
@@ -317,18 +318,26 @@
mCaptureMode = CAMERA_NORMAL_MODE;
mSprdZslEnabled = false;
- if (!isPreviewing()) {
+ if (SPRD_IDLE == preview_state) {
ret = startPreview();
if (ret) {
CMR_LOGE("zslSnapshot: fail to start preview dump");
return ret;
}
+ } else {
+ printf("OemUnitTest zslSnapshot reuse preview state %s\n",
+ getCameraStateStr(preview_state));
}
usleep(1000 * 1000);
printf("OemUnitTest zslSnapshot preview-dump saved %d frame(s)\n",
camera_dump_cnt_pre);
+ if (camera_dump_cnt_pre <= 0) {
+ CMR_LOGE("zslSnapshot: no preview frame dumped");
+ return CMR_CAMERA_FAIL;
+ }
+
return CMR_CAMERA_SUCCESS;
}
@@ -369,6 +378,7 @@
int OemUnitTest::takePicture() {
int ret = CMR_CAMERA_SUCCESS;
+ Sprd_camera_state preview_state = getPreviewState();
/*
* SBC bring-up path: the normal snapshot/JPEG pipeline still depends on
@@ -389,18 +399,26 @@
mCaptureMode = CAMERA_NORMAL_MODE;
mSprdZslEnabled = false;
- if (!isPreviewing()) {
+ if (SPRD_IDLE == preview_state) {
ret = startPreview();
if (ret) {
CMR_LOGE("takePicture: fail to start preview dump");
return ret;
}
+ } else {
+ printf("OemUnitTest takePicture reuse preview state %s\n",
+ getCameraStateStr(preview_state));
}
usleep(1000 * 1000);
printf("OemUnitTest takePicture preview-dump saved %d frame(s)\n",
camera_dump_cnt_pre);
+ if (camera_dump_cnt_pre <= 0) {
+ CMR_LOGE("takePicture: no preview frame dumped");
+ return CMR_CAMERA_FAIL;
+ }
+
return CMR_CAMERA_SUCCESS;
}