diff options
author | Govindaraj Rajagopal <grajagop@codeaurora.org> | 2020-11-23 15:49:42 +0530 |
---|---|---|
committer | Sanjay Singh <sisanj@codeaurora.org> | 2021-02-03 16:45:47 +0530 |
commit | 2e832846f205824c98b821e90c0c372db075c852 (patch) | |
tree | 00a08703aef7717bbd9a95c27c9b6526a251edf9 | |
parent | 2e4c39d6e67475a57a739b3bb1041f1692daefca (diff) |
mm-video-v4l2: venc: reject camera buffers from previous session
Reject buffers with new dimension, if configured resolution
is different.
Change-Id: If8123adb9dec1de307ebfaed6f813f8bb1d8c516
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
Signed-off-by: Sanjay Singh <sisanj@codeaurora.org>
-rw-r--r-- | mm-video-v4l2/vidc/venc/src/omx_video_base.cpp | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp index eb5016df..3532f505 100644 --- a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp +++ b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp @@ -1,5 +1,5 @@ /*-------------------------------------------------------------------------- -Copyright (c) 2010-2020, Linux Foundation. All rights reserved. +Copyright (c) 2010-2021, Linux Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -5270,6 +5270,44 @@ OMX_ERRORTYPE omx_video::empty_this_buffer_opaque(OMX_IN OMX_HANDLETYPE hComp, return OMX_ErrorNone; } + if (dev_is_meta_mode()) { + LEGACY_CAM_METADATA_TYPE * meta_buf = NULL; + + meta_buf = (LEGACY_CAM_METADATA_TYPE *)buffer->pBuffer; + + if (meta_buf && m_no_vpss && is_rotation_enabled() && + meta_buf->buffer_type == kMetadataBufferTypeGrallocSource) { + VideoGrallocMetadata *meta_buf = (VideoGrallocMetadata *)buffer->pBuffer; +#ifdef USE_GBM + struct gbm_bo *handle = (struct gbm_bo *)meta_buf->pHandle; +#else + private_handle_t *handle = (private_handle_t *)meta_buf->pHandle; +#endif + if (!handle) { + DEBUG_PRINT_ERROR("%s : handle is null!", __FUNCTION__); + return OMX_ErrorUndefined; + } + + // if input buffer dimensions is different from what is configured, + // reject the buffer +#ifdef USE_GBM + if (ALIGN((int)m_sInPortDef.format.video.nFrameWidth,32) != ALIGN(handle->width,32) || + ALIGN((int)m_sInPortDef.format.video.nFrameHeight,32) != ALIGN(handle->height,32)) { + ALOGE("%s: Graphic buf size(%dx%d) does not match configured size(%ux%u)", + __func__, handle->width, handle->height, +#else + if (ALIGN((int)m_sInPortDef.format.video.nFrameWidth,32) != ALIGN(handle->unaligned_width,32) || + ALIGN((int)m_sInPortDef.format.video.nFrameHeight,32) != ALIGN(handle->unaligned_height,32)) { + ALOGE("%s: Graphic buf size(%dx%d) does not match configured size(%ux%u)", + __func__, handle->unaligned_width, handle->unaligned_height, +#endif + m_sInPortDef.format.video.nFrameWidth, m_sInPortDef.format.video.nFrameHeight); + m_pCallbacks.EmptyBufferDone(hComp, m_app_data, buffer); + return OMX_ErrorNone; + } + } + } + if (!psource_frame) { psource_frame = buffer; ret = push_input_buffer(hComp); |