am 4032217e
: Merge "Add option for video playback test to accept media source path." into jb-mr2-dev
* commit '4032217ee939d3b23548e83d9183306d66af6f8f': Add option for video playback test to accept media source path.
This commit is contained in:
@ -157,4 +157,11 @@ public class MediaNames {
|
|||||||
public static final int STREAM_H264_480_360_1411k_DURATION = 46000;
|
public static final int STREAM_H264_480_360_1411k_DURATION = 46000;
|
||||||
public static final int VIDEO_H263_AAC_DURATION = 501000;
|
public static final int VIDEO_H263_AAC_DURATION = 501000;
|
||||||
public static final int VIDEO_H263_AMR_DURATION = 502000;
|
public static final int VIDEO_H263_AMR_DURATION = 502000;
|
||||||
|
|
||||||
|
// Video files for WiFi IOT video streaming test.
|
||||||
|
public static final String[] NETWORK_VIDEO_FILES = {
|
||||||
|
"H264_BP_720x480_25fps_256kbps_AMRNB_8khz_12.2kbps_m_0_26.mp4",
|
||||||
|
"MPEG4_SP_720x480_30fps_280kbps_AACLC_48kHz_161kbps_s_0_26.mp4",
|
||||||
|
"MPEG4_SP_720x480_30fps_280kbps_AACLC_48kHz_96kbps_s_0_21.mp4"
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -17,18 +17,13 @@
|
|||||||
package com.android.mediaframeworktest.stress;
|
package com.android.mediaframeworktest.stress;
|
||||||
|
|
||||||
import com.android.mediaframeworktest.MediaFrameworkTest;
|
import com.android.mediaframeworktest.MediaFrameworkTest;
|
||||||
|
import com.android.mediaframeworktest.MediaPlayerStressTestRunner;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.os.Bundle;
|
||||||
import android.app.Instrumentation;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.hardware.Camera;
|
|
||||||
import android.media.MediaPlayer;
|
|
||||||
import android.media.MediaRecorder;
|
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.test.ActivityInstrumentationTestCase2;
|
import android.test.ActivityInstrumentationTestCase2;
|
||||||
import android.test.suitebuilder.annotation.LargeTest;
|
import android.test.suitebuilder.annotation.LargeTest;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.SurfaceHolder;
|
|
||||||
|
|
||||||
import com.android.mediaframeworktest.MediaNames;
|
import com.android.mediaframeworktest.MediaNames;
|
||||||
import com.android.mediaframeworktest.functional.CodecTest;
|
import com.android.mediaframeworktest.functional.CodecTest;
|
||||||
@ -38,14 +33,12 @@ import java.io.File;
|
|||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
|
|
||||||
import android.test.AndroidTestCase;
|
|
||||||
import android.test.InstrumentationTestCase;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Junit / Instrumentation test case for the media player
|
* Junit / Instrumentation test case for the media player
|
||||||
*/
|
*/
|
||||||
public class MediaPlayerStressTest extends ActivityInstrumentationTestCase2<MediaFrameworkTest> {
|
public class MediaPlayerStressTest extends ActivityInstrumentationTestCase2<MediaFrameworkTest> {
|
||||||
private String TAG = "MediaPlayerStressTest";
|
private String TAG = "MediaPlayerStressTest";
|
||||||
|
private String mMediaSrc;
|
||||||
|
|
||||||
public MediaPlayerStressTest() {
|
public MediaPlayerStressTest() {
|
||||||
super("com.android.mediaframeworktest", MediaFrameworkTest.class);
|
super("com.android.mediaframeworktest", MediaFrameworkTest.class);
|
||||||
@ -56,6 +49,12 @@ public class MediaPlayerStressTest extends ActivityInstrumentationTestCase2<Medi
|
|||||||
//the workaround for the race condition of requesting the updated surface.
|
//the workaround for the race condition of requesting the updated surface.
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
getActivity();
|
getActivity();
|
||||||
|
MediaPlayerStressTestRunner mRunner = (MediaPlayerStressTestRunner)getInstrumentation();
|
||||||
|
Bundle arguments = mRunner.getArguments();
|
||||||
|
mMediaSrc = arguments.getString("media-source");
|
||||||
|
if (mMediaSrc == null) {
|
||||||
|
mMediaSrc = MediaNames.MEDIA_SAMPLE_POOL;
|
||||||
|
}
|
||||||
super.setUp();
|
super.setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,17 +118,20 @@ public class MediaPlayerStressTest extends ActivityInstrumentationTestCase2<Medi
|
|||||||
boolean testResult = true;
|
boolean testResult = true;
|
||||||
// load directory files
|
// load directory files
|
||||||
boolean onCompleteSuccess = false;
|
boolean onCompleteSuccess = false;
|
||||||
File dir = new File(MediaNames.MEDIA_SAMPLE_POOL);
|
String[] children = MediaNames.NETWORK_VIDEO_FILES;
|
||||||
String[] children = dir.list();
|
if (MediaNames.MEDIA_SAMPLE_POOL.equals(mMediaSrc)) {
|
||||||
|
File dir = new File(mMediaSrc);
|
||||||
|
children = dir.list();
|
||||||
|
}
|
||||||
if (children == null) {
|
if (children == null) {
|
||||||
Log.v("MediaPlayerApiTest:testMediaSamples", "dir is empty");
|
Log.v("MediaPlayerApiTest:testMediaSamples", "dir is empty");
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < children.length; i++) {
|
for (int i = 0; i < children.length; i++) {
|
||||||
//Get filename of directory
|
//Get filename
|
||||||
String filename = children[i];
|
String filename = children[i];
|
||||||
onCompleteSuccess =
|
onCompleteSuccess =
|
||||||
CodecTest.playMediaSamples(dir + "/" + filename);
|
CodecTest.playMediaSamples(mMediaSrc + filename);
|
||||||
if (!onCompleteSuccess){
|
if (!onCompleteSuccess){
|
||||||
//Don't fail the test right away, print out the failure file.
|
//Don't fail the test right away, print out the failure file.
|
||||||
fileWithError += filename + '\n';
|
fileWithError += filename + '\n';
|
||||||
|
Reference in New Issue
Block a user