diff options
author | Daniel Levin <dendy@ti.com> | 2012-09-27 05:04:14 +0300 |
---|---|---|
committer | Daniel Levin <dendy@ti.com> | 2012-11-22 19:22:43 +0200 |
commit | 92c40268fb2cdf196b7bd97fa5e569d8267a9ac7 (patch) | |
tree | 1f84108a27c511c7a01b15481fc50b82942fa911 /camera | |
parent | 067aad9a1e4251b40b2fe912a41cb58947a62741 (diff) | |
download | hardware_ti_omap4-92c40268fb2cdf196b7bd97fa5e569d8267a9ac7.zip hardware_ti_omap4-92c40268fb2cdf196b7bd97fa5e569d8267a9ac7.tar.gz hardware_ti_omap4-92c40268fb2cdf196b7bd97fa5e569d8267a9ac7.tar.bz2 |
Camera: Protect mBuffersWithDucati
Using mBuffersWithDucati simultaneously from separate threads
causes race condition in debug mode.
Change-Id: Ie24546dce12ff6f516a74fcf4887c4e8073ff8e0
Signed-off-by: Daniel Levin <dendy@ti.com>
Diffstat (limited to 'camera')
-rw-r--r-- | camera/BaseCameraAdapter.cpp | 3 | ||||
-rw-r--r-- | camera/OMXCameraAdapter/OMXCameraAdapter.cpp | 6 | ||||
-rw-r--r-- | camera/inc/BaseCameraAdapter.h | 1 |
3 files changed, 10 insertions, 0 deletions
diff --git a/camera/BaseCameraAdapter.cpp b/camera/BaseCameraAdapter.cpp index 88ba8a4..36b3782 100644 --- a/camera/BaseCameraAdapter.cpp +++ b/camera/BaseCameraAdapter.cpp @@ -390,6 +390,8 @@ void BaseCameraAdapter::returnFrame(CameraBuffer * frameBuf, CameraFrame::FrameT if ( 0 == refCount ) { #ifdef CAMERAHAL_DEBUG + { + android::AutoMutex locker(mBuffersWithDucatiLock); if((mBuffersWithDucati.indexOfKey((int)camera_buffer_get_omx_ptr(frameBuf)) >= 0) && ((CameraFrame::PREVIEW_FRAME_SYNC == frameType) || (CameraFrame::SNAPSHOT_FRAME == frameType))) @@ -398,6 +400,7 @@ void BaseCameraAdapter::returnFrame(CameraBuffer * frameBuf, CameraFrame::FrameT for(int i=0;i<mBuffersWithDucati.size();i++) CAMHAL_LOGE("0x%x", mBuffersWithDucati.keyAt(i)); } mBuffersWithDucati.add((int)camera_buffer_get_omx_ptr(frameBuf),1); + } #endif res = fillThisBuffer(frameBuf, frameType); } diff --git a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp index c142fa5..eecce61 100644 --- a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp +++ b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp @@ -2289,7 +2289,10 @@ status_t OMXCameraAdapter::startPreview() } mFramesWithDucati++; #ifdef CAMERAHAL_DEBUG + { + android::AutoMutex locker(mBuffersWithDucatiLock); mBuffersWithDucati.add((int)mPreviewData->mBufferHeader[index]->pAppPrivate,1); + } #endif GOTO_EXIT_IF((eError!=OMX_ErrorNone), eError); } @@ -3524,12 +3527,15 @@ OMX_ERRORTYPE OMXCameraAdapter::OMXCameraAdapterFillBufferDone(OMX_IN OMX_HANDLE mFramesWithDucati--; #ifdef CAMERAHAL_DEBUG + { + android::AutoMutex locker(mBuffersWithDucatiLock); if(mBuffersWithDucati.indexOfKey((uint32_t)pBuffHeader->pBuffer)<0) { CAMHAL_LOGE("Buffer was never with Ducati!! %p", pBuffHeader->pBuffer); for(unsigned int i=0;i<mBuffersWithDucati.size();i++) CAMHAL_LOGE("0x%x", mBuffersWithDucati.keyAt(i)); } mBuffersWithDucati.removeItem((int)pBuffHeader->pBuffer); + } #endif if(mDebugFcs) diff --git a/camera/inc/BaseCameraAdapter.h b/camera/inc/BaseCameraAdapter.h index b7966b0..c605df1 100644 --- a/camera/inc/BaseCameraAdapter.h +++ b/camera/inc/BaseCameraAdapter.h @@ -292,6 +292,7 @@ protected: uint32_t mFramesWithEncoder; #ifdef CAMERAHAL_DEBUG + android::Mutex mBuffersWithDucatiLock; android::KeyedVector<int, bool> mBuffersWithDucati; #endif |