summaryrefslogtreecommitdiffstats
path: root/camera
diff options
context:
space:
mode:
authorEmilian Peev <epeev@mm-sol.com>2012-10-10 15:52:54 +0300
committerEino-Ville Talvala <etalvala@google.com>2012-10-15 09:50:22 -0700
commit37f1884d3b0cb3a069aaa10a40ee80f1ab148b99 (patch)
tree54e5f2a1fed540f9485a76582a8fe1bbf4ea0572 /camera
parent28d29b523d02a04aace41dae50887e47a410f843 (diff)
downloadhardware_ti_omap4-37f1884d3b0cb3a069aaa10a40ee80f1ab148b99.zip
hardware_ti_omap4-37f1884d3b0cb3a069aaa10a40ee80f1ab148b99.tar.gz
hardware_ti_omap4-37f1884d3b0cb3a069aaa10a40ee80f1ab148b99.tar.bz2
CameraHal: Avoid race condition during recording stop
- A race condition is possible when recording is stopped. 'BaseCameraAdapter::stopVideoCapture()' is clearing 'mVideoBuffersAvailable'. A delayed video frame from 'AppCallbackNotifier' can return afterwards though and then try to query the already empty 'KeyedVector'. This will result in a segfault. Solution is to move the vector reset away from 'stopVideoCapture()' and in to 'startVideoCapture()' where it is needed. Bug: 7021214 Change-Id: Ic234189b49e35c990b3af70bd713a12cb762362c Signed-off-by: Emilian Peev <epeev@mm-sol.com>
Diffstat (limited to 'camera')
-rw-r--r--camera/BaseCameraAdapter.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/camera/BaseCameraAdapter.cpp b/camera/BaseCameraAdapter.cpp
index bb7a5b8..123ab00 100644
--- a/camera/BaseCameraAdapter.cpp
+++ b/camera/BaseCameraAdapter.cpp
@@ -1421,6 +1421,8 @@ status_t BaseCameraAdapter::startVideoCapture()
if ( NO_ERROR == ret )
{
+ mVideoBuffersAvailable.clear();
+
for ( unsigned int i = 0 ; i < mPreviewBuffersAvailable.size() ; i++ )
{
mVideoBuffersAvailable.add(mPreviewBuffersAvailable.keyAt(i), 0);
@@ -1456,8 +1458,6 @@ status_t BaseCameraAdapter::stopVideoCapture()
}
}
- mVideoBuffersAvailable.clear();
-
mRecording = false;
}