Camera3: Fix rapid ZSL snapshots
-In case of rapid back to back snapshots framework reuses ZSL YUV frame -Remove code in HAL which assumes that once a buffer is passed as input it will not be used again Change-Id: I72a0f527de99b96508c7020455a47bfe754d9df4 Signed-off-by: Daniel Jarai <jaraidaniel@gmail.com>
This commit is contained in:
parent
80470cbf34
commit
b3386fd208
|
@ -844,6 +844,15 @@ void QCamera3PicChannel::jpegEvtHandle(jpeg_job_status_t status,
|
|||
int maxJpegSize;
|
||||
QCamera3PicChannel *obj = (QCamera3PicChannel *)userdata;
|
||||
if (obj) {
|
||||
|
||||
//Release any cached metabuffer information
|
||||
if (obj->mMetaFrame != NULL && obj->m_pMetaChannel != NULL) {
|
||||
((QCamera3MetadataChannel*)(obj->m_pMetaChannel))->bufDone(obj->mMetaFrame);
|
||||
obj->mMetaFrame = NULL;
|
||||
obj->m_pMetaChannel = NULL;
|
||||
} else {
|
||||
ALOGE("%s: Meta frame was NULL", __func__);
|
||||
}
|
||||
//Construct payload for process_capture_result. Call mChannelCb
|
||||
|
||||
qcamera_jpeg_data_t *job = obj->m_postprocessor.findJpegJobByJobId(jobId);
|
||||
|
@ -915,7 +924,8 @@ QCamera3PicChannel::QCamera3PicChannel(uint32_t cam_handle,
|
|||
mJpegSettings(NULL),
|
||||
mCurrentBufIndex(-1),
|
||||
mMemory(NULL),
|
||||
mYuvMemory(NULL)
|
||||
mYuvMemory(NULL),
|
||||
mMetaFrame(NULL)
|
||||
{
|
||||
int32_t rc = m_postprocessor.init(jpegEvtHandle, this);
|
||||
if (rc != 0) {
|
||||
|
@ -1274,8 +1284,13 @@ int QCamera3PicChannel::getJpegRotation() {
|
|||
return rotation;
|
||||
}
|
||||
|
||||
void QCamera3PicChannel::queueMetadata(mm_camera_super_buf_t *metadata_buf)
|
||||
void QCamera3PicChannel::queueMetadata(mm_camera_super_buf_t *metadata_buf,
|
||||
QCamera3Channel *pMetaChannel,
|
||||
bool relinquish)
|
||||
{
|
||||
if(relinquish)
|
||||
mMetaFrame = metadata_buf;
|
||||
m_pMetaChannel = pMetaChannel;
|
||||
m_postprocessor.processPPMetadata(metadata_buf);
|
||||
}
|
||||
/*===========================================================================
|
||||
|
@ -1853,7 +1868,6 @@ QCamera3ReprocessChannel::QCamera3ReprocessChannel(uint32_t cam_handle,
|
|||
picChHandle(ch_hdl),
|
||||
m_pSrcChannel(NULL),
|
||||
m_pMetaChannel(NULL),
|
||||
m_metaFrame(NULL),
|
||||
mMemory(NULL)
|
||||
{
|
||||
memset(mSrcStreamHandles, 0, sizeof(mSrcStreamHandles));
|
||||
|
@ -1935,12 +1949,6 @@ void QCamera3ReprocessChannel::streamCbRoutine(mm_camera_super_buf_t *super_fram
|
|||
return;
|
||||
}
|
||||
*frame = *super_frame;
|
||||
//queue back the metadata buffer
|
||||
if (m_metaFrame != NULL) {
|
||||
metadataBufDone(m_metaFrame);
|
||||
} else {
|
||||
ALOGE("%s: Meta frame was NULL", __func__);
|
||||
}
|
||||
obj->m_postprocessor.processPPData(frame);
|
||||
return;
|
||||
}
|
||||
|
@ -1956,8 +1964,7 @@ void QCamera3ReprocessChannel::streamCbRoutine(mm_camera_super_buf_t *super_fram
|
|||
*==========================================================================*/
|
||||
QCamera3ReprocessChannel::QCamera3ReprocessChannel() :
|
||||
m_pSrcChannel(NULL),
|
||||
m_pMetaChannel(NULL),
|
||||
m_metaFrame(NULL)
|
||||
m_pMetaChannel(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -2101,7 +2108,6 @@ int32_t QCamera3ReprocessChannel::doReprocess(mm_camera_super_buf_t *frame,
|
|||
ALOGE("%s: No source channel for reprocess", __func__);
|
||||
return -1;
|
||||
}
|
||||
m_metaFrame = meta_frame;
|
||||
for (int i = 0; i < frame->num_bufs; i++) {
|
||||
QCamera3Stream *pStream = getStreamBySourceHandle(frame->bufs[i]->stream_id);
|
||||
if (pStream != NULL) {
|
||||
|
|
|
@ -230,7 +230,9 @@ public:
|
|||
void *userdata);
|
||||
static void dataNotifyCB(mm_camera_super_buf_t *recvd_frame,
|
||||
void *userdata);
|
||||
void queueMetadata(mm_camera_super_buf_t *metadata_buf);
|
||||
void queueMetadata(mm_camera_super_buf_t *metadata_buf,
|
||||
QCamera3Channel *pMetaChannel,
|
||||
bool relinquish);
|
||||
|
||||
public:
|
||||
static int kMaxBuffers;
|
||||
|
@ -246,6 +248,8 @@ private:
|
|||
|
||||
QCamera3GrallocMemory *mMemory;
|
||||
QCamera3HeapMemory *mYuvMemory;
|
||||
QCamera3Channel *m_pMetaChannel;
|
||||
mm_camera_super_buf_t *mMetaFrame;
|
||||
};
|
||||
|
||||
// reprocess channel class
|
||||
|
@ -284,7 +288,6 @@ private:
|
|||
uint32_t mSrcStreamHandles[MAX_STREAM_NUM_IN_BUNDLE];
|
||||
QCamera3Channel *m_pSrcChannel; // ptr to source channel for reprocess
|
||||
QCamera3Channel *m_pMetaChannel;
|
||||
mm_camera_super_buf_t *m_metaFrame;
|
||||
QCamera3HeapMemory *mMemory;
|
||||
};
|
||||
|
||||
|
|
|
@ -965,12 +965,12 @@ int QCamera3HardwareInterface::processCaptureRequest(
|
|||
ALOGD("Stream id: %d", pInputBuffer->stream_id);
|
||||
ALOGD("streamtype:%d", pInputBuffer->stream_type);
|
||||
ALOGD("frame len:%d", pInputBuffer->frame_len);
|
||||
ALOGD("Handle:%p", request->input_buffer->buffer);
|
||||
//TODO: need to get corresponding metadata and send it to pproc
|
||||
for (List<MetadataBufferInfo>::iterator m = mStoredMetadataList.begin();
|
||||
m != mStoredMetadataList.end(); m++) {
|
||||
if (m->zsl_buf_hdl == request->input_buffer->buffer) {
|
||||
reproc_meta.meta_buf = m->meta_buf;
|
||||
m = mStoredMetadataList.erase(m);
|
||||
queueMetadata = 1;
|
||||
break;
|
||||
}
|
||||
|
@ -980,7 +980,7 @@ int QCamera3HardwareInterface::processCaptureRequest(
|
|||
rc = channel->request(output.buffer, frameNumber, mJpegSettings,
|
||||
pInputBuffer,(QCamera3Channel*)inputChannel);
|
||||
if (queueMetadata) {
|
||||
mPictureChannel->queueMetadata(reproc_meta.meta_buf);
|
||||
mPictureChannel->queueMetadata(reproc_meta.meta_buf,mMetadataChannel,false);
|
||||
}
|
||||
} else {
|
||||
ALOGV("%s: %d, request with buffer %p, frame_number %d", __func__,
|
||||
|
@ -1190,7 +1190,7 @@ void QCamera3HardwareInterface::captureResultCb(mm_camera_super_buf_t *metadata_
|
|||
j != i->buffers.end(); j++){
|
||||
if (j->stream->stream_type == CAMERA3_STREAM_OUTPUT &&
|
||||
j->stream->format == HAL_PIXEL_FORMAT_BLOB) {
|
||||
mPictureChannel->queueMetadata(metadata_buf);
|
||||
mPictureChannel->queueMetadata(metadata_buf,mMetadataChannel,true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1202,7 +1202,7 @@ void QCamera3HardwareInterface::captureResultCb(mm_camera_super_buf_t *metadata_
|
|||
}
|
||||
} else if (!mIsZslMode && i->blob_request) {
|
||||
//If it is a blob request then send the metadata to the picture channel
|
||||
mPictureChannel->queueMetadata(metadata_buf);
|
||||
mPictureChannel->queueMetadata(metadata_buf,mMetadataChannel,true);
|
||||
} else {
|
||||
// Return metadata buffer
|
||||
mMetadataChannel->bufDone(metadata_buf);
|
||||
|
|
Loading…
Reference in New Issue