Fix memory allocation issue when decoding long clips
authorHongmei Gou <h-gou@ti.com>
Mon, 21 Dec 2015 23:28:04 +0000 (18:28 -0500)
committerHongmei Gou <h-gou@ti.com>
Mon, 21 Dec 2015 23:28:04 +0000 (18:28 -0500)
Signed-off-by: Hongmei Gou <h-gou@ti.com>
src/gsth265buf.c
src/gsth265dec.c

index 59feb74d4e74353de49ef44dcf28cfa63e35237d..d7d75ae4019654148bcafaf6b2f9cb82ed014880 100644 (file)
@@ -201,11 +201,15 @@ tPPi32 BUFFMGR_ReleaseBufID(tPPi32 bufffId[], tPPInGst_Buff *GstBufOut)
             * application developer to identify any such problem in her
             * algorithm
             */
+            g_print("\n ......Trying to release already freed buffer......\n");
+        }
+        else
+        {
+            /* Set the status of the buffer to FREE */
+            GstBufOut[tmpId].bufStatus = BUFFMGR_FREE;
+            gst_buffer_unmap(GstBufOut[tmpId].GstDispBuf, &GstBufOut[tmpId].Out_map);
+            gst_buffer_unref( GstBufOut[tmpId].GstDispBuf);
         }
-
-        /* Set the status of the buffer to FREE */
-        GstBufOut[tmpId].bufStatus = BUFFMGR_FREE;
-        gst_buffer_unref( GstBufOut[tmpId].GstDispBuf);
     }
     return 0;
 }
index 9f0faa3926cf96250c9d1360f6c7456683ba2548..8f4090b37404edde3509d8bd0a93ae776bbf9036 100644 (file)
@@ -550,9 +550,9 @@ gst_h265dec_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
           break;
         }
         nIndex++;
-        /*Call release buffer*/
-        BUFFMGR_ReleaseBufID(&H265_dec_OutBuff.bufId[0], GstBufOut );
       }
+      /*Call release buffer*/
+      BUFFMGR_ReleaseBufID(&H265_dec_OutBuff.bufId[0], GstBufOut);
 
       nFlushCall = 1;
       gst_h265dec_process_call(&taskidMaster);
@@ -628,11 +628,15 @@ gst_h265dec_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
         break;
       }
       nIndex++;
-      /*Call release buffer*/
-      BUFFMGR_ReleaseBufID(&H265_dec_OutBuff.bufId[0], GstBufOut );
     }
+    /*Call release buffer*/
+    BUFFMGR_ReleaseBufID(&H265_dec_OutBuff.bufId[0], GstBufOut );
+
   }while(H265InputStreamNAL.nBufLength > 3);
 
+  /*unmapping input buffer(freeing)*/
+  gst_buffer_unmap(buf, &info);
+
   if(nFlag && nDispFlag)
   {
 #ifdef PROFILE