hardware: samsung_slsi: libcamera2: Change ISP streamoff sequence
authorSungjoong Kang <sj3.kang@samsung.com>
Mon, 24 Sep 2012 08:48:33 +0000 (01:48 -0700)
committerThe Android Automerger <android-build@android.com>
Thu, 27 Sep 2012 01:42:33 +0000 (18:42 -0700)
To prevent memory-related crash, modified streamoff sequence.
After applying this patch, ISP streamoff will be called before
scaler streamoff.

Change-Id: I2cf7120a0bebb2341d07b256c42c975649f473f3
Signed-off-by: Sungjoong Kang <sj3.kang@samsung.com>
libcamera2/ExynosCameraHWInterface2.cpp

index 7177ad59ced28266b004feb27b1f4624c038509c..015832ea6c1e55aceb7c4c02a26784b91387def3 100644 (file)
@@ -2180,6 +2180,17 @@ int ExynosCameraHWInterface2::releaseStream(uint32_t stream_id)
         return 1;
     }
 
+    if (m_sensorThread != NULL) {
+        m_sensorThread->release();
+        ALOGD("(%s): START Waiting for (indirect) sensor thread termination", __FUNCTION__);
+        while (!m_sensorThread->IsTerminated())
+            usleep(10000);
+        ALOGD("(%s): END   Waiting for (indirect) sensor thread termination", __FUNCTION__);
+    }
+    else {
+        ALOGE("+++++++ sensor thread is NULL %d", __LINE__);
+    }
+
     if (m_streamThreads[1]->m_numRegisteredStream == 0 && m_streamThreads[1]->m_activated) {
         ALOGV("(%s): deactivating stream thread 1 ", __FUNCTION__);
         targetStream = (StreamThread*)(m_streamThreads[1].get());
@@ -2212,18 +2223,6 @@ int ExynosCameraHWInterface2::releaseStream(uint32_t stream_id)
             ALOGD("(%s): END   Waiting for (indirect) stream thread termination", __FUNCTION__);
             m_streamThreads[0] = NULL;
         }
-
-        if (m_sensorThread != NULL) {
-            m_sensorThread->release();
-            ALOGD("(%s): START Waiting for (indirect) sensor thread termination", __FUNCTION__);
-            while (!m_sensorThread->IsTerminated())
-                usleep(10000);
-            ALOGD("(%s): END   Waiting for (indirect) sensor thread termination", __FUNCTION__);
-        }
-        else {
-            ALOGE("+++++++ sensor thread is NULL %d", __LINE__);
-        }
-
         if (m_camera_info.capture.status == true) {
             m_scpForceSuspended = true;
         }