diff options
author | Xia Wang <xiaw@google.com> | 2013-07-11 19:30:51 -0700 |
---|---|---|
committer | Xia Wang <xiaw@google.com> | 2013-07-11 19:30:51 -0700 |
commit | 796c93b11096002db8ee8fff670ba2a1980877d9 (patch) | |
tree | 195b2284c0fa9f5ba46bd86408565b2bd07b0959 /media/tests/MediaFrameworkTest/src | |
parent | 29282f99252237dd9674737d26ce72afbfdd3ac1 (diff) | |
download | frameworks_base-796c93b11096002db8ee8fff670ba2a1980877d9.zip frameworks_base-796c93b11096002db8ee8fff670ba2a1980877d9.tar.gz frameworks_base-796c93b11096002db8ee8fff670ba2a1980877d9.tar.bz2 |
Add option for video playback test to accept media source path.
This allows the stress test to be able to streaming video over network.
Change-Id: Ie0089c1ba2a076c9c1325934643c2f22f2ca9866
Diffstat (limited to 'media/tests/MediaFrameworkTest/src')
2 files changed, 23 insertions, 14 deletions
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaNames.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaNames.java index f3a91c5..ee867ff 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaNames.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaNames.java @@ -157,4 +157,11 @@ public class MediaNames { 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_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" + }; } diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaPlayerStressTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaPlayerStressTest.java index 67da6ac..e289812 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaPlayerStressTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaPlayerStressTest.java @@ -17,18 +17,13 @@ package com.android.mediaframeworktest.stress; import com.android.mediaframeworktest.MediaFrameworkTest; +import com.android.mediaframeworktest.MediaPlayerStressTestRunner; -import android.app.Activity; -import android.app.Instrumentation; -import android.content.Intent; -import android.hardware.Camera; -import android.media.MediaPlayer; -import android.media.MediaRecorder; +import android.os.Bundle; import android.os.Environment; import android.test.ActivityInstrumentationTestCase2; import android.test.suitebuilder.annotation.LargeTest; import android.util.Log; -import android.view.SurfaceHolder; import com.android.mediaframeworktest.MediaNames; import com.android.mediaframeworktest.functional.CodecTest; @@ -38,14 +33,12 @@ import java.io.File; import java.io.FileWriter; import java.io.Writer; -import android.test.AndroidTestCase; -import android.test.InstrumentationTestCase; - /** * Junit / Instrumentation test case for the media player */ public class MediaPlayerStressTest extends ActivityInstrumentationTestCase2<MediaFrameworkTest> { private String TAG = "MediaPlayerStressTest"; + private String mMediaSrc; public MediaPlayerStressTest() { 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. Thread.sleep(2000); getActivity(); + MediaPlayerStressTestRunner mRunner = (MediaPlayerStressTestRunner)getInstrumentation(); + Bundle arguments = mRunner.getArguments(); + mMediaSrc = arguments.getString("media-source"); + if (mMediaSrc == null) { + mMediaSrc = MediaNames.MEDIA_SAMPLE_POOL; + } super.setUp(); } @@ -119,17 +118,20 @@ public class MediaPlayerStressTest extends ActivityInstrumentationTestCase2<Medi boolean testResult = true; // load directory files boolean onCompleteSuccess = false; - File dir = new File(MediaNames.MEDIA_SAMPLE_POOL); - String[] children = dir.list(); + String[] children = MediaNames.NETWORK_VIDEO_FILES; + if (MediaNames.MEDIA_SAMPLE_POOL.equals(mMediaSrc)) { + File dir = new File(mMediaSrc); + children = dir.list(); + } if (children == null) { Log.v("MediaPlayerApiTest:testMediaSamples", "dir is empty"); return; } else { for (int i = 0; i < children.length; i++) { - //Get filename of directory + //Get filename String filename = children[i]; onCompleteSuccess = - CodecTest.playMediaSamples(dir + "/" + filename); + CodecTest.playMediaSamples(mMediaSrc + filename); if (!onCompleteSuccess){ //Don't fail the test right away, print out the failure file. fileWithError += filename + '\n'; |