mirror of
https://github.com/followmsi/android_hardware_qcom_media.git
synced 2024-10-31 22:47:35 +00:00
mm-video-v4l2: venc: add extension to support av-timer timestamps
Use timestamps sent in-band with graphic handles (updated from camera with av-timer source) for vt usecases. Bug: 32746650 CRs-Fixed: 2026950 Change-Id: I5af29b0155eb108e4d9f0bae76fa72a947e719c2
This commit is contained in:
parent
a017ca7cd1
commit
75b571e76a
6 changed files with 65 additions and 2 deletions
|
@ -638,6 +638,9 @@ enum OMX_QCOM_EXTN_INDEXTYPE
|
|||
|
||||
/* Suggest how big Iframe sizes should be */
|
||||
OMX_QTIIndexParamIframeSizeType = 0x7F000070,
|
||||
|
||||
/* use av-timer ticks as timestamp (used by VT-client) */
|
||||
OMX_QTIIndexParamEnableAVTimerTimestamps = 0x7F000071,
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -685,6 +685,7 @@ class omx_video: public qc_omx_component
|
|||
DescribeColorAspectsParams m_sConfigColorAspects;
|
||||
OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE m_sParamTemporalLayers;
|
||||
OMX_VIDEO_CONFIG_ANDROID_TEMPORALLAYERINGTYPE m_sConfigTemporalLayers;
|
||||
QOMX_ENABLETYPE m_sParamAVTimerTimestampMode; // use VT-timestamps in gralloc-handle
|
||||
|
||||
// fill this buffer queue
|
||||
omx_cmd_queue m_ftb_q;
|
||||
|
|
|
@ -640,6 +640,7 @@ class venc_dev
|
|||
|
||||
};
|
||||
BatchInfo mBatchInfo;
|
||||
bool mUseAVTimerTimestamps;
|
||||
};
|
||||
|
||||
enum instance_state {
|
||||
|
|
|
@ -574,6 +574,9 @@ OMX_ERRORTYPE omx_venc::component_init(OMX_STRING role)
|
|||
|
||||
OMX_INIT_STRUCT(&m_sConfigTemporalLayers, OMX_VIDEO_CONFIG_ANDROID_TEMPORALLAYERINGTYPE);
|
||||
|
||||
OMX_INIT_STRUCT(&m_sParamAVTimerTimestampMode, QOMX_ENABLETYPE);
|
||||
m_sParamAVTimerTimestampMode.bEnable = OMX_FALSE;
|
||||
|
||||
m_state = OMX_StateLoaded;
|
||||
m_sExtraData = 0;
|
||||
|
||||
|
@ -1786,6 +1789,17 @@ OMX_ERRORTYPE omx_venc::set_parameter(OMX_IN OMX_HANDLETYPE hComp,
|
|||
}
|
||||
break;
|
||||
}
|
||||
case OMX_QTIIndexParamEnableAVTimerTimestamps:
|
||||
{
|
||||
VALIDATE_OMX_PARAM_DATA(paramData, QOMX_ENABLETYPE);
|
||||
if (!handle->venc_set_param(paramData,
|
||||
(OMX_INDEXTYPE)OMX_QTIIndexParamEnableAVTimerTimestamps)) {
|
||||
DEBUG_PRINT_ERROR("ERROR: Setting OMX_QTIIndexParamEnableAVTimerTimestamps failed");
|
||||
return OMX_ErrorUnsupportedSetting;
|
||||
}
|
||||
memcpy(&m_sParamAVTimerTimestampMode, paramData, sizeof(QOMX_ENABLETYPE));
|
||||
break;
|
||||
}
|
||||
case OMX_IndexParamVideoSliceFMO:
|
||||
default:
|
||||
{
|
||||
|
|
|
@ -44,6 +44,9 @@ void omx_video::init_vendor_extensions(VendorExtensionStore &store) {
|
|||
ADD_EXTENSION("qti-ext-enc-custom-profile-level", OMX_IndexParamVideoProfileLevelCurrent, OMX_DirOutput)
|
||||
ADD_PARAM ("profile", OMX_AndroidVendorValueInt32)
|
||||
ADD_PARAM_END("level", OMX_AndroidVendorValueInt32)
|
||||
|
||||
ADD_EXTENSION("qti-ext-enc-timestamp-source-avtimer", OMX_QTIIndexParamEnableAVTimerTimestamps, OMX_DirInput)
|
||||
ADD_PARAM_END("enable", OMX_AndroidVendorValueInt32)
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE omx_video::get_vendor_extension_config(
|
||||
|
@ -66,7 +69,7 @@ OMX_ERRORTYPE omx_video::get_vendor_extension_config(
|
|||
|
||||
bool setStatus = true;
|
||||
|
||||
switch (vExt.extensionIndex()) {
|
||||
switch ((OMX_U32)vExt.extensionIndex()) {
|
||||
case OMX_IndexConfigCommonRotate:
|
||||
{
|
||||
setStatus &= vExt.setParamInt32(ext, "angle", m_sConfigFrameRotation.nRotation);
|
||||
|
@ -92,6 +95,11 @@ OMX_ERRORTYPE omx_video::get_vendor_extension_config(
|
|||
|
||||
break;
|
||||
}
|
||||
case OMX_QTIIndexParamEnableAVTimerTimestamps:
|
||||
{
|
||||
setStatus &= vExt.setParamInt32(ext, "enable", m_sParamAVTimerTimestampMode.bEnable);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return OMX_ErrorNotImplemented;
|
||||
|
@ -124,7 +132,7 @@ OMX_ERRORTYPE omx_video::set_vendor_extension_config(
|
|||
vExt.set();
|
||||
|
||||
bool valueSet = false;
|
||||
switch (vExt.extensionIndex()) {
|
||||
switch ((OMX_U32)vExt.extensionIndex()) {
|
||||
case OMX_IndexConfigCommonRotate:
|
||||
{
|
||||
OMX_CONFIG_ROTATIONTYPE rotationParam;
|
||||
|
@ -205,7 +213,25 @@ OMX_ERRORTYPE omx_video::set_vendor_extension_config(
|
|||
|
||||
break;
|
||||
}
|
||||
case OMX_QTIIndexParamEnableAVTimerTimestamps:
|
||||
{
|
||||
QOMX_ENABLETYPE avTimerEnableParam;
|
||||
memcpy(&avTimerEnableParam, &m_sParamAVTimerTimestampMode, sizeof(QOMX_ENABLETYPE));
|
||||
valueSet |= vExt.readParamInt32(ext, "enable", (OMX_S32 *)&(avTimerEnableParam.bEnable));
|
||||
if (!valueSet) {
|
||||
break;
|
||||
}
|
||||
|
||||
DEBUG_PRINT_HIGH("VENDOR-EXT: AV-timer timestamp mode enable=%u", avTimerEnableParam.bEnable);
|
||||
|
||||
err = set_parameter(
|
||||
NULL, (OMX_INDEXTYPE)OMX_QTIIndexParamEnableAVTimerTimestamps, &avTimerEnableParam);
|
||||
if (err != OMX_ErrorNone) {
|
||||
DEBUG_PRINT_ERROR("set_param: OMX_QTIIndexParamEnableAVTimerTimestamps failed !");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return OMX_ErrorNotImplemented;
|
||||
|
|
|
@ -270,6 +270,8 @@ venc_dev::venc_dev(class omx_venc *venc_class)
|
|||
|
||||
snprintf(m_debug.log_loc, PROPERTY_VALUE_MAX,
|
||||
"%s", BUFFER_LOG_LOC);
|
||||
|
||||
mUseAVTimerTimestamps = false;
|
||||
}
|
||||
|
||||
venc_dev::~venc_dev()
|
||||
|
@ -2652,6 +2654,13 @@ bool venc_dev::venc_set_param(void *paramData, OMX_INDEXTYPE index)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case OMX_QTIIndexParamEnableAVTimerTimestamps:
|
||||
{
|
||||
QOMX_ENABLETYPE *pParam = (QOMX_ENABLETYPE *)paramData;
|
||||
mUseAVTimerTimestamps = pParam->bEnable == OMX_TRUE;
|
||||
DEBUG_PRINT_INFO("AVTimer timestamps enabled");
|
||||
break;
|
||||
}
|
||||
case OMX_IndexParamVideoSliceFMO:
|
||||
default:
|
||||
DEBUG_PRINT_ERROR("ERROR: Unsupported parameter in venc_set_param: %u",
|
||||
|
@ -3963,6 +3972,15 @@ bool venc_dev::venc_empty_buf(void *buffer, void *pmem_data_buf, unsigned index,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (mUseAVTimerTimestamps) {
|
||||
uint64_t avTimerTimestampNs = bufhdr->nTimeStamp * 1000;
|
||||
if (getMetaData(handle, GET_VT_TIMESTAMP, &avTimerTimestampNs) == 0
|
||||
&& avTimerTimestampNs > 0) {
|
||||
bufhdr->nTimeStamp = avTimerTimestampNs / 1000;
|
||||
DEBUG_PRINT_LOW("AVTimer TS : %llu us", (unsigned long long)bufhdr->nTimeStamp);
|
||||
}
|
||||
}
|
||||
|
||||
if (!streaming[OUTPUT_PORT]) {
|
||||
int color_space = 0;
|
||||
// Moment of truth... actual colorspace is known here..
|
||||
|
|
Loading…
Reference in a new issue