remove misleading error messages: free only allocated ion buffers on exit staging/cm-12.0-caf
authorSeungBeom Kim <sbcrux.kim@samsung.com>
Mon, 1 Sep 2014 02:00:58 +0000 (11:00 +0900)
committerLajos Molnar <lajos@google.com>
Tue, 14 Oct 2014 00:28:40 +0000 (17:28 -0700)
Fixed of print error message that occurs at the end of the video play.
ex)
 E/ion(130): ioctl c0044901 failed with code -1: Invalid argument

Bug: 17720260
Change-Id: Ib823b8d5e9bf80a07917d17379d5e6d6022e8a66
Signed-off-by: SeungBeom Kim <sbcrux.kim@samsung.com>
exynos_omx/openmax/exynos_omx/osal/Exynos_OSAL_Android.cpp

index fb64735b74713193dc42c4e4236a1b7c6c38362b..997b92601fa3662c11734d097d96b3bb9cd3e6a2 100644 (file)
@@ -420,9 +420,12 @@ OMX_ERRORTYPE Exynos_OSAL_RefANB_Decrease(OMX_HANDLETYPE hREF, OMX_U32 BufferFd)
 
     for (i = 0; i < MAX_BUFFER_REF; i++) {
         if (phREF->SharedBuffer[i].BufferFd == BufferFd) {
-            ion_decRef(getIonFd(module), phREF->SharedBuffer[i].pIonHandle);
-            ion_decRef(getIonFd(module), phREF->SharedBuffer[i].pIonHandle1);
-            ion_decRef(getIonFd(module), phREF->SharedBuffer[i].pIonHandle2);
+            if (phREF->SharedBuffer[i].BufferFd > -1)
+                ion_decRef(getIonFd(module), phREF->SharedBuffer[i].pIonHandle);
+            if (phREF->SharedBuffer[i].BufferFd1 > -1)
+                ion_decRef(getIonFd(module), phREF->SharedBuffer[i].pIonHandle1);
+            if (phREF->SharedBuffer[i].BufferFd2 > -1)
+                ion_decRef(getIonFd(module), phREF->SharedBuffer[i].pIonHandle2);
             phREF->SharedBuffer[i].cnt--;
             if (phREF->SharedBuffer[i].cnt == 0) {
                 phREF->SharedBuffer[i].BufferFd    = -1;