diff options
author | vincechiu <vincechiu@google.com> | 2020-06-22 12:10:22 +0800 |
---|---|---|
committer | Vince Chiu <vincechiu@google.com> | 2020-06-22 09:34:17 +0000 |
commit | ddbeab7bd55c1f884ea81f794b9d21b85261fcf6 (patch) | |
tree | 039108b10dbd4c22724ecc5bc5d0f604bf5c5108 | |
parent | 9e688c0d8a9143cc8782f772493ed95b51b31114 (diff) | |
download | camera-ddbeab7bd55c1f884ea81f794b9d21b85261fcf6.tar.gz |
camera: Fix halConfiguration parameters back to frameworks
Purge the hal_configured_streams only framework streams are left as defined spec.
https://android.googlesource.com/platform/hardware/interfaces/+/master/camera/device/3.5/ICameraDeviceSession.hal
This is to fix CameraHidlTest#configureStreamsPreviewStillOutputs.
Cherrypick from ag/10029434
Bug: 159413657
Test: GCA, CTS
Change-Id: I096d4474d966e50293dde211aba4d7edcf33a3a4
-rw-r--r-- | common/hal/google_camera_hal/hdrplus_capture_session.cc | 32 | ||||
-rw-r--r-- | common/hal/google_camera_hal/hdrplus_capture_session.h | 5 |
2 files changed, 37 insertions, 0 deletions
diff --git a/common/hal/google_camera_hal/hdrplus_capture_session.cc b/common/hal/google_camera_hal/hdrplus_capture_session.cc index 1502fb0..aede085 100644 --- a/common/hal/google_camera_hal/hdrplus_capture_session.cc +++ b/common/hal/google_camera_hal/hdrplus_capture_session.cc @@ -22,6 +22,7 @@ #include <utils/Trace.h> #include <inttypes.h> +#include <set> #include "hal_utils.h" #include "hdrplus_capture_session.h" @@ -529,6 +530,13 @@ status_t HdrplusCaptureSession::Initialize( return res; } + res = PurgeHalConfiguredStream(stream_config, hal_configured_streams); + if (res != OK) { + ALOGE("%s: Removing internal streams from configured stream failed: %s(%d)", + __FUNCTION__, strerror(-res), res); + return res; + } + // Connect realtime process chain res = ConnectProcessChain(request_processor_.get(), std::move(realtime_process_block), @@ -609,6 +617,30 @@ void HdrplusCaptureSession::ProcessCaptureResult( } } +status_t HdrplusCaptureSession::PurgeHalConfiguredStream( + const StreamConfiguration& stream_config, + std::vector<HalStream>* hal_configured_streams) { + if (hal_configured_streams == nullptr) { + ALOGE("%s: HAL configured stream list is null.", __FUNCTION__); + return BAD_VALUE; + } + + std::set<int32_t> framework_stream_id_set; + for (auto& stream : stream_config.streams) { + framework_stream_id_set.insert(stream.id); + } + + std::vector<HalStream> configured_streams; + for (auto& hal_stream : *hal_configured_streams) { + if (framework_stream_id_set.find(hal_stream.id) != + framework_stream_id_set.end()) { + configured_streams.push_back(hal_stream); + } + } + *hal_configured_streams = configured_streams; + return OK; +} + void HdrplusCaptureSession::NotifyHalMessage(const NotifyMessage& message) { ATRACE_CALL(); std::lock_guard<std::mutex> lock(callback_lock_); diff --git a/common/hal/google_camera_hal/hdrplus_capture_session.h b/common/hal/google_camera_hal/hdrplus_capture_session.h index 6944129..d346c3b 100644 --- a/common/hal/google_camera_hal/hdrplus_capture_session.h +++ b/common/hal/google_camera_hal/hdrplus_capture_session.h @@ -121,6 +121,11 @@ class HdrplusCaptureSession : public CaptureSession { std::unique_ptr<ProcessBlock> process_block, std::unique_ptr<ResultProcessor> result_processor); + // Purge the hal_configured_streams such that only framework streams are left + status_t PurgeHalConfiguredStream( + const StreamConfiguration& stream_config, + std::vector<HalStream>* hal_configured_streams); + // Invoked when receiving a result from result processor. void ProcessCaptureResult(std::unique_ptr<CaptureResult> result); |