android摄像头取景,Android手机后摄像头在拍照后,取景界面会闪一下(丢掉3帧)...
diff --git a/src/LINUX/android/hardware/qcom/camera/QCamera2/HAL/QCamera2HWI.cpp b/src/LINUX/android/hardware/qcom/camera/QCamera2/HAL/QCamera2HWI.cppold mode 100644new mode 100755index aa63580..e730a
diff --git a/src/LINUX/android/hardware/qcom/camera/QCamera2/HAL/QCamera2HWI.cpp b/src/LINUX/android/hardware/qcom/camera/QCamera2/HAL/QCamera2HWI.cpp
old mode 100644
new mode 100755
index aa63580..e730ab0
--- a/src/LINUX/android/hardware/qcom/camera/QCamera2/HAL/QCamera2HWI.cpp
+++ b/src/LINUX/android/hardware/qcom/camera/QCamera2/HAL/QCamera2HWI.cpp
@@ -966,7 +966,8 @@ QCamera2HardwareInterface::QCamera2HardwareInterface(int cameraId)
m_max_pic_width(0),
m_max_pic_height(0),
mFlashNeeded(false),
- mCaptureRotation(0)
+ mCaptureRotation(0),
+ m_dropFrame(0) //young.yang add
{
mCameraDevice.common.tag = HARDWARE_DEVICE_TAG;
mCameraDevice.common.version = HARDWARE_DEVICE_API_VERSION(1, 0);
diff --git a/src/LINUX/android/hardware/qcom/camera/QCamera2/HAL/QCamera2HWI.h b/src/LINUX/android/hardware/qcom/camera/QCamera2/HAL/QCamera2HWI.h
old mode 100644
new mode 100755
index e892770..8f9ecb2
--- a/src/LINUX/android/hardware/qcom/camera/QCamera2/HAL/QCamera2HWI.h
+++ b/src/LINUX/android/hardware/qcom/camera/QCamera2/HAL/QCamera2HWI.h
@@ -506,6 +506,7 @@ private:
int32_t mFlash;
int32_t mRedEye;
int32_t mFlashPresence;
+ int32_t m_dropFrame; //young.yang add
};
}; // namespace qcamera
diff --git a/src/LINUX/android/hardware/qcom/camera/QCamera2/HAL/QCamera2HWICallbacks.cpp b/src/LINUX/android/hardware/qcom/camera/QCamera2/HAL/QCamera2HWICallbacks.cpp
old mode 100644
new mode 100755
index 0211a92..1fe41ed
--- a/src/LINUX/android/hardware/qcom/camera/QCamera2/HAL/QCamera2HWICallbacks.cpp
+++ b/src/LINUX/android/hardware/qcom/camera/QCamera2/HAL/QCamera2HWICallbacks.cpp
@@ -37,6 +37,8 @@
namespace qcamera {
+int needDrop = 0;
+
/*===========================================================================
* FUNCTION : zsl_channel_cb
*
@@ -402,11 +404,18 @@ void QCamera2HardwareInterface::preview_stream_cb_routine(mm_camera_super_buf_t
if(pme->m_bPreviewStarted) {
ALOGE("[KPI Perf] %s : PROFILE_FIRST_PREVIEW_FRAME", __func__);
pme->m_bPreviewStarted = false ;
+ pme->m_dropFrame =3; //young.yang add began
}
+ if(--(pme->m_dropFrame)>0)
+ needDrop =1;
+ else
+ needDrop =0; //young.yang add end
+
// Display the buffer.
ALOGV("%p displayBuffer %d E", pme, idx);
- int dequeuedIdx = memory->displayBuffer(idx);
+ //int dequeuedIdx = memory->displayBuffer(idx);
+ int dequeuedIdx = memory->displayBuffer(idx,needDrop); //young.yang change
if (dequeuedIdx < 0 || dequeuedIdx >= memory->getCnt()) {
ALOGD("%s: Invalid dequeued buffer index %d from display",
__func__, dequeuedIdx);
diff --git a/src/LINUX/android/hardware/qcom/camera/QCamera2/HAL/QCameraMem.cpp b/src/LINUX/android/hardware/qcom/camera/QCamera2/HAL/QCameraMem.cpp
old mode 100644
new mode 100755
index 8c09e6b..a95056d
--- a/src/LINUX/android/hardware/qcom/camera/QCamera2/HAL/QCameraMem.cpp
+++ b/src/LINUX/android/hardware/qcom/camera/QCamera2/HAL/QCameraMem.cpp
@@ -1104,7 +1104,7 @@ void QCameraGrallocMemory::setWindowInfo(preview_stream_ops_t *window,
* NO_ERROR -- success
* none-zero failure code
*==========================================================================*/
-int QCameraGrallocMemory::displayBuffer(int index)
+int QCameraGrallocMemory::displayBuffer(int index,int needDrop)
{
int err = NO_ERROR;
int dequeuedIdx = BAD_INDEX;
@@ -1114,7 +1114,10 @@ int QCameraGrallocMemory::displayBuffer(int index)
return INVALID_OPERATION;
}
- err = mWindow->enqueue_buffer(mWindow, (buffer_handle_t *)mBufferHandle[index]);
+ if (needDrop) //young.yang add began
+ err = mWindow->cancel_buffer(mWindow, (buffer_handle_t *)mBufferHandle[index]);
+ else //young.yang add end
+ err = mWindow->enqueue_buffer(mWindow, (buffer_handle_t *)mBufferHandle[index]);
if(err != 0) {
ALOGE("%s: enqueue_buffer failed, err = %d", __func__, err);
} else {
diff --git a/src/LINUX/android/hardware/qcom/camera/QCamera2/HAL/QCameraMem.h b/src/LINUX/android/hardware/qcom/camera/QCamera2/HAL/QCameraMem.h
old mode 100644
new mode 100755
index 1dee2cd..067548b
--- a/src/LINUX/android/hardware/qcom/camera/QCamera2/HAL/QCameraMem.h
+++ b/src/LINUX/android/hardware/qcom/camera/QCamera2/HAL/QCameraMem.h
@@ -170,7 +170,9 @@ public:
// Enqueue/display buffer[index] onto the native window,
// and dequeue one buffer from it.
// Returns the buffer index of the dequeued buffer.
- int displayBuffer(int index);
+ //int displayBuffer(int index);
+ int displayBuffer(int index,int needDrop); //young.yang add
+
private:
buffer_handle_t *mBufferHandle[MM_CAMERA_MAX_NUM_FRAMES];
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)