summaryrefslogtreecommitdiffstats
path: root/camera/OMXCameraAdapter
diff options
context:
space:
mode:
authorAkwasi Boateng <akwasi.boateng@ti.com>2011-10-24 16:44:17 -0500
committerEd Heyl <ed@google.com>2011-10-25 20:40:21 +0000
commit644d8e25329685109606fce8802eb34285db11f2 (patch)
tree45c188f2961ee55536885bb4c45ee523e0d91b40 /camera/OMXCameraAdapter
parentddd8abe201b190eb86763c99ad7c9ab23c34dd6f (diff)
downloadhardware_ti_omap4-644d8e25329685109606fce8802eb34285db11f2.zip
hardware_ti_omap4-644d8e25329685109606fce8802eb34285db11f2.tar.gz
hardware_ti_omap4-644d8e25329685109606fce8802eb34285db11f2.tar.bz2
Fix for double OMX_Deinit() calls
Change-Id: I43260d50a284a7d651b6309b344404bf45c7a617 Signed-off-by: Akwasi Boateng <akwasi.boateng@ti.com> related-to-bug: 5451993
Diffstat (limited to 'camera/OMXCameraAdapter')
-rwxr-xr-xcamera/OMXCameraAdapter/OMXCameraAdapter.cpp55
1 files changed, 28 insertions, 27 deletions
diff --git a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
index 5f0c96a..c3feeee 100755
--- a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
+++ b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
@@ -92,6 +92,12 @@ status_t OMXCameraAdapter::initialize(CameraProperties::Properties* caps)
//currently not supported use preview port instead
mCameraAdapterParameters.mVideoPortIndex = OMX_CAMERA_PORT_VIDEO_OUT_PREVIEW;
+ eError = OMX_Init();
+ if (eError != OMX_ErrorNone) {
+ CAMHAL_LOGEB("Error OMX_Init -0x%x", eError);
+ return eError;
+ }
+
///Get the handle to the OMX Component
eError = OMXCameraAdapter::OMXCameraGetHandle(&mCameraAdapterParameters.mHandleComp, (OMX_PTR)this);
if(eError != OMX_ErrorNone) {
@@ -3397,38 +3403,27 @@ OMX_ERRORTYPE OMXCameraAdapter::OMXCameraGetHandle(OMX_HANDLETYPE *handle, OMX_P
int retries = 5;
while(eError!=OMX_ErrorNone && --retries>=0) {
- // OMX_Init
- eError = OMX_Init();
- if (eError != OMX_ErrorNone) {
- CAMHAL_LOGEB("OMX_Init -0x%x", eError);
- } else {
- // Setup key parameters to send to Ducati during init
- OMX_CALLBACKTYPE oCallbacks;
-
- // Initialize the callback handles
- oCallbacks.EventHandler = android::OMXCameraAdapterEventHandler;
- oCallbacks.EmptyBufferDone = android::OMXCameraAdapterEmptyBufferDone;
- oCallbacks.FillBufferDone = android::OMXCameraAdapterFillBufferDone;
-
- // Get Handle
- eError = OMX_GetHandle(handle, (OMX_STRING)"OMX.TI.DUCATI1.VIDEO.CAMERA", pAppData, &oCallbacks);
- if (eError != OMX_ErrorNone) {
- CAMHAL_LOGEB("OMX_GetHandle -0x%x", eError);
- //Deinit here as we will init again above
- //Note that we need to deinit because an erro recovery
- //might have rendered the currently open rpmsg-omx device
- //useless. so we might need to re-open it again
- OMX_Deinit();
- } else {
- break;
- }
- }
+
+ // Setup key parameters to send to Ducati during init
+ OMX_CALLBACKTYPE oCallbacks;
+
+ // Initialize the callback handles
+ oCallbacks.EventHandler = android::OMXCameraAdapterEventHandler;
+ oCallbacks.EmptyBufferDone = android::OMXCameraAdapterEmptyBufferDone;
+ oCallbacks.FillBufferDone = android::OMXCameraAdapterFillBufferDone;
+
+ // Get Handle
+ eError = OMX_GetHandle(handle, (OMX_STRING)"OMX.TI.DUCATI1.VIDEO.CAMERA", pAppData, &oCallbacks);
+ if (eError != OMX_ErrorNone) {
+ CAMHAL_LOGEB("OMX_GetHandle -0x%x", eError);
//Sleep for 100 mS
usleep(100000);
+ } else {
+ break;
+ }
}
return eError;
-
}
extern "C" int CameraAdapter_Capabilities(CameraProperties::Properties* properties_array,
@@ -3450,6 +3445,12 @@ extern "C" int CameraAdapter_Capabilities(CameraProperties::Properties* properti
return -EINVAL;
}
+ eError = OMX_Init();
+ if (eError != OMX_ErrorNone) {
+ CAMHAL_LOGEB("Error OMX_Init -0x%x", eError);
+ return eError;
+ }
+
eError = OMXCameraAdapter::OMXCameraGetHandle(&handle);
if (eError != OMX_ErrorNone) {
CAMHAL_LOGEB("OMX_GetHandle -0x%x", eError);