Fix for issue 3372755 : File descriptor leak

Change-Id: Ib1471078dbbcb595422fd481e5a3368e79e39e19
diff --git a/libvideoeditor/lvpp/VideoEditorSRC.cpp b/libvideoeditor/lvpp/VideoEditorSRC.cpp
index 56f713b..091bdfb 100755
--- a/libvideoeditor/lvpp/VideoEditorSRC.cpp
+++ b/libvideoeditor/lvpp/VideoEditorSRC.cpp
@@ -103,10 +103,6 @@
     return;

 }

 

-// debug

-FILE *fp;

-

-

 status_t  VideoEditorSRC::start (MetaData *params) {

     Mutex::Autolock autoLock(mLock);

 

@@ -155,9 +151,6 @@
     mStarted = true;

     mSource->start();

 

-    //+ debug

-    fp = fopen("/sdcard/output.pcm", "wb");

-

     return OK;

 }

 

@@ -176,8 +169,6 @@
     mLeftover = 0;

     mLastReadSize = 0;

 

-    //+ debug

-    fclose(fp);

     return OK;

 }

 

@@ -371,10 +362,6 @@
 

     mLastReadSize = actualReadSize;

 

-    //+ debug

-    //pBuffer->frameCount = 1024;

-    fwrite(pBuffer->raw, 1, pBuffer->frameCount * mChannelCnt * sizeof(int16_t), fp);

-

     LOGV("inFrameCount     %d", pBuffer->frameCount);

 

     return OK;

diff --git a/libvideoeditor/vss/stagefrightshells/src/VideoEditor3gpReader.cpp b/libvideoeditor/vss/stagefrightshells/src/VideoEditor3gpReader.cpp
index 32a1403..aba2bc1 100755
--- a/libvideoeditor/vss/stagefrightshells/src/VideoEditor3gpReader.cpp
+++ b/libvideoeditor/vss/stagefrightshells/src/VideoEditor3gpReader.cpp
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 2011 NXP Software
  * Copyright (C) 2011 The Android Open Source Project
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
@@ -483,7 +483,8 @@
 
     LOGV("VideoEditor3gpReader_open Datasource start %s",
         (char*)pFileDescriptor);
-    pC->mDataSource = DataSource::CreateFromURI((char*)pFileDescriptor);
+    //pC->mDataSource = DataSource::CreateFromURI((char*)pFileDescriptor);
+    pC->mDataSource = new FileSource ((char*)pFileDescriptor);
 
     if (pC->mDataSource == NULL) {
         LOGV("VideoEditor3gpReader_open Datasource error");
@@ -593,6 +594,7 @@
         pC->mVideoSource->stop();
         pC->mVideoSource.clear();
     }
+    pC->mExtractor.clear();
     pC->mDataSource.clear();
 
     LOGV("VideoEditor3gpReader_close end");
@@ -1880,8 +1882,8 @@
     M4OSA_DEBUG_IF1((pTime == 0), M4ERR_PARAMETER,
         "VideoEditor3gpReader_getPrevRapTime: invalid time pointer");
     if (*pTime == (pStreamHandler->m_duration)) {
-		*pTime -= 1;
-	}
+        *pTime -= 1;
+    }
     M4OSA_INT64_FROM_INT32(time64, *pTime);
     time64 = time64 * 1000;
 
@@ -1891,7 +1893,7 @@
     if (error != OK) {
         //Can not get the previous Sync.
         //Must be end of stream.
-		return M4WAR_NO_MORE_AU;
+        return M4WAR_NO_MORE_AU;
     }
 
     mMediaBuffer->meta_data()->findInt64(kKeyTime, (int64_t*)&tempTime64);