Loading camera/ndk/impl/ACameraCaptureSession.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -97,6 +97,7 @@ ACameraCaptureSession::stopRepeating() { dev->lockDeviceForSessionOps(); { if (dev->isSharedMode() && !dev->isPrimaryClient()) { dev->unlockDevice(); return ACAMERA_ERROR_UNSUPPORTED_OPERATION; } Mutex::Autolock _l(mSessionLock); Loading Loading @@ -138,11 +139,11 @@ ACameraCaptureSession::abortCaptures() { ALOGE("Error: Device associated with session %p has been closed!", this); return ACAMERA_ERROR_SESSION_CLOSED; } camera_status_t ret; dev->lockDeviceForSessionOps(); { if (dev->isSharedMode() && !dev->isPrimaryClient()) { dev->unlockDevice(); return ACAMERA_ERROR_UNSUPPORTED_OPERATION; } Mutex::Autolock _l(mSessionLock); Loading @@ -167,6 +168,7 @@ camera_status_t ACameraCaptureSession::updateOutputConfiguration(ACaptureSession dev->lockDeviceForSessionOps(); { if (dev->isSharedMode()) { dev->unlockDevice(); return ACAMERA_ERROR_UNSUPPORTED_OPERATION; } Mutex::Autolock _l(mSessionLock); Loading @@ -191,6 +193,7 @@ camera_status_t ACameraCaptureSession::prepare(ANativeWindow* window) { dev->lockDeviceForSessionOps(); { if (dev->isSharedMode()) { dev->unlockDevice(); return ACAMERA_ERROR_UNSUPPORTED_OPERATION; } Mutex::Autolock _l(mSessionLock); Loading camera/ndk/impl/ACameraDevice.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -711,6 +711,11 @@ CameraDevice::configureStreamsLocked(const ACaptureSessionOutputContainer* outpu if (ret != ACAMERA_OK) { return ret; } // Surface sharing cannot be enabled when a camera has been opened // in shared mode. if (flags::camera_multi_client() && mSharedMode && outConfig.mIsShared) { return ACAMERA_ERROR_INVALID_PARAMETER; } ParcelableSurfaceType pSurface = flagtools::convertSurfaceTypeToParcelable(surface); outputSet.insert(std::make_pair( anw, Loading services/camera/libcameraservice/api2/CameraDeviceClient.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -2485,6 +2485,26 @@ void CameraDeviceClient::detachDevice() { camera2::FrameProcessorBase::FRAME_PROCESSOR_LISTENER_MIN_ID, camera2::FrameProcessorBase::FRAME_PROCESSOR_LISTENER_MAX_ID, /*listener*/this); } if (flags::camera_multi_client() && mSharedMode) { for (auto streamInfo : mStreamInfoMap) { int streamToDelete = streamInfo.first; std::vector<size_t> removedSurfaceIds; for (size_t i = 0; i < mStreamMap.size(); ++i) { if (streamToDelete == mStreamMap.valueAt(i).streamId()) { removedSurfaceIds.push_back(mStreamMap.valueAt(i).surfaceId()); } } status_t err = mDevice->removeSharedSurfaces(streamToDelete, removedSurfaceIds); if (err != OK) { std::string msg = fmt::sprintf("Camera %s: Unexpected error %s (%d) when removing" "shared surfaces from stream %d", mCameraIdStr.c_str(), strerror(-err), err, streamToDelete); ALOGE("%s: %s", __FUNCTION__, msg.c_str()); } } } if (!flags::camera_multi_client() || !mSharedMode || (mSharedMode && sCameraService->isOnlyClient(this))){ ALOGV("Camera %s: Stopping processors", mCameraIdStr.c_str()); Loading Loading
camera/ndk/impl/ACameraCaptureSession.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -97,6 +97,7 @@ ACameraCaptureSession::stopRepeating() { dev->lockDeviceForSessionOps(); { if (dev->isSharedMode() && !dev->isPrimaryClient()) { dev->unlockDevice(); return ACAMERA_ERROR_UNSUPPORTED_OPERATION; } Mutex::Autolock _l(mSessionLock); Loading Loading @@ -138,11 +139,11 @@ ACameraCaptureSession::abortCaptures() { ALOGE("Error: Device associated with session %p has been closed!", this); return ACAMERA_ERROR_SESSION_CLOSED; } camera_status_t ret; dev->lockDeviceForSessionOps(); { if (dev->isSharedMode() && !dev->isPrimaryClient()) { dev->unlockDevice(); return ACAMERA_ERROR_UNSUPPORTED_OPERATION; } Mutex::Autolock _l(mSessionLock); Loading @@ -167,6 +168,7 @@ camera_status_t ACameraCaptureSession::updateOutputConfiguration(ACaptureSession dev->lockDeviceForSessionOps(); { if (dev->isSharedMode()) { dev->unlockDevice(); return ACAMERA_ERROR_UNSUPPORTED_OPERATION; } Mutex::Autolock _l(mSessionLock); Loading @@ -191,6 +193,7 @@ camera_status_t ACameraCaptureSession::prepare(ANativeWindow* window) { dev->lockDeviceForSessionOps(); { if (dev->isSharedMode()) { dev->unlockDevice(); return ACAMERA_ERROR_UNSUPPORTED_OPERATION; } Mutex::Autolock _l(mSessionLock); Loading
camera/ndk/impl/ACameraDevice.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -711,6 +711,11 @@ CameraDevice::configureStreamsLocked(const ACaptureSessionOutputContainer* outpu if (ret != ACAMERA_OK) { return ret; } // Surface sharing cannot be enabled when a camera has been opened // in shared mode. if (flags::camera_multi_client() && mSharedMode && outConfig.mIsShared) { return ACAMERA_ERROR_INVALID_PARAMETER; } ParcelableSurfaceType pSurface = flagtools::convertSurfaceTypeToParcelable(surface); outputSet.insert(std::make_pair( anw, Loading
services/camera/libcameraservice/api2/CameraDeviceClient.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -2485,6 +2485,26 @@ void CameraDeviceClient::detachDevice() { camera2::FrameProcessorBase::FRAME_PROCESSOR_LISTENER_MIN_ID, camera2::FrameProcessorBase::FRAME_PROCESSOR_LISTENER_MAX_ID, /*listener*/this); } if (flags::camera_multi_client() && mSharedMode) { for (auto streamInfo : mStreamInfoMap) { int streamToDelete = streamInfo.first; std::vector<size_t> removedSurfaceIds; for (size_t i = 0; i < mStreamMap.size(); ++i) { if (streamToDelete == mStreamMap.valueAt(i).streamId()) { removedSurfaceIds.push_back(mStreamMap.valueAt(i).surfaceId()); } } status_t err = mDevice->removeSharedSurfaces(streamToDelete, removedSurfaceIds); if (err != OK) { std::string msg = fmt::sprintf("Camera %s: Unexpected error %s (%d) when removing" "shared surfaces from stream %d", mCameraIdStr.c_str(), strerror(-err), err, streamToDelete); ALOGE("%s: %s", __FUNCTION__, msg.c_str()); } } } if (!flags::camera_multi_client() || !mSharedMode || (mSharedMode && sCameraService->isOnlyClient(this))){ ALOGV("Camera %s: Stopping processors", mCameraIdStr.c_str()); Loading