QCamera2/HAL3: Handle releaseFrameData() correctly for batch mode
mDataQ.flush() calls releaseFrameData() with any pending buffers.
In case of batch mode, these are batch container buffers that
should be added to the empty batch buffer list.
Bug: 23360060
Change-Id: Ice2527b50ac9005055bd8f92312a111941855fe5
diff --git a/QCamera2/HAL3/QCamera3Stream.cpp b/QCamera2/HAL3/QCamera3Stream.cpp
index d495748..efd00e5 100644
--- a/QCamera2/HAL3/QCamera3Stream.cpp
+++ b/QCamera2/HAL3/QCamera3Stream.cpp
@@ -1079,7 +1079,15 @@
QCamera3Stream *pme = (QCamera3Stream *)user_data;
mm_camera_super_buf_t *frame = (mm_camera_super_buf_t *)data;
if (NULL != pme) {
- pme->bufDone(frame->bufs[0]->buf_idx);
+ if (UNLIKELY(pme->mBatchSize)) {
+ /* For batch mode, the batch buffer is added to empty list */
+ if(!pme->mFreeBatchBufQ.enqueue((void*) frame->bufs[0])) {
+ ALOGE("%s: batchBuf.buf_idx: %d enqueue failed", __func__,
+ frame->bufs[0]->buf_idx);
+ }
+ } else {
+ pme->bufDone(frame->bufs[0]->buf_idx);
+ }
}
}