mm-video-v4l2: Set V4L2_FLAG_CVPMETADATA_SKIP flag
Set skip flag if cvp is enabled and metadata is not available to signify
that this particular frame is skipped for cvp processing.
Change-Id: If756486235a9cf9923d796421319a28239e1d898
diff --git a/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h b/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
index 18b87f7..a8e77f2 100644
--- a/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
+++ b/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
@@ -460,7 +460,7 @@
bool venc_set_extradata_hdr10metadata(OMX_U32 omx_profile);
bool venc_store_dynamic_config(OMX_INDEXTYPE type, OMX_PTR config);
bool venc_cvp_enable(private_handle_t *handle);
- bool venc_get_cvp_metadata(private_handle_t *handle);
+ bool venc_get_cvp_metadata(private_handle_t *handle, struct v4l2_buffer *buf);
bool venc_superframe_enable(private_handle_t *handle);
OMX_U32 pmem_free();
diff --git a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
old mode 100755
new mode 100644
index 9335666..a9cc8b2
--- a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
+++ b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
@@ -2801,7 +2801,7 @@
}
} // Check OUTPUT Streaming
- venc_get_cvp_metadata(handle);
+ venc_get_cvp_metadata(handle, &buf);
struct UBWCStats cam_ubwc_stats[2];
unsigned long long int compression_ratio = 1 << 16;
@@ -4322,19 +4322,19 @@
m_cvp_meta_enabled = true;
DEBUG_PRINT_HIGH("CVP metadata enabled");
} else {
- DEBUG_PRINT_ERROR("ERROR: invalid CVP metadata, size %d",
- cvpMetadata.size);
+ DEBUG_PRINT_ERROR("ERROR: External CVP mode disabled for this session and continue!");
clearMetaData(handle, SET_CVP_METADATA);
}
}
return true;
}
-bool venc_dev::venc_get_cvp_metadata(private_handle_t *handle)
+bool venc_dev::venc_get_cvp_metadata(private_handle_t *handle, struct v4l2_buffer *buf)
{
if (!m_cvp_meta_enabled)
return true;
+ buf->flags &= ~V4L2_BUF_FLAG_CVPMETADATA_SKIP;
cvpMetadata.size = 0;
if (getMetaData(handle, GET_CVP_METADATA, &cvpMetadata) == 0) {
clearMetaData(handle, SET_CVP_METADATA);
@@ -4342,10 +4342,14 @@
DEBUG_PRINT_ERROR("ERROR: Invalid CVP metadata size %d",
cvpMetadata.size);
cvpMetadata.size = 0;
+ /* If camera sends metadata of size not matching to CVP_METADATA_SIZE,
+ it is considered as an error case. So, do not add skip flag */
return false;
}
DEBUG_PRINT_LOW("CVP metadata size %d", cvpMetadata.size);
} else {
+ buf->flags |= V4L2_BUF_FLAG_CVPMETADATA_SKIP;
+ DEBUG_PRINT_LOW("venc_empty_buf: V4L2_BUF_FLAG_CVPMETADATA_SKIP is set");
DEBUG_PRINT_LOW("CVP metadata not available");
}
return true;