summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilian Peev <epeev@google.com>2017-09-22 15:16:15 +0100
committerEmilian Peev <epeev@google.com>2017-09-22 15:16:15 +0100
commit18f48fce3e756c0efc0197da3f0b829183cd0189 (patch)
treefab5d575d4dce1e92031a7580b2e6371b7fe01ec
parenteade08a0a8e1e13d14d5d3f36d94419d3741cfd6 (diff)
downloadbullhead-18f48fce3e756c0efc0197da3f0b829183cd0189.tar.gz
QCamera2: HAL3: Avoid race condition during HFR video stop
The video stream stop sequence can encounter a race conidtion in case pending buffers arrive during the same time frame. Any incoming stream callbacks that manage to execute during the window between 'mDataQ' flush and 'flushFreeBatchBufQ' will modify the 'mBufsStaged' counter without the knowledge of the top 'QCamera3HardwareInterface' instance. This makes subsequent calls 'aggregateBufToBatch' prone to batch overflow errors. To resolve this, call 'flushFreeBatchBufQ' before flushing 'mDataQ'. This way calls to 'aggregateBufToBatch' from failing stream callbacks should not be successfull in modifiying 'mBufsStaged'. Bug: 65549208 Test: Camera CTS Change-Id: Iee55ebd57e66ca359fa1eaa21fcc86021f2b920b
-rw-r--r--camera/QCamera2/HAL3/QCamera3Stream.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/camera/QCamera2/HAL3/QCamera3Stream.cpp b/camera/QCamera2/HAL3/QCamera3Stream.cpp
index 399e73d..e87d1ec 100644
--- a/camera/QCamera2/HAL3/QCamera3Stream.cpp
+++ b/camera/QCamera2/HAL3/QCamera3Stream.cpp
@@ -588,9 +588,9 @@ void *QCamera3Stream::dataProcRoutine(void *data)
break;
case CAMERA_CMD_TYPE_EXIT:
CDBG_HIGH("%s: Exit", __func__);
+ pme->flushFreeBatchBufQ();
/* flush data buf queue */
pme->mDataQ.flush();
- pme->flushFreeBatchBufQ();
running = 0;
break;
default: