summaryrefslogtreecommitdiffstats
path: root/media/tests/MediaFrameworkTest
diff options
context:
space:
mode:
authorshailendra <shailendray@google.com>2011-03-23 16:03:46 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-03-23 16:03:46 -0700
commit88a14dcd1c60e5045223b1a5ed35f4f5f2179432 (patch)
tree92dbb3978b6d15fe7a11d8b7ebc7ed8f2348e9b3 /media/tests/MediaFrameworkTest
parentf46821b9d932ba0f1d0dfd88e98f319e0d3b789b (diff)
parent6b49e9a8829c87088dc7fbc0945237030e63327a (diff)
downloadframeworks_base-88a14dcd1c60e5045223b1a5ed35f4f5f2179432.zip
frameworks_base-88a14dcd1c60e5045223b1a5ed35f4f5f2179432.tar.gz
frameworks_base-88a14dcd1c60e5045223b1a5ed35f4f5f2179432.tar.bz2
am 6b49e9a8: am a450ef06: am ac390b8c: Merge "Fix for Media Server memory leak" into honeycomb-mr1
* commit '6b49e9a8829c87088dc7fbc0945237030e63327a': Fix for Media Server memory leak
Diffstat (limited to 'media/tests/MediaFrameworkTest')
-rwxr-xr-xmedia/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/VideoEditorStressTest.java32
1 files changed, 18 insertions, 14 deletions
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/VideoEditorStressTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/VideoEditorStressTest.java
index 432fb43..94ffb8e 100755
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/VideoEditorStressTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/VideoEditorStressTest.java
@@ -51,10 +51,11 @@ import android.media.videoeditor.ExtractAudioWaveformProgressListener;
import android.os.Debug;
import android.util.Log;
-
+import com.android.mediaframeworktest.MediaFrameworkPerfTestRunner;
import com.android.mediaframeworktest.MediaFrameworkTest;
import android.test.suitebuilder.annotation.LargeTest;
import com.android.mediaframeworktest.VideoEditorHelper;
+import com.android.mediaframeworktest.MediaTestUtil;
/**
* Junit / Instrumentation - performance measurement for media player and
@@ -63,7 +64,7 @@ import com.android.mediaframeworktest.VideoEditorHelper;
public class VideoEditorStressTest
extends ActivityInstrumentationTestCase<MediaFrameworkTest> {
- private final String TAG = "VideoEditorPerformance";
+ private final String TAG = "VideoEditorStressTest";
private final String PROJECT_LOCATION = VideoEditorHelper.PROJECT_LOCATION_COMMON;
@@ -86,12 +87,17 @@ public class VideoEditorStressTest
private final String PROJECT_CLASS_NAME =
"android.media.videoeditor.VideoEditorImpl";
private VideoEditor mVideoEditor;
+ private MediaTestUtil mMediaTestUtil;
private VideoEditorHelper mVideoEditorHelper;
@Override
protected void setUp() throws Exception {
// setup for each test case.
super.setUp();
+ getActivity();
+ mMediaTestUtil = new MediaTestUtil(
+ "/sdcard/VideoEditorMediaServerMemoryLog.txt",
+ this.getName(), "mediaserver");
mVideoEditorHelper = new VideoEditorHelper();
// Create a random String which will be used as project path, where all
// project related files will be stored.
@@ -102,6 +108,12 @@ public class VideoEditorStressTest
@Override
protected void tearDown() throws Exception {
+ final String[] loggingInfo = new String[1];
+ mMediaTestUtil.getMemorySummary();
+ loggingInfo[0] = "\n" +this.getName();
+ writeTimingInfo(loggingInfo);
+ loggingInfo[0] = " diff : " + (AfterNativeMemory - BeginNativeMemory);
+ writeTimingInfo(loggingInfo);
mVideoEditorHelper.destroyVideoEditor(mVideoEditor);
// Clean the directory created as project path
mVideoEditorHelper.deleteProject(new File(mVideoEditor.getPath()));
@@ -131,6 +143,7 @@ public class VideoEditorStressTest
System.gc();
Thread.sleep(2500);
BeginNativeMemory = Debug.getNativeHeapAllocatedSize();
+ mMediaTestUtil.getStartMemoryLog();
}
private void getAfterMemory_updateLog(String[] loggingInfo, boolean when,
int iteration)
@@ -146,6 +159,7 @@ public class VideoEditorStressTest
"\t " + (AfterNativeMemory - BeginNativeMemory);
}
writeTimingInfo(loggingInfo);
+ mMediaTestUtil.getMemoryLog();
}
/**
@@ -170,7 +184,6 @@ public class VideoEditorStressTest
writeTestCaseHeader("testStressAddRemoveVideoItem");
int i = 0;
getBeginMemory();
-
for ( i = 0; i < 50; i++) {
if (i % 4 == 0) {
final MediaVideoItem mediaItem1 = new MediaVideoItem(mVideoEditor,
@@ -203,7 +216,6 @@ public class VideoEditorStressTest
getAfterMemory_updateLog(loggingInfo, false, i);
/** Remove items and check for memory leak if any */
- getBeginMemory();
for ( i = 0; i < 50; i++) {
if (i % 4 == 0) {
mVideoEditor.removeMediaItem("m1" + i);
@@ -273,7 +285,6 @@ public class VideoEditorStressTest
getAfterMemory_updateLog(loggingInfo, false, i);
/** Remove items and check for memory leak if any */
- getBeginMemory();
for ( i = 0; i < 50; i++) {
if (i % 4 == 0) {
mVideoEditor.removeMediaItem("m1"+i);
@@ -387,7 +398,6 @@ public class VideoEditorStressTest
getAfterMemory_updateLog(loggingInfo, false, i);
/** Remove items and check for memory leak if any */
- getBeginMemory();
for ( i = 0; i < 50; i++) {
if (i % 4 == 0) {
mVideoEditor.removeTransition("transCF" + i);
@@ -551,7 +561,6 @@ public class VideoEditorStressTest
getAfterMemory_updateLog(loggingInfo, false, i);
/** Remove items and check for memory leak if any */
- getBeginMemory();
for ( i = 0; i < 50; i++) {
if (i % 5 == 0) {
mediaItem1.removeEffect("effect1"+i);
@@ -773,15 +782,14 @@ public class VideoEditorStressTest
getAfterMemory_updateLog(loggingInfo, false, i);
/** Remove items and check for memory leak if any */
- getBeginMemory();
for ( i = 0; i < 50; i++) {
mVideoEditor.removeMediaItem("m3" + i);
if (i % 10 == 0) {
getAfterMemory_updateLog(loggingInfo, true, i);
}
}
- mVideoEditor.removeMediaItem("m2");
- mVideoEditor.removeMediaItem("m1");
+ mVideoEditor.removeMediaItem("m2");
+ mVideoEditor.removeMediaItem("m1");
getAfterMemory_updateLog(loggingInfo, true, i);
}
@@ -879,7 +887,6 @@ public class VideoEditorStressTest
getAfterMemory_updateLog(loggingInfo, false, i);
/** Remove items and check for memory leak if any */
- getBeginMemory();
for( i=0; i<10; i++){
final VideoEditor mVideoEditor1b =
VideoEditorFactory.load(projectPath[i], true);
@@ -986,7 +993,6 @@ public class VideoEditorStressTest
getAfterMemory_updateLog(loggingInfo, false, i);
/** Remove items and check for memory leak if any */
- getBeginMemory();
mVideoEditor.removeMediaItem("m2");
mVideoEditor.removeMediaItem("m1");
@@ -1063,7 +1069,6 @@ public class VideoEditorStressTest
getAfterMemory_updateLog(loggingInfo, false, i);
/** Remove items and check for memory leak if any */
- getBeginMemory();
for ( i = 0; i < 10; i++) {
MediaImageItem m2 = (MediaImageItem)mVideoEditor.getMediaItem("m2"+i);
MediaVideoItem m1 = (MediaVideoItem)mVideoEditor.getMediaItem("m1"+i);
@@ -1129,7 +1134,6 @@ public class VideoEditorStressTest
getAfterMemory_updateLog(loggingInfo, false, i);
/** Remove items and check for memory leak if any */
- getBeginMemory();
mVideoEditor.removeMediaItem("mediaItem1");
getAfterMemory_updateLog(loggingInfo, true, i);