video_dec: Add buffer index reset scheme.
authorSeungBeom Kim <sbcrux.kim@samsung.com>
Sun, 29 Mar 2015 10:14:03 +0000 (12:14 +0200)
committerGerrit Code Review <gerrit@cyanogenmod.org>
Tue, 31 Mar 2015 17:19:13 +0000 (17:19 +0000)
Add buffer index reset scheme when the Dynamic Resolution Change with
dynamic DPB Change working.

Backported-from: hardware/samsung_sli/exynos5

Change-Id: Id0bd2b8f1271c240a7280a7e3f39fdc802a7c339
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
component/video/dec/h264/Exynos_OMX_H264dec.c
component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c
component/video/dec/vp8/Exynos_OMX_Vp8dec.c

index 5cdff3eff319e94e03509885df9a2a47bc5d2814..83658b0aec1f3feaa1843c64e90525472cbf8f74 100644 (file)
@@ -480,11 +480,16 @@ OMX_ERRORTYPE H264CodecStop(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex
     pInbufOps  = pH264Dec->hMFCH264Handle.pInbufOps;
     pOutbufOps = pH264Dec->hMFCH264Handle.pOutbufOps;
 
-    if ((nPortIndex == INPUT_PORT_INDEX) && (pInbufOps != NULL))
+    if ((nPortIndex == INPUT_PORT_INDEX) && (pInbufOps != NULL)) {
         pInbufOps->Stop(hMFCHandle);
-    else if ((nPortIndex == OUTPUT_PORT_INDEX) && (pOutbufOps != NULL))
+    } else if ((nPortIndex == OUTPUT_PORT_INDEX) && (pOutbufOps != NULL)) {
+        EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+        EXYNOS_OMX_BASEPORT *pExynosOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX];
         pOutbufOps->Stop(hMFCHandle);
-
+        if (pExynosOutputPort->bufferProcessType == BUFFER_SHARE) {
+            pOutbufOps->Clear_RegisteredBuffer(hMFCHandle);
+        }
+    }
     ret = OMX_ErrorNone;
 
 EXIT:
index 627c17c640f95535a619277b044c02171e8d7443..f582d24cdcd5e8ac744a8ce16ab9bc9d173f4ceb 100644 (file)
@@ -570,11 +570,16 @@ OMX_ERRORTYPE Mpeg4CodecStop(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortInde
     pInbufOps  = pMpeg4Dec->hMFCMpeg4Handle.pInbufOps;
     pOutbufOps = pMpeg4Dec->hMFCMpeg4Handle.pOutbufOps;
 
-    if ((nPortIndex == INPUT_PORT_INDEX) && (pInbufOps != NULL))
+    if ((nPortIndex == INPUT_PORT_INDEX) && (pInbufOps != NULL)) {
         pInbufOps->Stop(hMFCHandle);
-    else if ((nPortIndex == OUTPUT_PORT_INDEX) && (pOutbufOps != NULL))
+    } else if ((nPortIndex == OUTPUT_PORT_INDEX) && (pOutbufOps != NULL)) {
+        EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+        EXYNOS_OMX_BASEPORT *pExynosOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX];
         pOutbufOps->Stop(hMFCHandle);
-
+        if (pExynosOutputPort->bufferProcessType == BUFFER_SHARE) {
+            pOutbufOps->Clear_RegisteredBuffer(hMFCHandle);
+        }
+    }
     ret = OMX_ErrorNone;
 
 EXIT:
index 25b6da8dc705110a9620ede9bfed15866b8c9f1a..4bf09755442cbce65641c4341e7447730804c279 100644 (file)
@@ -385,11 +385,16 @@ OMX_ERRORTYPE VP8CodecStop(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex)
     pInbufOps  = pVp8Dec->hMFCVp8Handle.pInbufOps;
     pOutbufOps = pVp8Dec->hMFCVp8Handle.pOutbufOps;
 
-    if ((nPortIndex == INPUT_PORT_INDEX) && (pInbufOps != NULL))
+    if ((nPortIndex == INPUT_PORT_INDEX) && (pInbufOps != NULL)) {
         pInbufOps->Stop(hMFCHandle);
-    else if ((nPortIndex == OUTPUT_PORT_INDEX) && (pOutbufOps != NULL))
+    } else if ((nPortIndex == OUTPUT_PORT_INDEX) && (pOutbufOps != NULL)) {
+        EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+        EXYNOS_OMX_BASEPORT *pExynosOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX];
         pOutbufOps->Stop(hMFCHandle);
-
+        if (pExynosOutputPort->bufferProcessType == BUFFER_SHARE) {
+            pOutbufOps->Clear_RegisteredBuffer(hMFCHandle);
+        }
+    }
     ret = OMX_ErrorNone;
 
 EXIT: