Loading camera/device/3.2/default/CameraDeviceSession.cpp +61 −49 Original line number Diff line number Diff line Loading @@ -399,9 +399,11 @@ Return<void> CameraDeviceSession::configureStreams( return Void(); } if (status != Status::OK) { _hidl_cb(status, outStreams); return Void(); } if (status == Status::OK) { camera3_stream_configuration_t stream_list; hidl_vec<camera3_stream_t*> streams; Loading Loading @@ -441,6 +443,9 @@ Return<void> CameraDeviceSession::configureStreams( status_t ret = mDevice->ops->configure_streams(mDevice, &stream_list); ATRACE_END(); // 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 Loading @@ -455,16 +460,15 @@ Return<void> CameraDeviceSession::configureStreams( } if (!found) { // Unmap all buffers of deleted stream for (auto& pair : mCirculatingBuffers.at(id)) { sHandleImporter.freeBuffer(pair.second); } mCirculatingBuffers[id].clear(); mCirculatingBuffers.erase(id); // in case the configuration call succeeds and HAL // is able to release the corresponding resources too. cleanupBuffersLocked(id); it = mStreamMap.erase(it); } else { ++it; } } } if (ret == -EINVAL) { status = Status::ILLEGAL_ARGUMENT; Loading @@ -474,11 +478,19 @@ Return<void> CameraDeviceSession::configureStreams( convertToHidl(stream_list, &outStreams); } } _hidl_cb(status, outStreams); return Void(); } // Needs to get called after acquiring 'mInflightLock' void CameraDeviceSession::cleanupBuffersLocked(int id) { for (auto& pair : mCirculatingBuffers.at(id)) { sHandleImporter.freeBuffer(pair.second); } mCirculatingBuffers[id].clear(); mCirculatingBuffers.erase(id); } Return<Status> CameraDeviceSession::processCaptureRequest(const CaptureRequest& request) { Status status = initStatus(); if (status != Status::OK) { Loading camera/device/3.2/default/CameraDeviceSession.h +2 −0 Original line number Diff line number Diff line Loading @@ -123,6 +123,8 @@ private: static void cleanupInflightFences( hidl_vec<int>& allFences, size_t numFences); void cleanupBuffersLocked(int id); /** * Static callback forwarding methods from HAL to instance */ Loading Loading
camera/device/3.2/default/CameraDeviceSession.cpp +61 −49 Original line number Diff line number Diff line Loading @@ -399,9 +399,11 @@ Return<void> CameraDeviceSession::configureStreams( return Void(); } if (status != Status::OK) { _hidl_cb(status, outStreams); return Void(); } if (status == Status::OK) { camera3_stream_configuration_t stream_list; hidl_vec<camera3_stream_t*> streams; Loading Loading @@ -441,6 +443,9 @@ Return<void> CameraDeviceSession::configureStreams( status_t ret = mDevice->ops->configure_streams(mDevice, &stream_list); ATRACE_END(); // 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 Loading @@ -455,16 +460,15 @@ Return<void> CameraDeviceSession::configureStreams( } if (!found) { // Unmap all buffers of deleted stream for (auto& pair : mCirculatingBuffers.at(id)) { sHandleImporter.freeBuffer(pair.second); } mCirculatingBuffers[id].clear(); mCirculatingBuffers.erase(id); // in case the configuration call succeeds and HAL // is able to release the corresponding resources too. cleanupBuffersLocked(id); it = mStreamMap.erase(it); } else { ++it; } } } if (ret == -EINVAL) { status = Status::ILLEGAL_ARGUMENT; Loading @@ -474,11 +478,19 @@ Return<void> CameraDeviceSession::configureStreams( convertToHidl(stream_list, &outStreams); } } _hidl_cb(status, outStreams); return Void(); } // Needs to get called after acquiring 'mInflightLock' void CameraDeviceSession::cleanupBuffersLocked(int id) { for (auto& pair : mCirculatingBuffers.at(id)) { sHandleImporter.freeBuffer(pair.second); } mCirculatingBuffers[id].clear(); mCirculatingBuffers.erase(id); } Return<Status> CameraDeviceSession::processCaptureRequest(const CaptureRequest& request) { Status status = initStatus(); if (status != Status::OK) { Loading
camera/device/3.2/default/CameraDeviceSession.h +2 −0 Original line number Diff line number Diff line Loading @@ -123,6 +123,8 @@ private: static void cleanupInflightFences( hidl_vec<int>& allFences, size_t numFences); void cleanupBuffersLocked(int id); /** * Static callback forwarding methods from HAL to instance */ Loading