targetStream = (StreamThread*)(m_streamThreads[0].get());
if (!targetStream) {
ALOGW("(%s): Stream Not Exists", __FUNCTION__);
- return 1;
+ return NO_ERROR;
}
targetStream->m_numRegisteredStream--;
ALOGV("(%s): m_numRegisteredStream = %d", __FUNCTION__, targetStream->m_numRegisteredStream);
}
}
} else if (stream_id == STREAM_ID_JPEG) {
+ if (m_resizeBuf.size.s != 0) {
+ freeCameraMemory(&m_resizeBuf, 1);
+ }
+ memset(&m_subStreams[stream_id], 0, sizeof(substream_parameters_t));
+
targetStream = (StreamThread*)(m_streamThreads[1].get());
if (!targetStream) {
ALOGW("(%s): Stream Not Exists", __FUNCTION__);
- return 1;
- }
- memset(&m_subStreams[stream_id], 0, sizeof(substream_parameters_t));
- if (m_resizeBuf.size.s != 0) {
- freeCameraMemory(&m_resizeBuf, 1);
+ return NO_ERROR;
}
- if (targetStream)
- res = targetStream->detachSubStream(stream_id);
- if (res != NO_ERROR) {
+
+ if (targetStream->detachSubStream(stream_id) != NO_ERROR) {
ALOGE("(%s): substream detach failed. res(%d)", __FUNCTION__, res);
return 1;
}
ALOGV("(%s): m_numRegisteredStream = %d", __FUNCTION__, targetStream->m_numRegisteredStream);
return 0;
} else if (stream_id == STREAM_ID_RECORD) {
+ memset(&m_subStreams[stream_id], 0, sizeof(substream_parameters_t));
+
targetStream = (StreamThread*)(m_streamThreads[0].get());
if (!targetStream) {
ALOGW("(%s): Stream Not Exists", __FUNCTION__);
+ return NO_ERROR;
+ }
+
+ if (targetStream->detachSubStream(stream_id) != NO_ERROR) {
+ ALOGE("(%s): substream detach failed. res(%d)", __FUNCTION__, res);
return 1;
}
- memset(&m_subStreams[stream_id], 0, sizeof(substream_parameters_t));
- if (targetStream)
- res = targetStream->detachSubStream(stream_id);
- else
- return 0;
+
if (targetStream->m_numRegisteredStream != 0)
return 0;
} else if (stream_id == STREAM_ID_PRVCB) {
+ if (m_previewCbBuf.size.s != 0) {
+ freeCameraMemory(&m_previewCbBuf, m_subStreams[stream_id].internalPlanes);
+ }
+ memset(&m_subStreams[stream_id], 0, sizeof(substream_parameters_t));
+
targetStream = (StreamThread*)(m_streamThreads[0].get());
if (!targetStream) {
ALOGW("(%s): Stream Not Exists", __FUNCTION__);
- return 1;
+ return NO_ERROR;
}
- if (m_resizeBuf.size.s != 0) {
- freeCameraMemory(&m_previewCbBuf, m_subStreams[stream_id].internalPlanes);
+
+ if (targetStream->detachSubStream(stream_id) != NO_ERROR) {
+ ALOGE("(%s): substream detach failed. res(%d)", __FUNCTION__, res);
+ return 1;
}
- memset(&m_subStreams[stream_id], 0, sizeof(substream_parameters_t));
- if (targetStream)
- res = targetStream->detachSubStream(stream_id);
- else
- return 0;
+
if (targetStream->m_numRegisteredStream != 0)
return 0;
} else if (stream_id == STREAM_ID_ZSL) {
targetStream = (StreamThread*)(m_streamThreads[1].get());
if (!targetStream) {
ALOGW("(%s): Stream Not Exists", __FUNCTION__);
- return 1;
+ return NO_ERROR;
}
+
targetStream->m_numRegisteredStream--;
ALOGV("(%s): m_numRegisteredStream = %d", __FUNCTION__, targetStream->m_numRegisteredStream);
if (targetStream->m_parameters.needsIonMap) {
return 1;
}
- if (m_sensorThread != NULL) {
+ if (m_sensorThread != NULL && releasingScpMain) {
m_sensorThread->release();
ALOGD("(%s): START Waiting for (indirect) sensor thread termination", __FUNCTION__);
while (!m_sensorThread->IsTerminated())
usleep(SIG_WAITING_TICK);
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__);