-rw-r--r-- | v3/EmulatedCameraFactory.cpp | 14 | ||||
-rw-r--r-- | v3/EmulatedFakeCamera3.cpp | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/v3/EmulatedCameraFactory.cpp b/v3/EmulatedCameraFactory.cpp index ca77151..42569fd 100644 --- a/v3/EmulatedCameraFactory.cpp +++ b/v3/EmulatedCameraFactory.cpp @@ -303,6 +303,7 @@ int EmulatedCameraFactory::get_number_of_cameras(void) break; } } else { + DBG_LOGB("%s : cam is NULL", __FUNCTION__); break; } } @@ -483,6 +484,7 @@ void EmulatedCameraFactory::onStatusChanged(int cameraId, int newStatus) char dev_name[128]; int i = 0 , j = 0; int m = 0, n = 0; + int k = 0; //EmulatedBaseCamera *cam = mEmulatedCameras[cameraId]; const camera_module_callbacks_t* cb = mCallbacks; sprintf(dev_name, "%s%d", "/dev/video", cameraId); @@ -504,6 +506,18 @@ void EmulatedCameraFactory::onStatusChanged(int cameraId, int newStatus) if (mEmulatedCameras[cameraId] != NULL && (!mEmulatedCameras[cameraId]->getHotplugStatus())) { DBG_LOGA("close EmulatedFakeCamera3 object for the last time"); + while (k < 150) { + if (!(mEmulatedCameras[cameraId]->getCameraStatus())) { + usleep(10000); + k++; + } else { + break; + } + } + if (k == 150) { + DBG_LOGA("wait 1s, but camera still not closed , it's abnormal status.\n"); + return; + } delete mEmulatedCameras[cameraId]; mEmulatedCameras[cameraId] = NULL; } |