Camera3: Halt Snapshot stream when not in use
Halting snapshot stream when not in use by following
indirect changes
* Change total # of YUV buffers for snapshot to 1
* Dont return buffer when snapshot encoding is complete
* Return this buffer only when next snapshot is required
Bug: 9669777
Change-Id: I33a838fe3aebdbdeb6ccfb666f4e1ac545925b9f
Signed-off-by: Iliyan Malchev <malchev@google.com>
diff --git a/camera/QCamera2/HAL3/QCamera3Channel.cpp b/camera/QCamera2/HAL3/QCamera3Channel.cpp
index 132c034..d18564b 100644
--- a/camera/QCamera2/HAL3/QCamera3Channel.cpp
+++ b/camera/QCamera2/HAL3/QCamera3Channel.cpp
@@ -879,7 +879,7 @@
streamDim.width = mCamera3Stream->width;
streamDim.height = mCamera3Stream->height;
- int num_buffers = QCamera3PicChannel::kMaxBuffers + 1;
+ int num_buffers = 1;
rc = QCamera3Channel::addStream(streamType, streamFormat, streamDim,
num_buffers);
@@ -901,6 +901,7 @@
//Stream on for main image. YUV buffer is queued to the kernel at the end of this call.
rc = start();
} else {
+ mStreams[0]->bufDone(0);
ALOGD("%s: Request on an existing stream",__func__);
}
@@ -1088,7 +1089,7 @@
}
//Queue YUV buffers in the beginning mQueueAll = true
- rc = mYuvMemory->allocate(QCamera3PicChannel::kMaxBuffers + 1, len, true);
+ rc = mYuvMemory->allocate(1, len, true);
if (rc < 0) {
ALOGE("%s: unable to allocate metadata memory", __func__);
delete mYuvMemory;
diff --git a/camera/QCamera2/HAL3/QCamera3PostProc.cpp b/camera/QCamera2/HAL3/QCamera3PostProc.cpp
index 632c686..1f25440 100644
--- a/camera/QCamera2/HAL3/QCamera3PostProc.cpp
+++ b/camera/QCamera2/HAL3/QCamera3PostProc.cpp
@@ -546,7 +546,6 @@
}
if (NULL != job->src_frame) {
- releaseSuperBuf(job->src_frame);
free(job->src_frame);
job->src_frame = NULL;
}