am b830d527: Merge "Update test with CamercorderProfile video size." into jb-mr2-dev
* commit 'b830d527deb75a36aa78367026d6631a9b4e1126':
Update test with CamercorderProfile video size.
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java
index be12c7f..074bfe4 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java
@@ -24,23 +24,19 @@
import android.database.sqlite.SQLiteDatabase;
import android.hardware.Camera;
import android.hardware.Camera.PreviewCallback;
+import android.media.CamcorderProfile;
import android.media.MediaPlayer;
import android.media.MediaRecorder;
import android.media.EncoderCapabilities.VideoEncoderCap;
import android.os.ConditionVariable;
import android.os.Looper;
-import android.os.SystemClock;
import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.LargeTest;
-import android.test.suitebuilder.annotation.Suppress;
import android.util.Log;
import android.view.SurfaceHolder;
import java.util.List;
import java.io.BufferedReader;
-import java.io.FileDescriptor;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -49,7 +45,6 @@
import java.io.FileWriter;
import java.io.BufferedWriter;
-import android.media.MediaMetadataRetriever;
import com.android.mediaframeworktest.MediaProfileReader;
/**
@@ -63,7 +58,6 @@
private String TAG = "MediaPlayerPerformance";
- private SQLiteDatabase mDB;
private SurfaceHolder mSurfaceHolder = null;
private static final int NUM_STRESS_LOOP = 10;
private static final int NUM_PLAYBACk_IN_EACH_LOOP = 20;
@@ -92,7 +86,9 @@
private Writer mProcMemWriter;
private Writer mMemWriter;
- private static List<VideoEncoderCap> videoEncoders = MediaProfileReader.getVideoEncoders();
+ private CamcorderProfile mCamcorderProfile = CamcorderProfile.get(CAMERA_ID);
+ private int mVideoWidth = mCamcorderProfile.videoFrameWidth;
+ private int mVideoHeight = mCamcorderProfile.videoFrameHeight;
Camera mCamera;
@@ -415,13 +411,13 @@
@LargeTest
public void testH263RecordVideoOnlyMemoryUsage() throws Exception {
boolean memoryResult = false;
-
mStartPid = getMediaserverPid();
int frameRate = MediaProfileReader.getMaxFrameRateForCodec(MediaRecorder.VideoEncoder.H263);
assertTrue("H263 video recording frame rate", frameRate != -1);
for (int i = 0; i < NUM_STRESS_LOOP; i++) {
- assertTrue(stressVideoRecord(frameRate, 352, 288, MediaRecorder.VideoEncoder.H263,
- MediaRecorder.OutputFormat.MPEG_4, MediaNames.RECORDED_VIDEO_3GP, true));
+ assertTrue(stressVideoRecord(frameRate, mVideoWidth, mVideoHeight,
+ MediaRecorder.VideoEncoder.H263, MediaRecorder.OutputFormat.MPEG_4,
+ MediaNames.RECORDED_VIDEO_3GP, true));
getMemoryWriteToLog(i);
writeProcmemInfo();
}
@@ -435,11 +431,13 @@
boolean memoryResult = false;
mStartPid = getMediaserverPid();
- int frameRate = MediaProfileReader.getMaxFrameRateForCodec(MediaRecorder.VideoEncoder.MPEG_4_SP);
+ int frameRate = MediaProfileReader.getMaxFrameRateForCodec
+ (MediaRecorder.VideoEncoder.MPEG_4_SP);
assertTrue("MPEG4 video recording frame rate", frameRate != -1);
for (int i = 0; i < NUM_STRESS_LOOP; i++) {
- assertTrue(stressVideoRecord(frameRate, 352, 288, MediaRecorder.VideoEncoder.MPEG_4_SP,
- MediaRecorder.OutputFormat.MPEG_4, MediaNames.RECORDED_VIDEO_3GP, true));
+ assertTrue(stressVideoRecord(frameRate, mVideoWidth, mVideoHeight,
+ MediaRecorder.VideoEncoder.MPEG_4_SP, MediaRecorder.OutputFormat.MPEG_4,
+ MediaNames.RECORDED_VIDEO_3GP, true));
getMemoryWriteToLog(i);
writeProcmemInfo();
}
@@ -457,8 +455,9 @@
int frameRate = MediaProfileReader.getMaxFrameRateForCodec(MediaRecorder.VideoEncoder.H263);
assertTrue("H263 video recording frame rate", frameRate != -1);
for (int i = 0; i < NUM_STRESS_LOOP; i++) {
- assertTrue(stressVideoRecord(frameRate, 352, 288, MediaRecorder.VideoEncoder.H263,
- MediaRecorder.OutputFormat.MPEG_4, MediaNames.RECORDED_VIDEO_3GP, false));
+ assertTrue(stressVideoRecord(frameRate, mVideoWidth, mVideoHeight,
+ MediaRecorder.VideoEncoder.H263, MediaRecorder.OutputFormat.MPEG_4,
+ MediaNames.RECORDED_VIDEO_3GP, false));
getMemoryWriteToLog(i);
writeProcmemInfo();
}