diff options
author | Eino-Ville Talvala <etalvala@google.com> | 2013-09-24 18:04:19 -0700 |
---|---|---|
committer | Eino-Ville Talvala <etalvala@google.com> | 2013-10-08 11:21:06 -0700 |
commit | 07d2169d46f3536add6044dbf106967a1982252f (patch) | |
tree | 08090732d0c87e4dc781505e6396c33419b0ef62 /services | |
parent | ea0fadeb5d81ef3cb7f9db458c9033d628bdb86a (diff) | |
download | frameworks_av-07d2169d46f3536add6044dbf106967a1982252f.zip frameworks_av-07d2169d46f3536add6044dbf106967a1982252f.tar.gz frameworks_av-07d2169d46f3536add6044dbf106967a1982252f.tar.bz2 |
Camera3: Improve resilience to stream failures
- Handle binder connection drops (DEAD_OBJECT) for streams
- Just log an error, don't go to an error state when queue/dequeue fails
Bug: 10347526
Change-Id: Ib463ffe15d58db444cf5d8cad176a201c7d1facc
Diffstat (limited to 'services')
-rw-r--r-- | services/camera/libcameraservice/device3/Camera3Device.cpp | 8 | ||||
-rw-r--r-- | services/camera/libcameraservice/device3/Camera3IOStreamBase.cpp | 18 |
2 files changed, 13 insertions, 13 deletions
diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp index 1f853ab..303823c 100644 --- a/services/camera/libcameraservice/device3/Camera3Device.cpp +++ b/services/camera/libcameraservice/device3/Camera3Device.cpp @@ -1506,7 +1506,7 @@ void Camera3Device::processCaptureResult(const camera3_capture_result *result) { // Note: stream may be deallocated at this point, if this buffer was the // last reference to it. if (res != OK) { - SET_ERR("Can't return buffer %d for frame %d to its stream: " + ALOGE("Can't return buffer %d for frame %d to its stream: " " %s (%d)", i, frameNumber, strerror(-res), res); } } @@ -1867,7 +1867,7 @@ bool Camera3Device::RequestThread::threadLoop() { request.input_buffer = &inputBuffer; res = nextRequest->mInputStream->getInputBuffer(&inputBuffer); if (res != OK) { - SET_ERR("RequestThread: Can't get input buffer, skipping request:" + ALOGE("RequestThread: Can't get input buffer, skipping request:" " %s (%d)", strerror(-res), res); cleanUpFailedRequest(request, nextRequest, outputBuffers); return true; @@ -1883,8 +1883,8 @@ bool Camera3Device::RequestThread::threadLoop() { res = nextRequest->mOutputStreams.editItemAt(i)-> getBuffer(&outputBuffers.editItemAt(i)); if (res != OK) { - SET_ERR("RequestThread: Can't get output buffer, skipping request:" - "%s (%d)", strerror(-res), res); + ALOGE("RequestThread: Can't get output buffer, skipping request:" + " %s (%d)", strerror(-res), res); cleanUpFailedRequest(request, nextRequest, outputBuffers); return true; } diff --git a/services/camera/libcameraservice/device3/Camera3IOStreamBase.cpp b/services/camera/libcameraservice/device3/Camera3IOStreamBase.cpp index 727a8c9..da51228 100644 --- a/services/camera/libcameraservice/device3/Camera3IOStreamBase.cpp +++ b/services/camera/libcameraservice/device3/Camera3IOStreamBase.cpp @@ -214,19 +214,19 @@ status_t Camera3IOStreamBase::returnAnyBufferLocked( sp<Fence> releaseFence; res = returnBufferCheckedLocked(buffer, timestamp, output, &releaseFence); - if (res != OK) { - // NO_INIT means the buffer queue is abandoned, so to be resilient, - // still want to decrement in-flight counts. - if (res != NO_INIT) { - return res; - } - } + // Res may be an error, but we still want to decrement our owned count + // to enable clean shutdown. So we'll just return the error but otherwise + // carry on - mCombinedFence = Fence::merge(mName, mCombinedFence, releaseFence); + if (releaseFence != 0) { + mCombinedFence = Fence::merge(mName, mCombinedFence, releaseFence); + } mDequeuedBufferCount--; if (mDequeuedBufferCount == 0 && mState != STATE_IN_CONFIG && mState != STATE_IN_RECONFIG) { + ALOGV("%s: Stream %d: All buffers returned; now idle", __FUNCTION__, + mId); sp<StatusTracker> statusTracker = mStatusTracker.promote(); if (statusTracker != 0) { statusTracker->markComponentIdle(mStatusId, mCombinedFence); @@ -239,7 +239,7 @@ status_t Camera3IOStreamBase::returnAnyBufferLocked( mLastTimestamp = timestamp; } - return OK; + return res; } |