summaryrefslogtreecommitdiff
path: root/omx/base
diff options
context:
space:
mode:
authorAngela Stegmaier <angelabaker@ti.com>2017-05-16 17:26:03 -0500
committerAngela Stegmaier <angelabaker@ti.com>2017-06-27 11:31:13 -0500
commit5db0f6c5a0b0c0f5d69efe6f8d5a107182826c66 (patch)
treeb4d67f0b67fac5e2fc3c93d60ab713aaa25ee671 /omx/base
parent2b4b1b5ea6d46e39bc15b34b38b3046c96888da4 (diff)
downloaddra7xx-5db0f6c5a0b0c0f5d69efe6f8d5a107182826c66.tar.gz
OMX: VIDDEC: Add checking for locked buffers
The OMX Video Decoder was not checking for whether a buffer was still locked for reference by the decoder codec, and it was therefore possible that "locked" output buffers could be passed back to the decoder to use again while it was still being used for reference. For certain complex streams this resulted in visible artifacts in the decoded output. The codec provides two lists of buffers back after each process call: a list of "displayable" buffers, and a list of "freed" buffers. A buffer may be displayable before it is freed by the codec. Once a buffer is displayable, it can be sent to for rendering. TI OMX component indicates that the buffer is displayable by sending it to stagefright. Once stagefright receives and displays it, it returns it back to the TI OMX component. At this point, the TI OMX component should not send the buffer back to the codec until the codec indicates that it is also "freed." This patch adds the necessary logic to track the "locked" state of the output buffers. Before passing an output buffer to the codec process call, the buffer must no longer be in the "locked" state. Buffers are marked as locked when they are passed to the codec process call, and are marked as un-locked when the codec frees the buffer through the freeBufId list. Change-Id: I4608fa5fbf367849f4cacde3b572a47a7249f71c Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
Diffstat (limited to 'omx/base')
-rw-r--r--omx/base/omx_base_comp/inc/omx_base.h1
-rw-r--r--omx/base/omx_base_comp/inc/omx_base_internal.h2
-rw-r--r--omx/base/omx_base_comp/src/omx_base_internal.c1
-rw-r--r--omx/base/omx_base_dio_plugin/src/omx_base_dio_non_tunnel.c1
4 files changed, 5 insertions, 0 deletions
diff --git a/omx/base/omx_base_comp/inc/omx_base.h b/omx/base/omx_base_comp/inc/omx_base.h
index 2690133..c3b32fb 100644
--- a/omx/base/omx_base_comp/inc/omx_base.h
+++ b/omx/base/omx_base_comp/inc/omx_base.h
@@ -60,6 +60,7 @@ typedef enum OMXBase_BufferStatus{
typedef struct OMXBase_BufHdrPrivateData {
MemHeader sMemHdr[MAX_PLANES_PER_BUFFER];
OMXBase_BufStatus bufSt;
+ OMX_BOOL bIsLocked;
}OMXBase_BufHdrPvtData;
typedef struct OMXBase_CodecConfigBuffer {
diff --git a/omx/base/omx_base_comp/inc/omx_base_internal.h b/omx/base/omx_base_comp/inc/omx_base_internal.h
index 7c0d1f5..ad1f171 100644
--- a/omx/base/omx_base_comp/inc/omx_base_internal.h
+++ b/omx/base/omx_base_comp/inc/omx_base_internal.h
@@ -100,6 +100,8 @@ typedef struct OMXBaseComp_Private {
OMX_ERRORTYPE (*fpDioGetCount)(OMX_HANDLETYPE hComponent, OMX_U32 nPortIndex, OMX_U32 *pCount);
+ OMX_ERRORTYPE (*fpDioQueue)(OMX_HANDLETYPE hComponent, OMX_U32 nPortIndex, OMX_PTR pBuffHeader);
+
OMX_ERRORTYPE (*fpDioDequeue)(OMX_HANDLETYPE hComponent, OMX_U32 nPortIndex, OMX_PTR *pBuffHeader);
OMX_ERRORTYPE (*fpDioSend)(OMX_HANDLETYPE hComponent, OMX_U32 nPortIndex, OMX_PTR pBuffHeader);
diff --git a/omx/base/omx_base_comp/src/omx_base_internal.c b/omx/base/omx_base_comp/src/omx_base_internal.c
index 605a54d..bb1a5e1 100644
--- a/omx/base/omx_base_comp/src/omx_base_internal.c
+++ b/omx/base/omx_base_comp/src/omx_base_internal.c
@@ -116,6 +116,7 @@ OMX_ERRORTYPE OMXBase_PrivateInit(OMX_HANDLETYPE hComponent)
/* Set hooks from Derived to Base communicattion */
pBaseCompPvt->fpDioGetCount = OMXBase_DIO_GetCount;
+ pBaseCompPvt->fpDioQueue = OMXBase_DIO_Queue;
pBaseCompPvt->fpDioDequeue = OMXBase_DIO_Dequeue;
pBaseCompPvt->fpDioSend = OMXBase_DIO_Send;
pBaseCompPvt->fpDioCancel = OMXBase_DIO_Cancel;
diff --git a/omx/base/omx_base_dio_plugin/src/omx_base_dio_non_tunnel.c b/omx/base/omx_base_dio_plugin/src/omx_base_dio_non_tunnel.c
index 6f55fe1..868a2da 100644
--- a/omx/base/omx_base_dio_plugin/src/omx_base_dio_non_tunnel.c
+++ b/omx/base/omx_base_dio_plugin/src/omx_base_dio_non_tunnel.c
@@ -213,6 +213,7 @@ static OMX_ERRORTYPE OMX_DIO_NonTunnel_Open (OMX_HANDLETYPE handle,
(OMXBase_BufHdrPvtData *)(pContext->pPlatformPrivatePool) + i;
((OMXBase_BufHdrPvtData *)(pPort->pBufferlist[i]->pPlatformPrivate))->bufSt = OWNED_BY_CLIENT;
+ ((OMXBase_BufHdrPvtData *)(pPort->pBufferlist[i]->pPlatformPrivate))->bIsLocked = OMX_FALSE;
if( pPort->bIsBufferAllocator) {
MemHeader *h = &(((OMXBase_BufHdrPvtData *)(pPort->pBufferlist[i]->pPlatformPrivate))->sMemHdr[0]);