summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRuben Brunk <rubenbrunk@google.com>2013-12-05 11:00:37 -0800
committerRuben Brunk <rubenbrunk@google.com>2013-12-05 11:00:37 -0800
commitdfe715582943b3fc9bab91f88257a3bba6c6deef (patch)
tree929b4dc5eff24e92441dab6ba0d5132f3a986af0
parent84acd489b93e04bea7aab06d8abb024eef2576fd (diff)
downloadframeworks_av-dfe715582943b3fc9bab91f88257a3bba6c6deef.zip
frameworks_av-dfe715582943b3fc9bab91f88257a3bba6c6deef.tar.gz
frameworks_av-dfe715582943b3fc9bab91f88257a3bba6c6deef.tar.bz2
camera2: Fix race with stream deletion during disconnect.
Bug: 11856804 - Shutdown order in Camera2Client allows a stream to be deleted before the corresponding processing thread has quit. This can result in updates being called on the processor thread without a valid stream.
-rw-r--r--services/camera/libcameraservice/api1/Camera2Client.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/services/camera/libcameraservice/api1/Camera2Client.cpp b/services/camera/libcameraservice/api1/Camera2Client.cpp
index 0b6ca5c..abcbd06 100644
--- a/services/camera/libcameraservice/api1/Camera2Client.cpp
+++ b/services/camera/libcameraservice/api1/Camera2Client.cpp
@@ -406,12 +406,6 @@ void Camera2Client::disconnect() {
l.mParameters.state = Parameters::DISCONNECTED;
}
- mStreamingProcessor->deletePreviewStream();
- mStreamingProcessor->deleteRecordingStream();
- mJpegProcessor->deleteStream();
- mCallbackProcessor->deleteStream();
- mZslProcessor->deleteStream();
-
mStreamingProcessor->requestExit();
mFrameProcessor->requestExit();
mCaptureSequencer->requestExit();
@@ -428,6 +422,14 @@ void Camera2Client::disconnect() {
mZslProcessorThread->join();
mCallbackProcessor->join();
+ ALOGV("Camera %d: Deleting streams", mCameraId);
+
+ mStreamingProcessor->deletePreviewStream();
+ mStreamingProcessor->deleteRecordingStream();
+ mJpegProcessor->deleteStream();
+ mCallbackProcessor->deleteStream();
+ mZslProcessor->deleteStream();
+
ALOGV("Camera %d: Disconnecting device", mCameraId);
mDevice->disconnect();