Merge "Camera: Skip session parameters in case of abandoned streams" into rvc-dev

gugelfrei
TreeHugger Robot 4 years ago committed by Android (Google) Code Review
commit f872f88553

@ -2344,6 +2344,21 @@ void Camera3Device::cancelStreamsConfigurationLocked() {
} }
} }
bool Camera3Device::checkAbandonedStreamsLocked() {
if ((mInputStream.get() != nullptr) && (mInputStream->isAbandoned())) {
return true;
}
for (size_t i = 0; i < mOutputStreams.size(); i++) {
auto stream = mOutputStreams[i];
if ((stream.get() != nullptr) && (stream->isAbandoned())) {
return true;
}
}
return false;
}
bool Camera3Device::reconfigureCamera(const CameraMetadata& sessionParams) { bool Camera3Device::reconfigureCamera(const CameraMetadata& sessionParams) {
ATRACE_CALL(); ATRACE_CALL();
bool ret = false; bool ret = false;
@ -2352,6 +2367,12 @@ bool Camera3Device::reconfigureCamera(const CameraMetadata& sessionParams) {
nsecs_t maxExpectedDuration = getExpectedInFlightDuration(); nsecs_t maxExpectedDuration = getExpectedInFlightDuration();
Mutex::Autolock l(mLock); Mutex::Autolock l(mLock);
if (checkAbandonedStreamsLocked()) {
ALOGW("%s: Abandoned stream detected, session parameters can't be applied correctly!",
__FUNCTION__);
return true;
}
auto rc = internalPauseAndWaitLocked(maxExpectedDuration); auto rc = internalPauseAndWaitLocked(maxExpectedDuration);
if (rc == NO_ERROR) { if (rc == NO_ERROR) {
mNeedConfig = true; mNeedConfig = true;

@ -647,6 +647,12 @@ class Camera3Device :
*/ */
bool reconfigureCamera(const CameraMetadata& sessionParams); bool reconfigureCamera(const CameraMetadata& sessionParams);
/**
* Return true in case of any output or input abandoned streams,
* otherwise return false.
*/
bool checkAbandonedStreamsLocked();
/** /**
* Filter stream session parameters and configure camera HAL. * Filter stream session parameters and configure camera HAL.
*/ */

Loading…
Cancel
Save