Merge "Fix another hardcoded frame rate in the media framework test"
This commit is contained in:
@@ -95,6 +95,25 @@ public class MediaProfileReader
|
||||
return audioEncoderMap.get(audioEncoder);
|
||||
}
|
||||
|
||||
public static int getMinFrameRateForCodec(int codec) {
|
||||
return getMinOrMaxFrameRateForCodec(codec, false);
|
||||
}
|
||||
|
||||
public static int getMaxFrameRateForCodec(int codec) {
|
||||
return getMinOrMaxFrameRateForCodec(codec, true);
|
||||
}
|
||||
|
||||
private static int getMinOrMaxFrameRateForCodec(int codec, boolean max) {
|
||||
for (VideoEncoderCap cap: videoEncoders) {
|
||||
if (cap.mCodec == codec) {
|
||||
if (max) return cap.mMaxFrameRate;
|
||||
else return cap.mMinFrameRate;
|
||||
}
|
||||
}
|
||||
// Should never reach here
|
||||
throw new IllegalArgumentException("Unsupported video codec " + codec);
|
||||
}
|
||||
|
||||
private MediaProfileReader() {} // Don't call me
|
||||
|
||||
private static void initVideoEncoderMap() {
|
||||
|
||||
@@ -247,7 +247,9 @@ public class MediaRecorderTest extends ActivityInstrumentationTestCase2<MediaFra
|
||||
mCamera.unlock();
|
||||
mRecorder.setCamera(mCamera);
|
||||
Thread.sleep(1000);
|
||||
recordVideo(15, 352, 288, MediaRecorder.VideoEncoder.H263,
|
||||
int codec = MediaRecorder.VideoEncoder.H263;
|
||||
int frameRate = MediaProfileReader.getMaxFrameRateForCodec(codec);
|
||||
recordVideo(frameRate, 352, 288, codec,
|
||||
MediaRecorder.OutputFormat.THREE_GPP,
|
||||
MediaNames.RECORDED_PORTRAIT_H263, true);
|
||||
mCamera.lock();
|
||||
|
||||
@@ -365,16 +365,6 @@ public class MediaPlayerPerformance extends ActivityInstrumentationTestCase2<Med
|
||||
assertTrue("H264 playback memory test", memoryResult);
|
||||
}
|
||||
|
||||
private int getMaxFrameRateForVideoEncoder(int codec) {
|
||||
int frameRate = -1;
|
||||
for (VideoEncoderCap cap: videoEncoders) {
|
||||
if (cap.mCodec == MediaRecorder.VideoEncoder.H263) {
|
||||
frameRate = cap.mMaxFrameRate;
|
||||
}
|
||||
}
|
||||
return frameRate;
|
||||
}
|
||||
|
||||
// Test case 4: Capture the memory usage after every 20 video only recorded
|
||||
@LargeTest
|
||||
public void testH263RecordVideoOnlyMemoryUsage() throws Exception {
|
||||
@@ -384,7 +374,7 @@ public class MediaPlayerPerformance extends ActivityInstrumentationTestCase2<Med
|
||||
File videoH263RecordOnlyMemoryOut = new File(MEDIA_MEMORY_OUTPUT);
|
||||
Writer output = new BufferedWriter(new FileWriter(videoH263RecordOnlyMemoryOut, true));
|
||||
output.write("H263 video record only\n");
|
||||
int frameRate = getMaxFrameRateForVideoEncoder(MediaRecorder.VideoEncoder.H263);
|
||||
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,
|
||||
@@ -406,7 +396,7 @@ public class MediaPlayerPerformance extends ActivityInstrumentationTestCase2<Med
|
||||
File videoMp4RecordOnlyMemoryOut = new File(MEDIA_MEMORY_OUTPUT);
|
||||
Writer output = new BufferedWriter(new FileWriter(videoMp4RecordOnlyMemoryOut, true));
|
||||
output.write("MPEG4 video record only\n");
|
||||
int frameRate = getMaxFrameRateForVideoEncoder(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,
|
||||
@@ -428,7 +418,7 @@ public class MediaPlayerPerformance extends ActivityInstrumentationTestCase2<Med
|
||||
|
||||
File videoRecordAudioMemoryOut = new File(MEDIA_MEMORY_OUTPUT);
|
||||
Writer output = new BufferedWriter(new FileWriter(videoRecordAudioMemoryOut, true));
|
||||
int frameRate = getMaxFrameRateForVideoEncoder(MediaRecorder.VideoEncoder.H263);
|
||||
int frameRate = MediaProfileReader.getMaxFrameRateForCodec(MediaRecorder.VideoEncoder.H263);
|
||||
assertTrue("H263 video recording frame rate", frameRate != -1);
|
||||
output.write("Audio and h263 video record\n");
|
||||
for (int i = 0; i < NUM_STRESS_LOOP; i++) {
|
||||
|
||||
Reference in New Issue
Block a user