diff options
author | Emilian Peev <epeev@google.com> | 2017-11-13 16:03:44 +0000 |
---|---|---|
committer | Emilian Peev <epeev@google.com> | 2017-12-20 10:44:11 +0000 |
commit | e18057b42f1698f33f34d14e86a53934bd337bb8 (patch) | |
tree | a5c56e72bd99d5eded5d585460f6bc07b5b1a508 /camera/device/3.3/default/CameraDeviceSession.cpp | |
parent | 220d98c193513c9f0a13e73379a6665b65ce4ee2 (diff) |
Camera: Bump device version to 3.4
Camera devices supporting version 3.4 will be able to receive
session parameters during the stream configuration phase.
Bug: 64450664
Test: Camera CTS
run commandAndExit vts --skip-all-system-status-check
--skip-preconditions --primary-abi-only --module
VtsHalCameraProviderV2_4Target -l INFO
Change-Id: Ifd83bfe0e512fe75b63602b4aba98f4cc1cdeb53
Diffstat (limited to 'camera/device/3.3/default/CameraDeviceSession.cpp')
-rw-r--r-- | camera/device/3.3/default/CameraDeviceSession.cpp | 73 |
1 files changed, 5 insertions, 68 deletions
diff --git a/camera/device/3.3/default/CameraDeviceSession.cpp b/camera/device/3.3/default/CameraDeviceSession.cpp index f877895ebb..d36e9ed4a0 100644 --- a/camera/device/3.3/default/CameraDeviceSession.cpp +++ b/camera/device/3.3/default/CameraDeviceSession.cpp @@ -77,42 +77,11 @@ Return<void> CameraDeviceSession::configureStreams_3_3( return Void(); } - camera3_stream_configuration_t stream_list; + camera3_stream_configuration_t stream_list{}; hidl_vec<camera3_stream_t*> streams; - - stream_list.operation_mode = (uint32_t) requestedConfiguration.operationMode; - stream_list.num_streams = requestedConfiguration.streams.size(); - streams.resize(stream_list.num_streams); - stream_list.streams = streams.data(); - - for (uint32_t i = 0; i < stream_list.num_streams; i++) { - int id = requestedConfiguration.streams[i].id; - - if (mStreamMap.count(id) == 0) { - Camera3Stream stream; - V3_2::implementation::convertFromHidl(requestedConfiguration.streams[i], &stream); - mStreamMap[id] = stream; - mStreamMap[id].data_space = mapToLegacyDataspace( - mStreamMap[id].data_space); - mCirculatingBuffers.emplace(stream.mId, CirculatingBuffers{}); - } else { - // width/height/format must not change, but usage/rotation might need to change - if (mStreamMap[id].stream_type != - (int) requestedConfiguration.streams[i].streamType || - mStreamMap[id].width != requestedConfiguration.streams[i].width || - mStreamMap[id].height != requestedConfiguration.streams[i].height || - mStreamMap[id].format != (int) requestedConfiguration.streams[i].format || - mStreamMap[id].data_space != - mapToLegacyDataspace( static_cast<android_dataspace_t> ( - requestedConfiguration.streams[i].dataSpace))) { - ALOGE("%s: stream %d configuration changed!", __FUNCTION__, id); - _hidl_cb(Status::INTERNAL_ERROR, outStreams); - return Void(); - } - mStreamMap[id].rotation = (int) requestedConfiguration.streams[i].rotation; - mStreamMap[id].usage = (uint32_t) requestedConfiguration.streams[i].usage; - } - streams[i] = &mStreamMap[id]; + if (!preProcessConfigurationLocked(requestedConfiguration, &stream_list, &streams)) { + _hidl_cb(Status::INTERNAL_ERROR, outStreams); + return Void(); } ATRACE_BEGIN("camera3->configure_streams"); @@ -122,39 +91,7 @@ Return<void> CameraDeviceSession::configureStreams_3_3( // In case Hal returns error most likely it was not able to release // the corresponding resources of the deleted streams. if (ret == OK) { - // delete unused streams, note we do this after adding new streams to ensure new stream - // will not have the same address as deleted stream, and HAL has a chance to reference - // the to be deleted stream in configure_streams call - for(auto it = mStreamMap.begin(); it != mStreamMap.end();) { - int id = it->first; - bool found = false; - for (const auto& stream : requestedConfiguration.streams) { - if (id == stream.id) { - found = true; - break; - } - } - if (!found) { - // Unmap all buffers of deleted stream - // in case the configuration call succeeds and HAL - // is able to release the corresponding resources too. - cleanupBuffersLocked(id); - it = mStreamMap.erase(it); - } else { - ++it; - } - } - - // Track video streams - mVideoStreamIds.clear(); - for (const auto& stream : requestedConfiguration.streams) { - if (stream.streamType == V3_2::StreamType::OUTPUT && - stream.usage & - graphics::common::V1_0::BufferUsage::VIDEO_ENCODER) { - mVideoStreamIds.push_back(stream.id); - } - } - mResultBatcher.setBatchedStreams(mVideoStreamIds); + postProcessConfigurationLocked(requestedConfiguration); } if (ret == -EINVAL) { |