summaryrefslogtreecommitdiff
path: root/camera/device/3.5/default/CameraDeviceSession.cpp
diff options
context:
space:
mode:
authorYin-Chia Yeh <yinchiayeh@google.com>2019-02-13 15:18:16 -0800
committerYin-Chia Yeh <yinchiayeh@google.com>2019-02-14 14:18:01 -0800
commit9e3079b0de9ce00681c623eddc6613ae4d96b6f5 (patch)
tree453ede7fa200b64f9fd1682a29090599900efc49 /camera/device/3.5/default/CameraDeviceSession.cpp
parent71e6298ea6fa05e1bb1cd26d64a8f1d43091497e (diff)
Camera: remove stream_configuration_counter from camera3.h
Handle the race issue in the wrapper HAL instead of letting HAL implementation handing it. Test: Pixel 3 + camera CTS + GCA Bug: 120986771 Change-Id: Iff97fcaa969bea6668679c57642e4322c4ca5c19
Diffstat (limited to 'camera/device/3.5/default/CameraDeviceSession.cpp')
-rw-r--r--camera/device/3.5/default/CameraDeviceSession.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/camera/device/3.5/default/CameraDeviceSession.cpp b/camera/device/3.5/default/CameraDeviceSession.cpp
index 873ddd0460..bea1be6d53 100644
--- a/camera/device/3.5/default/CameraDeviceSession.cpp
+++ b/camera/device/3.5/default/CameraDeviceSession.cpp
@@ -72,6 +72,22 @@ Return<void> CameraDeviceSession::configureStreams_3_5(
Return<void> CameraDeviceSession::signalStreamFlush(
const hidl_vec<int32_t>& streamIds, uint32_t streamConfigCounter) {
+ if (mDevice->ops->signal_stream_flush == nullptr) {
+ return Void();
+ }
+
+ uint32_t currentCounter = 0;
+ {
+ Mutex::Autolock _l(mStreamConfigCounterLock);
+ currentCounter = mStreamConfigCounter;
+ }
+
+ if (streamConfigCounter < currentCounter) {
+ ALOGV("%s: streamConfigCounter %d is stale (current %d), skipping signal_stream_flush call",
+ __FUNCTION__, streamConfigCounter, mStreamConfigCounter);
+ return Void();
+ }
+
std::vector<camera3_stream_t*> streams(streamIds.size());
{
Mutex::Autolock _l(mInflightLock);
@@ -84,10 +100,8 @@ Return<void> CameraDeviceSession::signalStreamFlush(
streams[i] = &mStreamMap[id];
}
}
- if (mDevice->ops->signal_stream_flush != nullptr) {
- mDevice->ops->signal_stream_flush(mDevice,
- streamConfigCounter, streams.size(), streams.data());
- }
+
+ mDevice->ops->signal_stream_flush(mDevice, streams.size(), streams.data());
return Void();
}