Loading services/camera/libcameraservice/api2/CompositeStream.cpp +7 −6 Original line number Diff line number Diff line Loading @@ -28,19 +28,19 @@ namespace android { namespace camera3 { CompositeStream::CompositeStream(wp<CameraDeviceBase> device, CompositeStream::CompositeStream(sp<CameraDeviceBase> device, wp<hardware::camera2::ICameraDeviceCallbacks> cb) : mDevice(device), mRemoteCallback(cb), mNumPartialResults(1), mErrorState(false) { sp<CameraDeviceBase> cameraDevice = device.promote(); if (cameraDevice.get() != nullptr) { CameraMetadata staticInfo = cameraDevice->info(); if (device != nullptr) { CameraMetadata staticInfo = device->info(); camera_metadata_entry_t entry = staticInfo.find(ANDROID_REQUEST_PARTIAL_RESULT_COUNT); if (entry.count > 0) { mNumPartialResults = entry.data.i32[0]; } mStatusTracker = device->getStatusTracker(); } } Loading Loading @@ -174,7 +174,7 @@ bool CompositeStream::onError(int32_t errorCode, const CaptureResultExtras& resu ret = onStreamBufferError(resultExtras); break; case hardware::camera2::ICameraDeviceCallbacks::ERROR_CAMERA_REQUEST: // Invalid request, this shouldn't affect composite streams. onRequestError(resultExtras); break; default: ALOGE("%s: Unrecoverable error: %d detected!", __FUNCTION__, errorCode); Loading @@ -186,7 +186,7 @@ bool CompositeStream::onError(int32_t errorCode, const CaptureResultExtras& resu return ret; } void CompositeStream::notifyError(int64_t frameNumber) { void CompositeStream::notifyError(int64_t frameNumber, int32_t requestId) { sp<hardware::camera2::ICameraDeviceCallbacks> remoteCb = mRemoteCallback.promote(); Loading @@ -194,6 +194,7 @@ void CompositeStream::notifyError(int64_t frameNumber) { CaptureResultExtras extras; extras.errorStreamId = getStreamId(); extras.frameNumber = frameNumber; extras.requestId = requestId; remoteCb->onDeviceError( hardware::camera2::ICameraDeviceCallbacks::ERROR_CAMERA_BUFFER, extras); Loading services/camera/libcameraservice/api2/CompositeStream.h +7 −2 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ namespace camera3 { class CompositeStream : public camera3::Camera3StreamBufferListener { public: CompositeStream(wp<CameraDeviceBase> device, wp<hardware::camera2::ICameraDeviceCallbacks> cb); CompositeStream(sp<CameraDeviceBase> device, wp<hardware::camera2::ICameraDeviceCallbacks> cb); virtual ~CompositeStream() {} status_t createStream(const std::vector<sp<Surface>>& consumers, Loading Loading @@ -95,7 +95,7 @@ protected: status_t registerCompositeStreamListener(int32_t streamId); void eraseResult(int64_t frameNumber); void flagAnErrorFrameNumber(int64_t frameNumber); void notifyError(int64_t frameNumber); void notifyError(int64_t frameNumber, int32_t requestId); // Subclasses should check for buffer errors from internal streams and return 'true' in // case the error notification should remain within camera service. Loading @@ -105,11 +105,16 @@ protected: // internal processing needs result data. virtual void onResultError(const CaptureResultExtras& resultExtras) = 0; // Subclasses can decide how to handle request errors depending on whether // or not the internal processing needs clean up. virtual void onRequestError(const CaptureResultExtras& /*resultExtras*/) {} // Device and/or service is in unrecoverable error state. // Composite streams should behave accordingly. void enableErrorState(); wp<CameraDeviceBase> mDevice; wp<camera3::StatusTracker> mStatusTracker; wp<hardware::camera2::ICameraDeviceCallbacks> mRemoteCallback; mutable Mutex mMutex; Loading services/camera/libcameraservice/api2/DepthCompositeStream.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ namespace android { namespace camera3 { DepthCompositeStream::DepthCompositeStream(wp<CameraDeviceBase> device, DepthCompositeStream::DepthCompositeStream(sp<CameraDeviceBase> device, wp<hardware::camera2::ICameraDeviceCallbacks> cb) : CompositeStream(device, cb), mBlobStreamId(-1), Loading @@ -43,9 +43,8 @@ DepthCompositeStream::DepthCompositeStream(wp<CameraDeviceBase> device, mProducerListener(new ProducerListener()), mMaxJpegSize(-1), mIsLogicalCamera(false) { sp<CameraDeviceBase> cameraDevice = device.promote(); if (cameraDevice.get() != nullptr) { CameraMetadata staticInfo = cameraDevice->info(); if (device != nullptr) { CameraMetadata staticInfo = device->info(); auto entry = staticInfo.find(ANDROID_JPEG_MAX_SIZE); if (entry.count > 0) { mMaxJpegSize = entry.data.i32[0]; Loading Loading @@ -385,7 +384,8 @@ void DepthCompositeStream::releaseInputFrameLocked(InputFrame *inputFrame /*out* } if ((inputFrame->error || mErrorState) && !inputFrame->errorNotified) { notifyError(inputFrame->frameNumber); //TODO: Figure out correct requestId notifyError(inputFrame->frameNumber, -1 /*requestId*/); inputFrame->errorNotified = true; } } Loading services/camera/libcameraservice/api2/DepthCompositeStream.h +3 −2 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ class DepthCompositeStream : public CompositeStream, public Thread, public CpuConsumer::FrameAvailableListener { public: DepthCompositeStream(wp<CameraDeviceBase> device, DepthCompositeStream(sp<CameraDeviceBase> device, wp<hardware::camera2::ICameraDeviceCallbacks> cb); ~DepthCompositeStream() override; Loading Loading @@ -80,8 +80,9 @@ private: bool error; bool errorNotified; int64_t frameNumber; int32_t requestId; InputFrame() : error(false), errorNotified(false), frameNumber(-1) { } InputFrame() : error(false), errorNotified(false), frameNumber(-1), requestId(-1) { } }; // Helper methods Loading services/camera/libcameraservice/api2/HeicCompositeStream.cpp +257 −149 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
services/camera/libcameraservice/api2/CompositeStream.cpp +7 −6 Original line number Diff line number Diff line Loading @@ -28,19 +28,19 @@ namespace android { namespace camera3 { CompositeStream::CompositeStream(wp<CameraDeviceBase> device, CompositeStream::CompositeStream(sp<CameraDeviceBase> device, wp<hardware::camera2::ICameraDeviceCallbacks> cb) : mDevice(device), mRemoteCallback(cb), mNumPartialResults(1), mErrorState(false) { sp<CameraDeviceBase> cameraDevice = device.promote(); if (cameraDevice.get() != nullptr) { CameraMetadata staticInfo = cameraDevice->info(); if (device != nullptr) { CameraMetadata staticInfo = device->info(); camera_metadata_entry_t entry = staticInfo.find(ANDROID_REQUEST_PARTIAL_RESULT_COUNT); if (entry.count > 0) { mNumPartialResults = entry.data.i32[0]; } mStatusTracker = device->getStatusTracker(); } } Loading Loading @@ -174,7 +174,7 @@ bool CompositeStream::onError(int32_t errorCode, const CaptureResultExtras& resu ret = onStreamBufferError(resultExtras); break; case hardware::camera2::ICameraDeviceCallbacks::ERROR_CAMERA_REQUEST: // Invalid request, this shouldn't affect composite streams. onRequestError(resultExtras); break; default: ALOGE("%s: Unrecoverable error: %d detected!", __FUNCTION__, errorCode); Loading @@ -186,7 +186,7 @@ bool CompositeStream::onError(int32_t errorCode, const CaptureResultExtras& resu return ret; } void CompositeStream::notifyError(int64_t frameNumber) { void CompositeStream::notifyError(int64_t frameNumber, int32_t requestId) { sp<hardware::camera2::ICameraDeviceCallbacks> remoteCb = mRemoteCallback.promote(); Loading @@ -194,6 +194,7 @@ void CompositeStream::notifyError(int64_t frameNumber) { CaptureResultExtras extras; extras.errorStreamId = getStreamId(); extras.frameNumber = frameNumber; extras.requestId = requestId; remoteCb->onDeviceError( hardware::camera2::ICameraDeviceCallbacks::ERROR_CAMERA_BUFFER, extras); Loading
services/camera/libcameraservice/api2/CompositeStream.h +7 −2 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ namespace camera3 { class CompositeStream : public camera3::Camera3StreamBufferListener { public: CompositeStream(wp<CameraDeviceBase> device, wp<hardware::camera2::ICameraDeviceCallbacks> cb); CompositeStream(sp<CameraDeviceBase> device, wp<hardware::camera2::ICameraDeviceCallbacks> cb); virtual ~CompositeStream() {} status_t createStream(const std::vector<sp<Surface>>& consumers, Loading Loading @@ -95,7 +95,7 @@ protected: status_t registerCompositeStreamListener(int32_t streamId); void eraseResult(int64_t frameNumber); void flagAnErrorFrameNumber(int64_t frameNumber); void notifyError(int64_t frameNumber); void notifyError(int64_t frameNumber, int32_t requestId); // Subclasses should check for buffer errors from internal streams and return 'true' in // case the error notification should remain within camera service. Loading @@ -105,11 +105,16 @@ protected: // internal processing needs result data. virtual void onResultError(const CaptureResultExtras& resultExtras) = 0; // Subclasses can decide how to handle request errors depending on whether // or not the internal processing needs clean up. virtual void onRequestError(const CaptureResultExtras& /*resultExtras*/) {} // Device and/or service is in unrecoverable error state. // Composite streams should behave accordingly. void enableErrorState(); wp<CameraDeviceBase> mDevice; wp<camera3::StatusTracker> mStatusTracker; wp<hardware::camera2::ICameraDeviceCallbacks> mRemoteCallback; mutable Mutex mMutex; Loading
services/camera/libcameraservice/api2/DepthCompositeStream.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ namespace android { namespace camera3 { DepthCompositeStream::DepthCompositeStream(wp<CameraDeviceBase> device, DepthCompositeStream::DepthCompositeStream(sp<CameraDeviceBase> device, wp<hardware::camera2::ICameraDeviceCallbacks> cb) : CompositeStream(device, cb), mBlobStreamId(-1), Loading @@ -43,9 +43,8 @@ DepthCompositeStream::DepthCompositeStream(wp<CameraDeviceBase> device, mProducerListener(new ProducerListener()), mMaxJpegSize(-1), mIsLogicalCamera(false) { sp<CameraDeviceBase> cameraDevice = device.promote(); if (cameraDevice.get() != nullptr) { CameraMetadata staticInfo = cameraDevice->info(); if (device != nullptr) { CameraMetadata staticInfo = device->info(); auto entry = staticInfo.find(ANDROID_JPEG_MAX_SIZE); if (entry.count > 0) { mMaxJpegSize = entry.data.i32[0]; Loading Loading @@ -385,7 +384,8 @@ void DepthCompositeStream::releaseInputFrameLocked(InputFrame *inputFrame /*out* } if ((inputFrame->error || mErrorState) && !inputFrame->errorNotified) { notifyError(inputFrame->frameNumber); //TODO: Figure out correct requestId notifyError(inputFrame->frameNumber, -1 /*requestId*/); inputFrame->errorNotified = true; } } Loading
services/camera/libcameraservice/api2/DepthCompositeStream.h +3 −2 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ class DepthCompositeStream : public CompositeStream, public Thread, public CpuConsumer::FrameAvailableListener { public: DepthCompositeStream(wp<CameraDeviceBase> device, DepthCompositeStream(sp<CameraDeviceBase> device, wp<hardware::camera2::ICameraDeviceCallbacks> cb); ~DepthCompositeStream() override; Loading Loading @@ -80,8 +80,9 @@ private: bool error; bool errorNotified; int64_t frameNumber; int32_t requestId; InputFrame() : error(false), errorNotified(false), frameNumber(-1) { } InputFrame() : error(false), errorNotified(false), frameNumber(-1), requestId(-1) { } }; // Helper methods Loading
services/camera/libcameraservice/api2/HeicCompositeStream.cpp +257 −149 File changed.Preview size limit exceeded, changes collapsed. Show changes