diff options
author | Igor Murashkin <iam@google.com> | 2012-10-02 15:21:31 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-10-03 11:40:46 -0700 |
commit | b3e97b347dceb882983427ac872b772e25f3f166 (patch) | |
tree | 0b2fd5a80b030f988e56f11ebba92c6d9549ed11 /services/camera | |
parent | ecf17e82505fdb60d59e00b6dd59036df93de655 (diff) | |
download | frameworks_av-b3e97b347dceb882983427ac872b772e25f3f166.zip frameworks_av-b3e97b347dceb882983427ac872b772e25f3f166.tar.gz frameworks_av-b3e97b347dceb882983427ac872b772e25f3f166.tar.bz2 |
Camera2: Fix trying to release HAL stream twice
When we fail to disconnect the native window, StreamAdapter::release
would fail and remain in the old (ALLOCATED) state, thus it thinks that
we haven't released the HAL stream yet.
With this change, ignore DEAD_OBJECT native window disconnect failures,
so the state transitions to RELEASED and we don't double release HAL
streams.
Bug: 7258314
Change-Id: I524893e4b4d6463d7b0a7ce32fb6f658afba8e11
Diffstat (limited to 'services/camera')
-rw-r--r-- | services/camera/libcameraservice/Camera2Device.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/services/camera/libcameraservice/Camera2Device.cpp b/services/camera/libcameraservice/Camera2Device.cpp index 6da9bef..25b7a58 100644 --- a/services/camera/libcameraservice/Camera2Device.cpp +++ b/services/camera/libcameraservice/Camera2Device.cpp @@ -1115,9 +1115,17 @@ status_t Camera2Device::StreamAdapter::release() { if (mState >= CONNECTED) { res = native_window_api_disconnect(mConsumerInterface.get(), NATIVE_WINDOW_API_CAMERA); - if (res != OK) { - ALOGE("%s: Unable to disconnect stream %d from native window", - __FUNCTION__, mId); + + /* this is not an error. if client calling process dies, + the window will also die and all calls to it will return + DEAD_OBJECT, thus it's already "disconnected" */ + if (res == DEAD_OBJECT) { + ALOGW("%s: While disconnecting stream %d from native window, the" + " native window died from under us", __FUNCTION__, mId); + } + else if (res != OK) { + ALOGE("%s: Unable to disconnect stream %d from native window (error %d %s)", + __FUNCTION__, mId, res, strerror(-res)); return res; } } |