summaryrefslogtreecommitdiff
path: root/camera
diff options
context:
space:
mode:
authorEmilian Peev <epeev@google.com>2017-09-22 13:51:43 +0100
committerEmilian Peev <epeev@google.com>2017-09-22 13:51:43 +0100
commit6f2972c45f027b395a5e12fa1e57749c94abdb92 (patch)
treeb78bc8b455b47fc5c5983feb8f5fd5a03188f34d /camera
parent5bb53cf899dc726424faa1f9dd890f328bfdd529 (diff)
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: Idd2ec4992d6a979d4308dbd2175897107bdffbe0
Diffstat (limited to 'camera')
-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 0cf2c7a0..249fa9de 100644
--- a/camera/QCamera2/HAL3/QCamera3Stream.cpp
+++ b/camera/QCamera2/HAL3/QCamera3Stream.cpp
@@ -707,10 +707,10 @@ void *QCamera3Stream::dataProcRoutine(void *data)
break;
case CAMERA_CMD_TYPE_EXIT:
LOGH("Exit");
+ pme->flushFreeBatchBufQ();
/* flush data buf queue */
pme->mDataQ.flush();
pme->mTimeoutFrameQ.clear();
- pme->flushFreeBatchBufQ();
running = 0;
break;
default: