diff options
author | Emilian Peev <epeev@mm-sol.com> | 2012-10-10 15:52:54 +0300 |
---|---|---|
committer | Eino-Ville Talvala <etalvala@google.com> | 2012-10-15 09:50:22 -0700 |
commit | b6a9d10508e321ebc53193a117bf6c65d98ae888 (patch) | |
tree | bb3435c3b0fac8bf78867774fdfb2f3c870cdfd9 | |
parent | 3d6b69f0a0fb325443ef8c2987c16af1f8618d3e (diff) | |
download | omap4xxx-b6a9d10508e321ebc53193a117bf6c65d98ae888.tar.gz |
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>
-rw-r--r-- | camera/BaseCameraAdapter.cpp | 4 |
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; } |