diff options
author | James Dong <jdong@google.com> | 2012-08-04 19:58:07 -0700 |
---|---|---|
committer | James Dong <jdong@google.com> | 2012-08-04 20:46:14 -0700 |
commit | 8da4cd7d706d9f551bf2d08cd8b61907a10cd38d (patch) | |
tree | d859052f6839fedf654ce8cea7dea2d567ad710f /services/camera | |
parent | d9f0253353db0b859c0ca2b32eddc24e3e9d4d86 (diff) | |
download | frameworks_av-8da4cd7d706d9f551bf2d08cd8b61907a10cd38d.zip frameworks_av-8da4cd7d706d9f551bf2d08cd8b61907a10cd38d.tar.gz frameworks_av-8da4cd7d706d9f551bf2d08cd8b61907a10cd38d.tar.bz2 |
Fix a deadlock in commandSetVideoBufferCountL()
o The lock to be acquired in recordingEnabled() has aleady been acquired in sendCommand()
before the call to commandSetVideoBufferCountL().
Change-Id: I664d51ef449c9eb3576d5d56f73f29c98444ff3f
Diffstat (limited to 'services/camera')
-rw-r--r-- | services/camera/libcameraservice/Camera2Client.cpp | 9 | ||||
-rw-r--r-- | services/camera/libcameraservice/Camera2Client.h | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/services/camera/libcameraservice/Camera2Client.cpp b/services/camera/libcameraservice/Camera2Client.cpp index dfcc8c0..cd74e6d 100644 --- a/services/camera/libcameraservice/Camera2Client.cpp +++ b/services/camera/libcameraservice/Camera2Client.cpp @@ -792,8 +792,15 @@ void Camera2Client::stopRecording() { bool Camera2Client::recordingEnabled() { ATRACE_CALL(); Mutex::Autolock icl(mICameraLock); + if ( checkPid(__FUNCTION__) != OK) return false; + return recordingEnabledL(); +} + +bool Camera2Client::recordingEnabledL() { + ATRACE_CALL(); + return (mState == RECORD || mState == VIDEO_SNAPSHOT); } @@ -1632,7 +1639,7 @@ status_t Camera2Client::commandPingL() { } status_t Camera2Client::commandSetVideoBufferCountL(size_t count) { - if (recordingEnabled()) { + if (recordingEnabledL()) { ALOGE("%s: Camera %d: Error setting video buffer count after " "recording was started", __FUNCTION__, mCameraId); return INVALID_OPERATION; diff --git a/services/camera/libcameraservice/Camera2Client.h b/services/camera/libcameraservice/Camera2Client.h index 2e6a36c..8c10d6b 100644 --- a/services/camera/libcameraservice/Camera2Client.h +++ b/services/camera/libcameraservice/Camera2Client.h @@ -108,6 +108,8 @@ private: void stopPreviewL(); status_t startPreviewL(); + bool recordingEnabledL(); + // Individual commands for sendCommand() status_t commandStartSmoothZoomL(); status_t commandStopSmoothZoomL(); |