summaryrefslogtreecommitdiffstats
path: root/camera
diff options
context:
space:
mode:
authorAkwasi Boateng <akwasi.boateng@ti.com>2011-10-29 14:25:50 -0500
committerIliyan Malchev <malchev@google.com>2011-12-01 10:40:03 -0800
commit80a2eeb9c95c24e0dd69e61c3f58e6da36cf703d (patch)
treef4cadde68787387ebc65cfeeccd84fba6fd175cd /camera
parent82640237cf0ca200932a66777fd1907d66cd0322 (diff)
downloadhardware_ti_omap4xxx-80a2eeb9c95c24e0dd69e61c3f58e6da36cf703d.zip
hardware_ti_omap4xxx-80a2eeb9c95c24e0dd69e61c3f58e6da36cf703d.tar.gz
hardware_ti_omap4xxx-80a2eeb9c95c24e0dd69e61c3f58e6da36cf703d.tar.bz2
CameraHAL: Avoids a possible deadlock in AppCallbackNotifier
- 'disableMsgType()' was querying CameraHal for enabled message types through 'msgTypeEnabled()'. This method will lock 'mLock' in CameraHal. On the other hand 'takePicture()' inside CameraHal will also lock 'mLock' before execution. If preview callbacks are enabled before image capture, then 'takePicture()' will call AppCallbackNotifier's 'disableMsgType()', which will try to lock 'mLock' again. Solution, a query to CameraHal for enabled message types is not needed inside 'disableMsgType()' because the passed argument 'msgType' already contains all the needed information. Signed-off-by: Emilian Peev <epeev@mm-sol.com> Signed-off-by: Akwasi Boateng <akwasi.boateng@ti.com> Signed-off-by: Iliyan Malchev <malchev@google.com> Change-Id: Ia4b7634ce21b8243f08d9124823c77e6bde84a8d
Diffstat (limited to 'camera')
-rw-r--r--camera/AppCallbackNotifier.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/camera/AppCallbackNotifier.cpp b/camera/AppCallbackNotifier.cpp
index bfdd671..201460d 100644
--- a/camera/AppCallbackNotifier.cpp
+++ b/camera/AppCallbackNotifier.cpp
@@ -1664,7 +1664,7 @@ status_t AppCallbackNotifier::enableMsgType(int32_t msgType)
status_t AppCallbackNotifier::disableMsgType(int32_t msgType)
{
- if(!mCameraHal->msgTypeEnabled(CAMERA_MSG_PREVIEW_FRAME | CAMERA_MSG_POSTVIEW_FRAME)) {
+ if( msgType & (CAMERA_MSG_PREVIEW_FRAME | CAMERA_MSG_POSTVIEW_FRAME) ) {
mFrameProvider->disableFrameNotification(CameraFrame::PREVIEW_FRAME_SYNC);
}