QCamera2: Changes to release video duped FD's.
Issue: Android camera framework expects camera HAL modules to release video duped FD's. Framework can trigger this event after stopRecording() call. Fix: Change to avoid state machine check to release video FD's. CRs-Fixed: 1077211 Change-Id: I6dcc31b335679e4885f56ae1e4e02ee33d193b08
This commit is contained in:
parent
c93f5696c8
commit
a93a2741fc
3 changed files with 51 additions and 5 deletions
|
@ -1603,7 +1603,7 @@ native_handle_t *QCameraVideoMemory::getNativeHandle(uint32_t index, bool metada
|
|||
/*===========================================================================
|
||||
* FUNCTION : closeNativeHandle
|
||||
*
|
||||
* DESCRIPTION: close video native handle and update cached ptrs
|
||||
* DESCRIPTION: static function to close video native handle.
|
||||
*
|
||||
* PARAMETERS :
|
||||
* @data : ptr to video frame to be returned
|
||||
|
@ -1612,6 +1612,39 @@ native_handle_t *QCameraVideoMemory::getNativeHandle(uint32_t index, bool metada
|
|||
* NO_ERROR -- success
|
||||
* none-zero failure code
|
||||
*==========================================================================*/
|
||||
int QCameraVideoMemory::closeNativeHandle(const void *data)
|
||||
{
|
||||
int32_t rc = NO_ERROR;
|
||||
|
||||
#ifdef USE_MEDIA_EXTENSIONS
|
||||
const media_metadata_buffer *packet =
|
||||
(const media_metadata_buffer *)data;
|
||||
if ((packet != NULL) && (packet->eType ==
|
||||
kMetadataBufferTypeNativeHandleSource)
|
||||
&& (packet->pHandle)) {
|
||||
native_handle_close(packet->pHandle);
|
||||
native_handle_delete(packet->pHandle);
|
||||
} else {
|
||||
LOGE("Invalid Data. Could not release");
|
||||
return BAD_VALUE;
|
||||
}
|
||||
#endif
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
* FUNCTION : closeNativeHandle
|
||||
*
|
||||
* DESCRIPTION: close video native handle and update cached ptrs
|
||||
*
|
||||
* PARAMETERS :
|
||||
* @data : ptr to video frame to be returned
|
||||
* @metadata : Flag to update metadata mode
|
||||
*
|
||||
* RETURN : int32_t type of status
|
||||
* NO_ERROR -- success
|
||||
* none-zero failure code
|
||||
*==========================================================================*/
|
||||
int QCameraVideoMemory::closeNativeHandle(const void *data, bool metadata)
|
||||
{
|
||||
int32_t rc = NO_ERROR;
|
||||
|
|
|
@ -233,8 +233,9 @@ public:
|
|||
int getUsage(){return mUsage;};
|
||||
int getFormat(){return mFormat;};
|
||||
int convCamtoOMXFormat(cam_format_t format);
|
||||
int closeNativeHandle(const void *data, bool metadata = true);
|
||||
int closeNativeHandle(const void *data, bool metadata);
|
||||
native_handle_t *getNativeHandle(uint32_t index, bool metadata = true);
|
||||
static int closeNativeHandle(const void *data);
|
||||
private:
|
||||
camera_memory_t *mMetadata[MM_CAMERA_MAX_NUM_FRAMES];
|
||||
uint8_t mMetaBufCount;
|
||||
|
|
|
@ -634,12 +634,16 @@ int32_t QCameraStateMachine::procEvtPreviewStoppedState(qcamera_sm_evt_enum_t ev
|
|||
m_parent->signalAPIResult(&result);
|
||||
}
|
||||
break;
|
||||
case QCAMERA_SM_EVT_RELEASE_RECORIDNG_FRAME:
|
||||
{
|
||||
LOGW("Free video handle %d %d", evt, m_state);
|
||||
QCameraVideoMemory::closeNativeHandle((const void *)payload);
|
||||
}
|
||||
case QCAMERA_SM_EVT_PRE_START_RECORDING:
|
||||
case QCAMERA_SM_EVT_RESTART_STOP_PREVIEW:
|
||||
case QCAMERA_SM_EVT_RESTART_START_PREVIEW:
|
||||
case QCAMERA_SM_EVT_START_RECORDING:
|
||||
case QCAMERA_SM_EVT_STOP_RECORDING:
|
||||
case QCAMERA_SM_EVT_RELEASE_RECORIDNG_FRAME:
|
||||
case QCAMERA_SM_EVT_PREPARE_SNAPSHOT:
|
||||
case QCAMERA_SM_EVT_PRE_TAKE_PICTURE:
|
||||
case QCAMERA_SM_EVT_TAKE_PICTURE:
|
||||
|
@ -1050,6 +1054,11 @@ int32_t QCameraStateMachine::procEvtPreviewReadyState(qcamera_sm_evt_enum_t evt,
|
|||
m_parent->signalAPIResult(&result);
|
||||
}
|
||||
break;
|
||||
case QCAMERA_SM_EVT_RELEASE_RECORIDNG_FRAME:
|
||||
{
|
||||
LOGW("Free video handle %d %d", evt, m_state);
|
||||
QCameraVideoMemory::closeNativeHandle((const void *)payload);
|
||||
}
|
||||
case QCAMERA_SM_EVT_PRE_START_RECORDING:
|
||||
case QCAMERA_SM_EVT_RESTART_STOP_PREVIEW:
|
||||
case QCAMERA_SM_EVT_RESTART_START_PREVIEW:
|
||||
|
@ -1059,7 +1068,6 @@ int32_t QCameraStateMachine::procEvtPreviewReadyState(qcamera_sm_evt_enum_t evt,
|
|||
case QCAMERA_SM_EVT_PRE_TAKE_PICTURE:
|
||||
case QCAMERA_SM_EVT_TAKE_PICTURE:
|
||||
case QCAMERA_SM_EVT_CANCEL_PICTURE:
|
||||
case QCAMERA_SM_EVT_RELEASE_RECORIDNG_FRAME:
|
||||
case QCAMERA_SM_EVT_RELEASE:
|
||||
{
|
||||
LOGE("Error!! cannot handle evt(%d) in state(%d)", evt, m_state);
|
||||
|
@ -1580,9 +1588,13 @@ int32_t QCameraStateMachine::procEvtPreviewingState(qcamera_sm_evt_enum_t evt,
|
|||
m_parent->signalAPIResult(&result);
|
||||
}
|
||||
break;
|
||||
case QCAMERA_SM_EVT_RELEASE_RECORIDNG_FRAME:
|
||||
{
|
||||
LOGW("Free video handle %d %d", evt, m_state);
|
||||
QCameraVideoMemory::closeNativeHandle((const void *)payload);
|
||||
}
|
||||
case QCAMERA_SM_EVT_CANCEL_PICTURE:
|
||||
case QCAMERA_SM_EVT_STOP_RECORDING:
|
||||
case QCAMERA_SM_EVT_RELEASE_RECORIDNG_FRAME:
|
||||
case QCAMERA_SM_EVT_RELEASE:
|
||||
{
|
||||
LOGE("Error!! cannot handle evt(%d) in state(%d)", evt, m_state);
|
||||
|
|
Loading…
Reference in a new issue