Revert "integrate media stress test : MediaPlay and MediaRecord only"
This reverts commit 525855d4835309da5e9c35a522f6302f29f8a0a4.
diff --git a/CtsTestCaseList.mk b/CtsTestCaseList.mk
index a54ca5c..3923aac 100644
--- a/CtsTestCaseList.mk
+++ b/CtsTestCaseList.mk
@@ -45,7 +45,6 @@
CtsHoloTestCases \
CtsJniTestCases \
CtsLocationTestCases \
- CtsMediaStressTestCases \
CtsMediaTestCases \
CtsNdefTestCases \
CtsNetTestCases \
diff --git a/tests/tests/mediastress/Android.mk b/tests/tests/mediastress/Android.mk
deleted file mode 100644
index 8322957a..0000000
--- a/tests/tests/mediastress/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright (C) 2011 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsMediaStressTestCases
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/tests/tests/mediastress/AndroidManifest.xml b/tests/tests/mediastress/AndroidManifest.xml
deleted file mode 100644
index 186b1c2..0000000
--- a/tests/tests/mediastress/AndroidManifest.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.cts.mediastress">
-
- <uses-permission android:name="android.permission.CAMERA" />
- <uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
- <uses-permission android:name="android.permission.RECORD_AUDIO" />
- <uses-permission android:name="android.permission.WAKE_LOCK" />
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
-
- <application>
- <uses-library android:name="android.test.runner" />
- <activity android:label="@string/app_name"
- android:name="android.mediastress.cts.MediaFrameworkTest"
- android:screenOrientation="landscape">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER"/>
- </intent-filter>
- </activity>
- </application>
-
- <instrumentation android:name="android.mediastress.cts.MediaStressTestRunner"
- android:targetPackage="com.android.cts.mediastress"
- android:label="Media stress tests InstrumentationRunner">
- </instrumentation>
-
-</manifest>
diff --git a/tests/tests/mediastress/assets/test/video_176x144_3gp_h263_300kbps_12fps_aac_mono_24kbps_11025hz.3gp b/tests/tests/mediastress/assets/test/video_176x144_3gp_h263_300kbps_12fps_aac_mono_24kbps_11025hz.3gp
deleted file mode 100644
index e6dfdcd..0000000
--- a/tests/tests/mediastress/assets/test/video_176x144_3gp_h263_300kbps_12fps_aac_mono_24kbps_11025hz.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/mediastress/assets/test/video_176x144_3gp_h263_300kbps_12fps_aac_mono_24kbps_22050hz.3gp b/tests/tests/mediastress/assets/test/video_176x144_3gp_h263_300kbps_12fps_aac_mono_24kbps_22050hz.3gp
deleted file mode 100644
index 0d73ba2..0000000
--- a/tests/tests/mediastress/assets/test/video_176x144_3gp_h263_300kbps_12fps_aac_mono_24kbps_22050hz.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/mediastress/assets/test/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_128kbps_11025hz.3gp b/tests/tests/mediastress/assets/test/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_128kbps_11025hz.3gp
deleted file mode 100644
index 4d63192..0000000
--- a/tests/tests/mediastress/assets/test/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_128kbps_11025hz.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/mediastress/assets/test/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_128kbps_22050hz.3gp b/tests/tests/mediastress/assets/test/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_128kbps_22050hz.3gp
deleted file mode 100644
index fc007d9..0000000
--- a/tests/tests/mediastress/assets/test/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_128kbps_22050hz.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/mediastress/assets/video/H263_500_AMRNB_12.3gp b/tests/tests/mediastress/assets/video/H263_500_AMRNB_12.3gp
deleted file mode 100755
index 46bb2b1..0000000
--- a/tests/tests/mediastress/assets/video/H263_500_AMRNB_12.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/mediastress/assets/video/H263_56_AAC_24.3gp b/tests/tests/mediastress/assets/video/H263_56_AAC_24.3gp
deleted file mode 100755
index 1fb1192..0000000
--- a/tests/tests/mediastress/assets/video/H263_56_AAC_24.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/mediastress/assets/video/H263_56_AMRNB_6.3gp b/tests/tests/mediastress/assets/video/H263_56_AMRNB_6.3gp
deleted file mode 100755
index b6eb6a1..0000000
--- a/tests/tests/mediastress/assets/video/H263_56_AMRNB_6.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/mediastress/assets/video/H264_320_AAC_64.3gp b/tests/tests/mediastress/assets/video/H264_320_AAC_64.3gp
deleted file mode 100755
index 04680ce..0000000
--- a/tests/tests/mediastress/assets/video/H264_320_AAC_64.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/mediastress/assets/video/H264_320_AMRNB_6.3gp b/tests/tests/mediastress/assets/video/H264_320_AMRNB_6.3gp
deleted file mode 100755
index bc533a2..0000000
--- a/tests/tests/mediastress/assets/video/H264_320_AMRNB_6.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/mediastress/assets/video/H264_500_AAC_128.3gp b/tests/tests/mediastress/assets/video/H264_500_AAC_128.3gp
deleted file mode 100755
index 05d67ea..0000000
--- a/tests/tests/mediastress/assets/video/H264_500_AAC_128.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/mediastress/assets/video/H264_HVGA_500_NO_AUDIO.3gp b/tests/tests/mediastress/assets/video/H264_HVGA_500_NO_AUDIO.3gp
deleted file mode 100755
index 13642b2..0000000
--- a/tests/tests/mediastress/assets/video/H264_HVGA_500_NO_AUDIO.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/mediastress/assets/video/H264_QVGA_500_NO_AUDIO.3gp b/tests/tests/mediastress/assets/video/H264_QVGA_500_NO_AUDIO.3gp
deleted file mode 100755
index 13642b2..0000000
--- a/tests/tests/mediastress/assets/video/H264_QVGA_500_NO_AUDIO.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/mediastress/assets/video/MPEG4_320_AAC_64.mp4 b/tests/tests/mediastress/assets/video/MPEG4_320_AAC_64.mp4
deleted file mode 100755
index 90f1856..0000000
--- a/tests/tests/mediastress/assets/video/MPEG4_320_AAC_64.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/mediastress/assets/video/big-buck-bunny_trailer.webm b/tests/tests/mediastress/assets/video/big-buck-bunny_trailer.webm
deleted file mode 100755
index 6a17395..0000000
--- a/tests/tests/mediastress/assets/video/big-buck-bunny_trailer.webm
+++ /dev/null
Binary files differ
diff --git a/tests/tests/mediastress/assets/video/border_large.3gp b/tests/tests/mediastress/assets/video/border_large.3gp
deleted file mode 100755
index e622160..0000000
--- a/tests/tests/mediastress/assets/video/border_large.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/mediastress/res/layout/surface_view.xml b/tests/tests/mediastress/res/layout/surface_view.xml
deleted file mode 100644
index 5f59739..0000000
--- a/tests/tests/mediastress/res/layout/surface_view.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
-
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <SurfaceView
- android:id="@+id/surface_view"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_centerInParent="true" />
-
- <ImageView android:id="@+id/overlay_layer"
- android:layout_width="0dip"
- android:layout_height="392dip"/>
-
- <VideoView
- android:id="@+id/video_view"
- android:layout_width="320px"
- android:layout_height="240px" />
-
- </FrameLayout>
-
-</LinearLayout>
diff --git a/tests/tests/mediastress/res/values/strings.xml b/tests/tests/mediastress/res/values/strings.xml
deleted file mode 100644
index c3d2868..0000000
--- a/tests/tests/mediastress/res/values/strings.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<resources>
- <string name="app_name">MediaStressTest</string>
- <string name="open_url">Open</string>
-</resources>
diff --git a/tests/tests/mediastress/src/android/mediastress/cts/CodecTest.java b/tests/tests/mediastress/src/android/mediastress/cts/CodecTest.java
deleted file mode 100644
index 2b9c6a4..0000000
--- a/tests/tests/mediastress/src/android/mediastress/cts/CodecTest.java
+++ /dev/null
@@ -1,825 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.mediastress.cts;
-
-import android.content.res.AssetFileDescriptor;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.media.MediaMetadataRetriever;
-import android.media.MediaPlayer;
-import android.media.MediaRecorder;
-import android.os.Looper;
-import android.os.SystemClock;
-import android.util.Log;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * Junit / Instrumentation test case for the media player api
- */
-public class CodecTest {
- private static String TAG = "CodecTest";
- private static MediaPlayer mMediaPlayer;
- private MediaPlayer.OnPreparedListener mOnPreparedListener;
-
- private static int WAIT_FOR_COMMAND_TO_COMPLETE = 60000; //1 min max.
- private static boolean mInitialized = false;
- private static boolean mPrepareReset = false;
- private static Looper mLooper = null;
- private static final Object mLock = new Object();
- private static final Object mPrepareDone = new Object();
- private static final Object mVideoSizeChanged = new Object();
- private static final Object mOnCompletion = new Object();
- private static boolean mOnPrepareSuccess = false;
- public static boolean mOnCompleteSuccess = false;
- public static boolean mPlaybackError = false;
- public static int mMediaInfoUnknownCount = 0;
- public static int mMediaInfoVideoTrackLaggingCount = 0;
- public static int mMediaInfoBadInterleavingCount = 0;
- public static int mMediaInfoNotSeekableCount = 0;
- public static int mMediaInfoMetdataUpdateCount = 0;
-
- public static String printCpuInfo() {
- String cm = "dumpsys cpuinfo";
- String cpuinfo = null;
- int ch;
- try {
- Process p = Runtime.getRuntime().exec(cm);
- InputStream in = p.getInputStream();
- StringBuffer sb = new StringBuffer(512);
- while ( ( ch = in.read() ) != -1 ) {
- sb.append((char) ch);
- }
- cpuinfo = sb.toString();
- } catch (IOException e) {
- Log.v(TAG, e.toString());
- }
- return cpuinfo;
- }
-
-
- public static int getDuration(String filePath) {
- Log.v(TAG, "getDuration - " + filePath);
- MediaPlayer mp = new MediaPlayer();
- try {
- mp.setDataSource(filePath);
- mp.prepare();
- } catch (Exception e) {
- Log.v(TAG, e.toString());
- }
- int duration = mp.getDuration();
- Log.v(TAG, "Duration " + duration);
- mp.release();
- Log.v(TAG, "release");
- return duration;
- }
-
- public static boolean getCurrentPosition(String filePath) {
- Log.v(TAG, "GetCurrentPosition - " + filePath);
- int currentPosition = 0;
- long t1=0;
- long t2 =0;
- MediaPlayer mp = new MediaPlayer();
- try {
- mp.setDataSource(filePath);
- Log.v(TAG, "start playback");
- mp.prepare();
- mp.start();
- t1=SystemClock.uptimeMillis();
- Thread.sleep(10000);
- mp.pause();
- Thread.sleep(MediaNames.PAUSE_WAIT_TIME);
- t2=SystemClock.uptimeMillis();
- } catch (Exception e) {
- Log.v(TAG, e.toString());
- }
- currentPosition = mp.getCurrentPosition();
- mp.stop();
- mp.release();
- Log.v(TAG, "mp currentPositon = " + currentPosition + " play duration = " + (t2-t1));
- //The currentposition should be within 10% of the sleep time
- //For the very short mp3, it should return the length instead of 10 seconds
- if (filePath.equals(MediaNames.SHORTMP3)) {
- if (currentPosition < 1000)
- return true;
- }
- if ((currentPosition < ((t2-t1) *1.2)) && (currentPosition > 0))
- return true;
- else
- return false;
- }
-
- public static boolean seekTo(String filePath) {
- Log.v(TAG, "seekTo " + filePath);
- int currentPosition = 0;
- MediaPlayer mp = new MediaPlayer();
- try {
- mp.setDataSource(filePath);
- mp.prepare();
- mp.start();
- mp.seekTo(MediaNames.SEEK_TIME);
- Thread.sleep(MediaNames.WAIT_TIME);
- currentPosition = mp.getCurrentPosition();
- } catch (Exception e) {
- Log.v(TAG, e.getMessage());
- }
- mp.stop();
- mp.release();
- Log.v(TAG, "CurrentPosition = " + currentPosition);
- //The currentposition should be at least greater than the 80% of seek time
- if ((currentPosition > MediaNames.SEEK_TIME *0.8))
- return true;
- else
- return false;
- }
-
- public static boolean setLooping(String filePath) {
- int currentPosition = 0;
- int duration = 0;
- long t1 =0;
- long t2 =0;
- Log.v (TAG, "SetLooping - " + filePath);
- MediaPlayer mp = new MediaPlayer();
- try {
- mp.setDataSource(filePath);
- mp.prepare();
- duration = mp.getDuration();
- Log.v(TAG, "setLooping duration " + duration);
- mp.setLooping(true);
- mp.start();
- Thread.sleep(5000);
- mp.seekTo(duration - 5000);
- t1=SystemClock.uptimeMillis();
- Thread.sleep(20000);
- t2=SystemClock.uptimeMillis();
- Log.v(TAG, "pause");
- //Bug# 1106852 - IllegalStateException will be thrown if pause is called
- //in here
- //mp.pause();
- currentPosition = mp.getCurrentPosition();
- Log.v(TAG, "looping position " + currentPosition + "duration = " + (t2-t1));
- } catch (Exception e) {
- Log.v(TAG, "Exception : " + e.toString());
- }
- mp.stop();
- mp.release();
- //The current position should be within 20% of the sleep time
- //and should be greater than zero.
- if ((currentPosition < ((t2-t1-5000)*1.2)) && currentPosition > 0)
- return true;
- else
- return false;
- }
-
- public static boolean pause(String filePath) throws Exception {
- Log.v(TAG, "pause - " + filePath);
- boolean misPlaying = true;
- boolean pauseResult = false;
- long t1=0;
- long t2=0;
- MediaPlayer mp = new MediaPlayer();
- mp.setDataSource(filePath);
- mp.prepare();
- int duration = mp.getDuration();
- mp.start();
- t1=SystemClock.uptimeMillis();
- Thread.sleep(5000);
- mp.pause();
- Thread.sleep(MediaNames.PAUSE_WAIT_TIME);
- t2=SystemClock.uptimeMillis();
- misPlaying = mp.isPlaying();
- int curPosition = mp.getCurrentPosition();
- Log.v(TAG, filePath + " pause currentPositon " + curPosition);
- Log.v(TAG, "isPlaying "+ misPlaying + " wait time " + (t2 - t1) );
- String cpuinfo = printCpuInfo();
- Log.v(TAG, cpuinfo);
- if ((curPosition>0) && (curPosition < ((t2-t1) * 1.3)) && (misPlaying == false))
- pauseResult = true;
- mp.stop();
- mp.release();
- return pauseResult;
- }
-
- public static void prepareStopRelease(String filePath) throws Exception {
- Log.v(TAG, "prepareStopRelease" + filePath);
- MediaPlayer mp = new MediaPlayer();
- mp.setDataSource(filePath);
- mp.prepare();
- mp.stop();
- mp.release();
- }
-
- public static void preparePauseRelease(String filePath) throws Exception {
- Log.v(TAG, "preparePauseRelease" + filePath);
- MediaPlayer mp = new MediaPlayer();
- mp.setDataSource(filePath);
- mp.prepare();
- mp.pause();
- mp.release();
- }
-
- static MediaPlayer.OnVideoSizeChangedListener mOnVideoSizeChangedListener =
- new MediaPlayer.OnVideoSizeChangedListener() {
- public void onVideoSizeChanged(MediaPlayer mp, int width, int height) {
- synchronized (mVideoSizeChanged) {
- Log.v(TAG, "sizechanged notification received ...");
- mVideoSizeChanged.notify();
- }
- }
- };
-
- //Register the videoSizeChanged listener
- public static int videoHeight(String filePath) throws Exception {
- Log.v(TAG, "videoHeight - " + filePath);
- int videoHeight = 0;
- synchronized (mLock) {
- initializeMessageLooper();
- try {
- mLock.wait(WAIT_FOR_COMMAND_TO_COMPLETE);
- } catch(Exception e) {
- Log.v(TAG, "looper was interrupted.");
- return 0;
- }
- }
- try {
- mMediaPlayer.setDataSource(filePath);
- mMediaPlayer.setDisplay(MediaFrameworkTest.getSurfaceView().getHolder());
- mMediaPlayer.setOnVideoSizeChangedListener(mOnVideoSizeChangedListener);
- synchronized (mVideoSizeChanged) {
- try {
- mMediaPlayer.prepare();
- mMediaPlayer.start();
- mVideoSizeChanged.wait(WAIT_FOR_COMMAND_TO_COMPLETE);
- } catch (Exception e) {
- Log.v(TAG, "wait was interrupted");
- }
- }
- videoHeight = mMediaPlayer.getVideoHeight();
- terminateMessageLooper();
- } catch (Exception e) {
- Log.e(TAG, e.getMessage());
- }
-
- return videoHeight;
- }
-
- //Register the videoSizeChanged listener
- public static int videoWidth(String filePath) throws Exception {
- Log.v(TAG, "videoWidth - " + filePath);
- int videoWidth = 0;
-
- synchronized (mLock) {
- initializeMessageLooper();
- try {
- mLock.wait(WAIT_FOR_COMMAND_TO_COMPLETE);
- } catch(Exception e) {
- Log.v(TAG, "looper was interrupted.");
- return 0;
- }
- }
- try {
- mMediaPlayer.setDataSource(filePath);
- mMediaPlayer.setDisplay(MediaFrameworkTest.getSurfaceView().getHolder());
- mMediaPlayer.setOnVideoSizeChangedListener(mOnVideoSizeChangedListener);
- synchronized (mVideoSizeChanged) {
- try {
- mMediaPlayer.prepare();
- mMediaPlayer.start();
- mVideoSizeChanged.wait(WAIT_FOR_COMMAND_TO_COMPLETE);
- } catch (Exception e) {
- Log.v(TAG, "wait was interrupted");
- }
- }
- videoWidth = mMediaPlayer.getVideoWidth();
- terminateMessageLooper();
- } catch (Exception e) {
- Log.e(TAG, e.getMessage());
- }
- return videoWidth;
- }
-
- //This also test the streaming video which may take a long
- //time to start the playback.
- public static boolean videoSeekTo(String filePath) throws Exception {
- Log.v(TAG, "videoSeekTo - " + filePath);
- int currentPosition = 0;
- int duration = 0;
- boolean videoResult = false;
- MediaPlayer mp = new MediaPlayer();
- mp.setDataSource(filePath);
- mp.setDisplay(MediaFrameworkTest.getSurfaceView().getHolder());
- mp.prepare();
- mp.start();
- if (filePath.equals(MediaNames.VIDEO_SHORT_3GP)) {
- mp.pause();
- Thread.sleep(MediaNames.PAUSE_WAIT_TIME);
- mp.seekTo(0);
- mp.start();
- Thread.sleep(1000);
- currentPosition = mp.getCurrentPosition();
- Log.v(TAG,"short position " + currentPosition);
- if (currentPosition > 100 )
- return true;
- else
- return false;
- }
- Thread.sleep(5000);
- duration = mp.getDuration();
- Log.v(TAG, "video duration " + duration);
- mp.pause();
- Thread.sleep(MediaNames.PAUSE_WAIT_TIME);
- mp.seekTo(duration - 20000 );
- mp.start();
- Thread.sleep(1000);
- mp.pause();
- Thread.sleep(MediaNames.PAUSE_WAIT_TIME);
- mp.seekTo(duration/2);
- mp.start();
- Thread.sleep(10000);
- currentPosition = mp.getCurrentPosition();
- Log.v(TAG, "video currentPosition " + currentPosition);
- mp.release();
- if (currentPosition > (duration /2 )*0.9)
- return true;
- else
- return false;
-
- }
-
- public static boolean seekToEnd(String filePath) {
- Log.v(TAG, "seekToEnd - " + filePath);
- int duration = 0;
- int currentPosition = 0;
- boolean isPlaying = false;
- MediaPlayer mp = new MediaPlayer();
- try {
- mp.setDataSource(filePath);
- Log.v(TAG, "start playback");
- mp.prepare();
- duration = mp.getDuration();
- mp.seekTo(duration - 3000);
- mp.start();
- Thread.sleep(6000);
- } catch (Exception e) {}
- isPlaying = mp.isPlaying();
- currentPosition = mp.getCurrentPosition();
- Log.v(TAG, "seekToEnd currentPosition= " + currentPosition + " isPlaying = " + isPlaying);
- mp.stop();
- mp.release();
- Log.v(TAG, "duration = " + duration);
- if (currentPosition < 0.9 * duration || isPlaying)
- return false;
- else
- return true;
- }
-
- public static boolean shortMediaStop(String filePath) {
- Log.v(TAG, "shortMediaStop - " + filePath);
- //This test is only for the short media file
- int duration = 0;
- int currentPosition = 0;
- boolean isPlaying = false;
- MediaPlayer mp = new MediaPlayer();
- try {
- mp.setDataSource(filePath);
- Log.v(TAG, "start playback");
- mp.prepare();
- duration = mp.getDuration();
- mp.start();
- Thread.sleep(10000);
- } catch (Exception e) {}
- isPlaying = mp.isPlaying();
- currentPosition = mp.getCurrentPosition();
- Log.v(TAG, "seekToEnd currentPosition= " + currentPosition + " isPlaying = " + isPlaying);
- mp.stop();
- mp.release();
- Log.v(TAG, "duration = " + duration);
- if (currentPosition > duration || isPlaying)
- return false;
- else
- return true;
- }
-
- public static boolean playToEnd(String filePath) {
- Log.v(TAG, "shortMediaStop - " + filePath);
- //This test is only for the short media file
- int duration = 200000;
- int updateDuration = 0;
- int currentPosition = 0;
- boolean isPlaying = false;
- MediaPlayer mp = new MediaPlayer();
- try {
- Thread.sleep(5000);
- mp.setDataSource(filePath);
- Log.v(TAG, "start playback");
- mp.prepare();
- //duration = mp.getDuration();
- mp.start();
- Thread.sleep(50000);
- } catch (Exception e){}
- isPlaying = mp.isPlaying();
- currentPosition = mp.getCurrentPosition();
- //updateDuration = mp.getDuration();
- Log.v(TAG, "seekToEnd currentPosition= " + currentPosition + " isPlaying = " + isPlaying);
- mp.stop();
- mp.release();
- //Log.v(TAG, "duration = " + duration);
- //Log.v(TAG, "Update duration = " + updateDuration);
- if (currentPosition > duration || isPlaying)
- return false;
- else
- return true;
- }
-
- public static boolean seektoBeforeStart(String filePath){
- Log.v(TAG, "seektoBeforeStart - " + filePath);
- //This test is only for the short media file
- int duration = 0;
- int currentPosition = 0;
-
- MediaPlayer mp = new MediaPlayer();
- try {
- mp.setDataSource(filePath);
- mp.prepare();
- duration = mp.getDuration();
- mp.seekTo(duration - 10000);
- mp.start();
- currentPosition=mp.getCurrentPosition();
- mp.stop();
- mp.release();
- } catch (Exception e) {}
- if (currentPosition < duration/2)
- return false;
- else
- return true;
- }
-
- public static boolean mediaRecorderRecord(String filePath){
- Log.v(TAG, "SoundRecording - " + filePath);
- //This test is only for the short media file
- int duration = 0;
- try {
- MediaRecorder mRecorder = new MediaRecorder();
- mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
- mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
- mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
- mRecorder.setOutputFile(filePath);
- mRecorder.prepare();
- mRecorder.start();
- Thread.sleep(500);
- mRecorder.stop();
- Log.v(TAG, "sound recorded");
- mRecorder.release();
- } catch (Exception e) {
- Log.v(TAG, e.toString());
- }
-
- //Verify the recorded file
- MediaPlayer mp = new MediaPlayer();
- try {
- mp.setDataSource(filePath);
- mp.prepare();
- duration = mp.getDuration();
- Log.v(TAG,"Duration " + duration);
- mp.release();
- } catch (Exception e) {}
- //Check the record media file length is greate than zero
- if (duration > 0)
- return true;
- else
- return false;
-
- }
-
- //Test for mediaMeta Data Thumbnail
- public static boolean getThumbnail(String filePath, String goldenPath) {
- Log.v(TAG, "getThumbnail - " + filePath);
-
- int goldenHeight = 0;
- int goldenWidth = 0;
- int outputWidth = 0;
- int outputHeight = 0;
-
- //This test is only for the short media file
- try {
- BitmapFactory mBitmapFactory = new BitmapFactory();
-
- MediaMetadataRetriever mMediaMetadataRetriever = new MediaMetadataRetriever();
- try {
- mMediaMetadataRetriever.setDataSource(filePath);
- } catch(Exception e) {
- e.printStackTrace();
- return false;
- }
- Bitmap outThumbnail = mMediaMetadataRetriever.getFrameAtTime(-1);
-
- //Verify the thumbnail
- Bitmap goldenBitmap = mBitmapFactory.decodeFile(goldenPath);
- outputWidth = outThumbnail.getWidth();
- outputHeight = outThumbnail.getHeight();
- goldenHeight = goldenBitmap.getHeight();
- goldenWidth = goldenBitmap.getWidth();
-
- //check the image dimension
- if ((outputWidth != goldenWidth) || (outputHeight != goldenHeight))
- return false;
-
- // Check half line of pixel
- int x = goldenHeight / 2;
- for (int j = 1; j < goldenWidth / 2; j++) {
- if (goldenBitmap.getPixel(x, j) != outThumbnail.getPixel(x, j)) {
- Log.v(TAG, "pixel = " + goldenBitmap.getPixel(x, j));
- return false;
- }
- }
- } catch (Exception e) {
- Log.v(TAG, e.toString());
- return false;
- }
- return true;
- }
-
- //Load midi file from resources
- public static boolean resourcesPlayback(AssetFileDescriptor afd, int expectedDuration) {
- int duration = 0;
- try {
- MediaPlayer mp = new MediaPlayer();
- mp.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(), afd.getLength());
- mp.prepare();
- mp.start();
- duration = mp.getDuration();
- Thread.sleep(5000);
- mp.release();
- } catch (Exception e) {
- Log.v(TAG,e.getMessage());
- }
- if (duration > expectedDuration)
- return true;
- else
- return false;
- }
-
- public static boolean prepareAsyncReset(String filePath) {
- //preparesAsync
- try {
- MediaPlayer mp = new MediaPlayer();
- mp.setDataSource(filePath);
- mp.prepareAsync();
- mp.reset();
- mp.release();
- } catch (Exception e) {
- Log.v(TAG,e.getMessage());
- return false;
- }
- return true;
- }
-
-
- public static boolean isLooping(String filePath) {
- MediaPlayer mp = null;
-
- try {
- mp = new MediaPlayer();
- if (mp.isLooping()) {
- Log.v(TAG, "MediaPlayer.isLooping() returned true after ctor");
- return false;
- }
- mp.setDataSource(filePath);
- mp.prepare();
-
- mp.setLooping(true);
- if (!mp.isLooping()) {
- Log.v(TAG, "MediaPlayer.isLooping() returned false after setLooping(true)");
- return false;
- }
-
- mp.setLooping(false);
- if (mp.isLooping()) {
- Log.v(TAG, "MediaPlayer.isLooping() returned true after setLooping(false)");
- return false;
- }
- } catch (Exception e) {
- Log.v(TAG, "Exception : " + e.toString());
- return false;
- } finally {
- if (mp != null)
- mp.release();
- }
-
- return true;
- }
-
- public static boolean isLoopingAfterReset(String filePath) {
- MediaPlayer mp = null;
- try {
- mp = new MediaPlayer();
- mp.setDataSource(filePath);
- mp.prepare();
-
- mp.setLooping(true);
- mp.reset();
- if (mp.isLooping()) {
- Log.v(TAG, "MediaPlayer.isLooping() returned true after reset()");
- return false;
- }
- } catch (Exception e){
- Log.v(TAG, "Exception : " + e.toString());
- return false;
- } finally {
- if (mp != null)
- mp.release();
- }
-
- return true;
- }
-
- /*
- * Initializes the message looper so that the mediaPlayer object can
- * receive the callback messages.
- */
- private static void initializeMessageLooper() {
- Log.v(TAG, "start looper");
- new Thread() {
- @Override
- public void run() {
- // Set up a looper to be used by camera.
- Looper.prepare();
- Log.v(TAG, "start loopRun");
- // Save the looper so that we can terminate this thread
- // after we are done with it.
- mLooper = Looper.myLooper();
- mMediaPlayer = new MediaPlayer();
- synchronized (mLock) {
- mInitialized = true;
- mLock.notify();
- }
- Looper.loop(); // Blocks forever until Looper.quit() is called.
- Log.v(TAG, "initializeMessageLooper: quit.");
- }
- }.start();
- }
-
- /*
- * Terminates the message looper thread.
- */
- private static void terminateMessageLooper() {
- mLooper.quit();
- mMediaPlayer.release();
- }
-
- static MediaPlayer.OnPreparedListener mPreparedListener = new MediaPlayer.OnPreparedListener() {
- public void onPrepared(MediaPlayer mp) {
- synchronized (mPrepareDone) {
- if(mPrepareReset) {
- Log.v(TAG, "call Reset");
- mMediaPlayer.reset();
- }
- Log.v(TAG, "notify the prepare callback");
- mPrepareDone.notify();
- mOnPrepareSuccess = true;
- }
- }
- };
-
- public static boolean prepareAsyncCallback(String filePath, boolean reset) throws Exception {
- //Added the PrepareReset flag which allow us to switch to different
- //test case.
- if (reset) {
- mPrepareReset = true;
- }
-
- synchronized (mLock) {
- initializeMessageLooper();
- try {
- mLock.wait(WAIT_FOR_COMMAND_TO_COMPLETE);
- } catch(Exception e) {
- Log.v(TAG, "looper was interrupted.");
- return false;
- }
- }
- try{
- mMediaPlayer.setOnPreparedListener(mPreparedListener);
- mMediaPlayer.setDataSource(filePath);
- mMediaPlayer.setDisplay(MediaFrameworkTest.getSurfaceView().getHolder());
- mMediaPlayer.prepareAsync();
- synchronized (mPrepareDone) {
- try {
- mPrepareDone.wait(WAIT_FOR_COMMAND_TO_COMPLETE);
- } catch (Exception e) {
- Log.v(TAG, "wait was interrupted.");
- }
- }
- terminateMessageLooper();
- }catch (Exception e) {
- Log.v(TAG,e.getMessage());
- }
- return mOnPrepareSuccess;
- }
-
- static MediaPlayer.OnCompletionListener mCompletionListener = new MediaPlayer.OnCompletionListener() {
- public void onCompletion(MediaPlayer mp) {
- synchronized (mOnCompletion) {
- Log.v(TAG, "notify the completion callback");
- mOnCompletion.notify();
- mOnCompleteSuccess = true;
- }
- }
- };
-
- static MediaPlayer.OnErrorListener mOnErrorListener = new MediaPlayer.OnErrorListener() {
- public boolean onError(MediaPlayer mp, int framework_err, int impl_err) {
- mPlaybackError = true;
- mp.reset();
- return true;
- }
- };
-
- static MediaPlayer.OnInfoListener mInfoListener = new MediaPlayer.OnInfoListener() {
- public boolean onInfo(MediaPlayer mp, int what, int extra) {
- switch (what) {
- case MediaPlayer.MEDIA_INFO_UNKNOWN:
- mMediaInfoUnknownCount++;
- break;
- case MediaPlayer.MEDIA_INFO_VIDEO_TRACK_LAGGING:
- mMediaInfoVideoTrackLaggingCount++;
- break;
- case MediaPlayer.MEDIA_INFO_BAD_INTERLEAVING:
- mMediaInfoBadInterleavingCount++;
- break;
- case MediaPlayer.MEDIA_INFO_NOT_SEEKABLE:
- mMediaInfoNotSeekableCount++;
- break;
- case MediaPlayer.MEDIA_INFO_METADATA_UPDATE:
- mMediaInfoMetdataUpdateCount++;
- break;
- }
- return true;
- }
- };
-
- // For each media file, forward twice and backward once, then play to the end
- public static boolean playMediaSamples(AssetFileDescriptor afd) throws Exception {
- int duration = 0;
- int curPosition = 0;
- int nextPosition = 0;
- int waittime = 0;
- mOnCompleteSuccess = false;
- mMediaInfoUnknownCount = 0;
- mMediaInfoVideoTrackLaggingCount = 0;
- mMediaInfoBadInterleavingCount = 0;
- mMediaInfoNotSeekableCount = 0;
- mMediaInfoMetdataUpdateCount = 0;
- mPlaybackError = false;
- String testResult;
-
- initializeMessageLooper();
- synchronized (mLock) {
- try {
- mLock.wait(WAIT_FOR_COMMAND_TO_COMPLETE);
- } catch(Exception e) {
- Log.v(TAG, "looper was interrupted.");
- return false;
- }
- }
- try {
- mMediaPlayer.setOnCompletionListener(mCompletionListener);
- mMediaPlayer.setOnErrorListener(mOnErrorListener);
- mMediaPlayer.setOnInfoListener(mInfoListener);
- Log.v(TAG, "playMediaSamples: sample file name " + afd.toString());
- mMediaPlayer.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
- mMediaPlayer.setDisplay(MediaFrameworkTest.getSurfaceView().getHolder());
- mMediaPlayer.prepare();
- duration = mMediaPlayer.getDuration();
- // start to play
- mMediaPlayer.start();
- waittime = duration - mMediaPlayer.getCurrentPosition();
- synchronized(mOnCompletion) {
- try {
- mOnCompletion.wait(waittime + 2000);
- } catch (Exception e) {
- Log.v(TAG, "playMediaSamples are interrupted");
- return false;
- }
- }
- terminateMessageLooper();
- } catch (Exception e) {
- Log.v(TAG, "playMediaSamples:" + e.getMessage());
- }
- return mOnCompleteSuccess;
- }
-}
diff --git a/tests/tests/mediastress/src/android/mediastress/cts/MediaFrameworkTest.java b/tests/tests/mediastress/src/android/mediastress/cts/MediaFrameworkTest.java
deleted file mode 100644
index 690fd60..0000000
--- a/tests/tests/mediastress/src/android/mediastress/cts/MediaFrameworkTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.mediastress.cts;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.Bitmap;
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.PowerManager;
-import android.util.Log;
-import android.view.SurfaceHolder;
-import android.view.SurfaceView;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-
-import com.android.cts.mediastress.R;
-
-public class MediaFrameworkTest extends Activity implements SurfaceHolder.Callback {
- private static String TAG = "MediaFrameworkTest";
- private static SurfaceView mSurfaceView;
-
- private Bitmap mDestBitmap;
- private ImageView mOverlayView;
- private SurfaceHolder mSurfaceHolder = null;
-
- private PowerManager.WakeLock mWakeLock = null;
-
- public static SurfaceView getSurfaceView() {
- return mSurfaceView;
- }
-
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- setContentView(R.layout.surface_view);
- mSurfaceView = (SurfaceView)findViewById(R.id.surface_view);
- mOverlayView = (ImageView)findViewById(R.id.overlay_layer);
- ViewGroup.LayoutParams lp = mSurfaceView.getLayoutParams();
- mSurfaceHolder = mSurfaceView.getHolder();
- mSurfaceHolder.addCallback(this);
-
- mOverlayView.setLayoutParams(lp);
- mDestBitmap = Bitmap.createBitmap((int)640, (int)480, Bitmap.Config.ARGB_8888);
- mOverlayView.setImageBitmap(mDestBitmap);
-
- //Acquire the full wake lock to keep the device up
- PowerManager pm = (PowerManager) this.getSystemService(Context.POWER_SERVICE);
- mWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "MediaFrameworkTest");
- mWakeLock.acquire();
- }
-
- public void onStop(Bundle icicle) {
- mWakeLock.release();
- }
-
- public void surfaceDestroyed(SurfaceHolder holder) {
- //Can do nothing in here. The test case will fail if the surface destroyed.
- Log.v(TAG, "Test application surface destroyed");
- mSurfaceHolder = null;
- }
-
- public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
- //Do nothing in here. Just print out the log
- Log.v(TAG, "Test application surface changed");
- }
-
- public void surfaceCreated(SurfaceHolder holder) {
- }
-
- public void startPlayback(String filename){
- String mimetype = "audio/mpeg";
- Uri path = Uri.parse(filename);
- Intent intent = new Intent(Intent.ACTION_VIEW);
- intent.setDataAndType(path, mimetype);
- startActivity(intent);
- }
-}
diff --git a/tests/tests/mediastress/src/android/mediastress/cts/MediaNames.java b/tests/tests/mediastress/src/android/mediastress/cts/MediaNames.java
deleted file mode 100644
index e206b2f..0000000
--- a/tests/tests/mediastress/src/android/mediastress/cts/MediaNames.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package android.mediastress.cts;
-
-/**
- *
- * This class has the names of the all the activity name and variables in the
- * instrumentation test.
- *
- */
-public class MediaNames {
- // A directory to hold all kinds of media files
- public static final String MEDIA_SAMPLE_POOL = "/sdcard/media_api/samples/";
- // Audio files
- public static final String MP3CBR = "/sdcard/media_api/music/MP3_48KHz_128kbps_s_1_17_CBR.mp3";
- public static final String MP3VBR = "/sdcard/media_api/music/MP3_48KHz_128kbps_s_1_17_VBR.mp3";
- public static final String MP3ABR = "/sdcard/media_api/music/MP3_48KHz_128kbps_s_1_17_ABR.mp3";
- public static final String SHORTMP3 = "/sdcard/media_api/music/SHORTMP3.mp3";
- public static final String MIDI = "/sdcard/media_api/music/ants.mid";
- public static final String WAV = "/sdcard/media_api/music/rings_2ch.wav";
- public static final String AMR = "/sdcard/media_api/music/test_amr_ietf.amr";
- public static final String SINE_200_1000 = "/sdcard/media_api/music/sine_200+1000Hz_44K_mo.wav";
- // public static final String OGG =
- // "/sdcard/media_api/music/Revelation.ogg";
-
- public static final int MP3CBR_LENGTH = 71000;
- public static final int MP3VBR_LENGTH = 71000;
- public static final int SHORTMP3_LENGTH = 286;
- public static final int MIDI_LENGTH = 17000;
- public static final int AMR_LENGTH = 37000;
- public static final int SEEK_TIME = 10000;
-
- public static final long PAUSE_WAIT_TIME = 3000;
- public static final long WAIT_TIME = 2000;
- public static final long WAIT_SNAPSHOT_TIME = 5000;
-
- // local video
- public static final String VIDEO_MP4 = "/sdcard/media_api/video/MPEG4_320_AAC_64.mp4";
- public static final String VIDEO_SHORT_3GP = "/sdcard/media_api/video/short.3gp";
- public static final String VIDEO_LARGE_SIZE_3GP = "/sdcard/media_api/video/border_large.3gp";
- public static final String VIDEO_H263_AAC = "/sdcard/media_api/video/H263_56_AAC_24.3gp";
- public static final String VIDEO_H263_AMR = "/sdcard/media_api/video/H263_56_AMRNB_6.3gp";
- public static final String VIDEO_H264_AAC = "/sdcard/media_api/video/H264_320_AAC_64.3gp";
- public static final String VIDEO_H264_AMR = "/sdcard/media_api/video/H264_320_AMRNB_6.3gp";
- public static final String VIDEO_HIGHRES_H263 = "/sdcard/media_api/video/H263_500_AMRNB_12.3gp";
- public static final String VIDEO_HIGHRES_MP4 = "/sdcard/media_api/video/H264_500_AAC_128.3gp";
- public static final String VIDEO_WEBM = "/sdcard/media_api/video/big-buck-bunny_trailer.webm";
-
- // Media Recorder
- public static final String RECORDER_OUTPUT = "/sdcard/media_api/recorderOutput.amr";
-
- // video thumbnail
- public static final String THUMBNAIL_OUTPUT = "/sdcard/media_api/videoThumbnail.png";
- public static final String GOLDEN_THUMBNAIL_OUTPUT = "/sdcard/media_api/goldenThumbnail.png";
-
- /*
- * Metadata Utility Test media files which contain meta data.
- */
- public static final String[] THUMBNAIL_METADATA_TEST_FILES = {
- "/sdcard/media_api/video/H263_500_AMRNB_12.3gp",
- "/sdcard/media_api/video/H263_56_AAC_24.3gp",
- "/sdcard/media_api/video/H263_56_AMRNB_6.3gp",
- "/sdcard/media_api/video/H264_320_AAC_64.3gp",
- "/sdcard/media_api/video/H264_320_AMRNB_6.3gp",
- "/sdcard/media_api/video/H264_500_AAC_128.3gp",
- "/sdcard/media_api/video/H264_HVGA_500_NO_AUDIO.3gp",
- "/sdcard/media_api/video/H264_QVGA_500_NO_AUDIO.3gp",
- "/sdcard/media_api/video/MPEG4_320_AAC_64.mp4",
- "/sdcard/media_api/video/border_large.3gp",
- "/sdcard/media_api/videoeditor/H264_BP_800x480_15fps_512kbps_AACLC_24KHz_38Kbps_s_1_17.mp4",
- "/sdcard/media_api/videoeditor/H264_MP_960x720_25fps_800kbps_AACLC_48Khz_192Kbps_s_1_17.mp4",
- "/sdcard/media_api/videoeditor/MPEG4_SP_640x480_15fps_512kbps_AACLC_48khz_132kbps_s_0_26.mp4",
- "/sdcard/media_api/videoeditor/MPEG4_SP_176x144_12fps_92kbps_AMRNB_8KHz_12.2kbps_m_0_27.3gp",
- "/sdcard/media_api/videoeditor/MPEG4_SP_720x480_30fps_280kbps_AACLC_48kHz_161kbps_s_0_26.mp4"
- };
-
- public static final String[] ALBUMART_TEST_FILES = {
- "/sdcard/media_api/music/MP3_48KHz_128kbps_s_1_17_ID3V1_ID3V2.mp3",
- "/sdcard/media_api/music/MP3_48KHz_128kbps_s_1_17_ID3V2.mp3",
- "/sdcard/media_api/music/MP3_48KHz_128kbps_s_1_17_ID3V1.mp3",
- };
-
- // TEST_PATH_1: is a video and contains metadata for key "num-tracks"
- // TEST_PATH_2: any valid media file.
- // TEST_PATH_3: invalid media file
- public static final String TEST_PATH_1 = "/sdcard/media_api/video/MPEG4_320_AAC_64.mp4";
- public static final String TEST_PATH_3 = "/sdcard/media_api/data.txt";
- public static final String TEST_PATH_4 = "somenonexistingpathname";
- public static final String TEST_PATH_5 = "mem://012345";
-
- // Meta data expected result
- // The expected tag result in the following order
- // cd_track_number, album, artist, author, composer, date, genre
- // title, years, duration
- public static final String META_DATA_MP3[][] = {
- {"/sdcard/media_api/music/MP3_48KHz_128kbps_s_1_17_ID3V1_ID3V2.mp3", "2/34",
- "Test ID3V2 Album", "Test ID3V2 Artist", null, "Test ID3V2 Composer",
- null, "(1)Classic Rock", "Test ID3V2 Title ", null, "77640", "1", null},
- {"/sdcard/media_api/music/MP3_48KHz_128kbps_s_1_17_ID3V2.mp3", "1/10",
- "Test ID3V2 Album", "Test ID3V2 Artist", null, "Test ID3V2 Composer",
- null, "(74)Acid Jazz", "Test ID3V2 Tag", null, "77640", "1", null},
- {"/sdcard/media_api/music/MP3_48KHz_128kbps_s_1_17_ID3V1.mp3", "2",
- "Test ID3V1 Album", "Test ID3V1 Artist", null, null, null, "(15)",
- "Test ID3V1 Title", "2011", "77640", "1", null}
- };
-
- // output recorded video
- public static final String RECORDED_HVGA_H263 = "/sdcard/HVGA_H263.3gp";
- public static final String RECORDED_QVGA_H263 = "/sdcard/QVGA_H263.3gp";
- public static final String RECORDED_SQVGA_H263 = "/sdcard/SQVGA_H263.3gp";
- public static final String RECORDED_CIF_H263 = "/sdcard/CIF_H263.3gp";
- public static final String RECORDED_QCIF_H263 = "/sdcard/QCIF_H263.3gp";
- public static final String RECORDED_PORTRAIT_H263 = "/sdcard/QCIF_mp4.3gp";
-
- public static final String RECORDED_HVGA_MP4 = "/sdcard/HVGA_mp4.mp4";
- public static final String RECORDED_QVGA_MP4 = "/sdcard/QVGA_mp4.mp4";
- public static final String RECORDED_SQVGA_MP4 = "/sdcard/SQVGA_mp4.mp4";
- public static final String RECORDED_CIF_MP4 = "/sdcard/CIF_mp4.mp4";
- public static final String RECORDED_QCIF_MP4 = "/sdcard/QCIF_mp4.mp4";
-
- public static final String RECORDED_VIDEO_3GP = "/sdcard/temp.3gp";
-
- public static final String INVALD_VIDEO_PATH =
- "/sdcard/media_api/filepathdoesnotexist" + "/filepathdoesnotexist/temp.3gp";
-
- public static final long RECORDED_TIME = 5000;
- public static final long VALID_VIDEO_DURATION = 2000;
-
- // Streaming test files
- public static final byte[] STREAM_SERVER =
- new byte[] {(byte) 75, (byte) 17, (byte) 48, (byte) 204};
- public static final String STREAM_H264_480_360_1411k =
- "http://75.17.48.204:10088/yslau/stress_media/h264_regular.mp4";
- public static final String STREAM_WMV = "http://75.17.48.204:10088/yslau/stress_media/bugs.wmv";
- public static final String STREAM_H263_176x144_325k =
- "http://75.17.48.204:10088/yslau/stress_media/h263_regular.3gp";
- public static final String STREAM_H264_352x288_1536k =
- "http://75.17.48.204:10088/yslau/stress_media/h264_highBitRate.mp4";
- public static final String STREAM_MP3 =
- "http://75.17.48.204:10088/yslau/stress_media/mp3_regular.mp3";
- public static final String STREAM_MPEG4_QVGA_128k =
- "http://75.17.48.204:10088/yslau/stress_media/mpeg4_qvga_24fps.3gp";
- 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;
-}
diff --git a/tests/tests/mediastress/src/android/mediastress/cts/MediaPlayerStressTest.java b/tests/tests/mediastress/src/android/mediastress/cts/MediaPlayerStressTest.java
deleted file mode 100644
index a47ee3e..0000000
--- a/tests/tests/mediastress/src/android/mediastress/cts/MediaPlayerStressTest.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.mediastress.cts;
-
-import android.app.Activity;
-import android.app.Instrumentation;
-import android.content.Intent;
-import android.content.res.AssetFileDescriptor;
-import android.test.suitebuilder.annotation.LargeTest;
-import android.util.Log;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.Writer;
-
-import android.test.InstrumentationTestCase;
-
-// stress test for MediaPlayer. To overcome the limitation of 10 mins time out in CTS,
-// one test run will only run one video clip. To allow playing multiple clips, static list of
-// video clips is stored. This works when TestRunner generates multiple MediaPlayerStressTest
-public class MediaPlayerStressTest extends InstrumentationTestCase {
- private static String TAG = "MediaPlayerStressTest";
- private static String mVideos[];
- private static int mVideoIndex;
-
- private String mAssetName;
-
- protected void setUp() throws Exception {
- if (mVideos == null) {
- mVideos = getInstrumentation().getContext().getAssets().list(MediaStressTestRunner.VIDEO_DIR);
- }
- // get asset file name for every instance to test different files
- mAssetName = MediaStressTestRunner.VIDEO_DIR + File.separator +
- mVideos[mVideoIndex];
- mVideoIndex++;
- if (mVideoIndex >= mVideos.length) {
- mVideoIndex = 0;
- }
- super.setUp();
- }
-
- private int mTotalPlaybackError;
- private int mTotalComplete;
- private int mTotalInfoUnknown;
- private int mTotalVideoTrackLagging;
- private int mTotalBadInterleaving;
- private int mTotalNotSeekable;
- private int mTotalMetaDataUpdate;
-
- private void writeTestOutput(String filename, Writer output) throws Exception{
- output.write("File Name: " + filename);
- output.write(" Complete: " + CodecTest.mOnCompleteSuccess);
- output.write(" Error: " + CodecTest.mPlaybackError);
- output.write(" Unknown Info: " + CodecTest.mMediaInfoUnknownCount);
- output.write(" Track Lagging: " + CodecTest.mMediaInfoVideoTrackLaggingCount);
- output.write(" Bad Interleaving: " + CodecTest.mMediaInfoBadInterleavingCount);
- output.write(" Not Seekable: " + CodecTest.mMediaInfoNotSeekableCount);
- output.write(" Info Meta data update: " + CodecTest.mMediaInfoMetdataUpdateCount);
- output.write("\n");
- }
-
- private void writeTestSummary(Writer output) throws Exception{
- output.write("Total Result:\n");
- output.write("Total Complete: " + mTotalComplete + "\n");
- output.write("Total Error: " + mTotalPlaybackError + "\n");
- output.write("Total Unknown Info: " + mTotalInfoUnknown + "\n");
- output.write("Total Track Lagging: " + mTotalVideoTrackLagging + "\n" );
- output.write("Total Bad Interleaving: " + mTotalBadInterleaving + "\n");
- output.write("Total Not Seekable: " + mTotalNotSeekable + "\n");
- output.write("Total Info Meta data update: " + mTotalMetaDataUpdate + "\n");
- output.write("\n");
- }
-
- private void updateTestResult(){
- if (CodecTest.mOnCompleteSuccess){
- mTotalComplete++;
- }
- else if (CodecTest.mPlaybackError){
- mTotalPlaybackError++;
- }
- mTotalInfoUnknown += CodecTest.mMediaInfoUnknownCount;
- mTotalVideoTrackLagging += CodecTest.mMediaInfoVideoTrackLaggingCount;
- mTotalBadInterleaving += CodecTest.mMediaInfoBadInterleavingCount;
- mTotalNotSeekable += CodecTest.mMediaInfoNotSeekableCount;
- mTotalMetaDataUpdate += CodecTest.mMediaInfoMetdataUpdateCount;
- }
-
- //Test that will start the playback for all the videos
- //under the samples folder
- @LargeTest
- public void testVideoPlayback() throws Exception {
- File playbackOutput = new File("/sdcard/PlaybackTestResult.txt");
- Writer output = new BufferedWriter(new FileWriter(playbackOutput, true));
-
- boolean testResult = true;
- boolean onCompleteSuccess = false;
-
- Instrumentation inst = getInstrumentation();
- Intent intent = new Intent();
-
- intent.setClass(inst.getTargetContext(), MediaFrameworkTest.class);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-
- Activity act = inst.startActivitySync(intent);
-
- AssetFileDescriptor afd = act.getAssets().openFd(mAssetName);
- Log.v(TAG, "start playing " + mAssetName);
- onCompleteSuccess =
- CodecTest.playMediaSamples(afd);
- if (!onCompleteSuccess) {
- //Don't fail the test right away, print out the failure file.
- Log.v(TAG, "Failure File : " + mAssetName);
- testResult = false;
- }
- Thread.sleep(3000);
-
- act.finish();
- //Write test result to an output file
- writeTestOutput(mAssetName,output);
- //Get the summary
- updateTestResult();
-
- writeTestSummary(output);
- output.close();
- assertTrue("playback " + mAssetName, testResult);
-
- }
-}
diff --git a/tests/tests/mediastress/src/android/mediastress/cts/MediaRecorderStressTest.java b/tests/tests/mediastress/src/android/mediastress/cts/MediaRecorderStressTest.java
deleted file mode 100644
index 2536ee3..0000000
--- a/tests/tests/mediastress/src/android/mediastress/cts/MediaRecorderStressTest.java
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.mediastress.cts;
-
-import android.hardware.Camera;
-import android.media.CamcorderProfile;
-import android.media.MediaPlayer;
-import android.media.MediaRecorder;
-import android.os.Handler;
-import android.os.Looper;
-import android.test.ActivityInstrumentationTestCase2;
-import android.test.suitebuilder.annotation.LargeTest;
-import android.util.Log;
-import android.view.SurfaceHolder;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.Writer;
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
-
-public class MediaRecorderStressTest extends ActivityInstrumentationTestCase2<MediaFrameworkTest> {
-
- private static String TAG = "MediaRecorderStressTest";
- private static final int NUMBER_OF_CAMERA_STRESS_LOOPS = 50;
- private static final int NUMBER_OF_RECORDER_STRESS_LOOPS = 50;
- private static final int NUMBER_OF_RECORDERANDPLAY_STRESS_LOOPS = 50;
- private static final int NUMBER_OF_SWTICHING_LOOPS_BW_CAMERA_AND_RECORDER = 50;
- private static final long WAIT_TIME_CAMERA_TEST = 3000; // in ms
- private static final long WAIT_TIME_RECORDER_TEST = 5000; // in ms
- private static final String OUTPUT_FILE = "/sdcard/temp";
- private static final String OUTPUT_FILE_EXT = ".3gp";
- private static final String MEDIA_STRESS_OUTPUT =
- "/sdcard/mediaStressOutput.txt";
- private final CameraErrorCallback mCameraErrorCallback = new CameraErrorCallback();
- private final RecorderErrorCallback mRecorderErrorCallback = new RecorderErrorCallback();
- private final static int WAIT_TIMEOUT = 10000;
-
- private MediaRecorder mRecorder;
- private Camera mCamera;
- private Thread mLooperThread;
- private Handler mHandler;
-
- public static int mCameraId;
- public static int mProfileQuality = CamcorderProfile.QUALITY_HIGH;
- public static CamcorderProfile profile =
- CamcorderProfile.get(mCameraId, mProfileQuality);
-
- private int mIterations = 50;
- private int mVideoEncoder;
- private int mAudioEncoder;
- private int mFrameRate;
- private int mVideoWidth;
- private int mVideoHeight;
- private int mBitRate;
- private boolean mRemoveVideo = true;
- private int mRecordDuration = 5000;
-
- public MediaRecorderStressTest() {
- super(MediaFrameworkTest.class);
- }
-
- protected void setUp() throws Exception {
- int cameraId = 0;
- CamcorderProfile profile = CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_HIGH);
- mVideoEncoder = profile.videoCodec;
- mAudioEncoder = profile.audioCodec;
- mFrameRate = profile.videoFrameRate;
- mVideoWidth = profile.videoFrameWidth;
- mVideoHeight = profile.videoFrameHeight;
- mBitRate = profile.videoBitRate;
-
- final Semaphore sem = new Semaphore(0);
- mLooperThread = new Thread() {
- @Override
- public void run() {
- Log.v(TAG, "starting looper");
- Looper.prepare();
- mHandler = new Handler();
- sem.release();
- Looper.loop();
- Log.v(TAG, "quit looper");
- }
- };
- mLooperThread.start();
- if (!sem.tryAcquire(WAIT_TIMEOUT, TimeUnit.MILLISECONDS)) {
- fail("Failed to start the looper.");
- }
-
- getActivity();
- super.setUp();
- }
-
- @Override
- protected void tearDown() throws Exception {
- if (mHandler != null) {
- mHandler.getLooper().quit();
- mHandler = null;
- }
- if (mLooperThread != null) {
- mLooperThread.join(WAIT_TIMEOUT);
- if (mLooperThread.isAlive()) {
- fail("Failed to stop the looper.");
- }
- mLooperThread = null;
- }
-
- super.tearDown();
- }
-
- private void runOnLooper(final Runnable command) throws InterruptedException {
- final Semaphore sem = new Semaphore(0);
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- try {
- command.run();
- } finally {
- sem.release();
- }
- }
- });
- if (! sem.tryAcquire(WAIT_TIMEOUT, TimeUnit.MILLISECONDS)) {
- fail("Failed to run the command on the looper.");
- }
- }
-
- private final class CameraErrorCallback implements android.hardware.Camera.ErrorCallback {
- public void onError(int error, android.hardware.Camera camera) {
- assertTrue("Camera test mediaserver died", error != android.hardware.Camera.CAMERA_ERROR_SERVER_DIED);
- }
- }
-
- private final class RecorderErrorCallback implements MediaRecorder.OnErrorListener {
- public void onError(MediaRecorder mr, int what, int extra) {
- // fail the test case no matter what error come up
- fail("mediaRecorder error");
- }
- }
-
- //Test case for stressing the camera preview.
- @LargeTest
- public void testStressCamera() throws Exception {
- SurfaceHolder mSurfaceHolder;
- mSurfaceHolder = MediaFrameworkTest.getSurfaceView().getHolder();
- File stressOutFile = new File(MEDIA_STRESS_OUTPUT);
- Writer output = new BufferedWriter(new FileWriter(stressOutFile, true));
- output.write("Camera start preview stress:\n");
- output.write("Total number of loops:" +
- NUMBER_OF_CAMERA_STRESS_LOOPS + "\n");
-
- Log.v(TAG, "Start preview");
- output.write("No of loop: ");
-
- for (int i = 0; i< NUMBER_OF_CAMERA_STRESS_LOOPS; i++) {
- runOnLooper(new Runnable() {
- @Override
- public void run() {
- mCamera = Camera.open();
- }
- });
- mCamera.setErrorCallback(mCameraErrorCallback);
- mCamera.setPreviewDisplay(mSurfaceHolder);
- mCamera.startPreview();
- Thread.sleep(WAIT_TIME_CAMERA_TEST);
- mCamera.stopPreview();
- mCamera.release();
- output.write(" ," + i);
- }
-
- output.write("\n\n");
- output.close();
- }
-
- //Test case for stressing the camera preview.
- @LargeTest
- public void testStressRecorder() throws Exception {
- String filename;
- SurfaceHolder mSurfaceHolder;
- mSurfaceHolder = MediaFrameworkTest.getSurfaceView().getHolder();
- File stressOutFile = new File(MEDIA_STRESS_OUTPUT);
- Writer output = new BufferedWriter(new FileWriter(stressOutFile, true));
- output.write("H263 video record- reset after prepare Stress test\n");
- output.write("Total number of loops:" +
- NUMBER_OF_RECORDER_STRESS_LOOPS + "\n");
-
- output.write("No of loop: ");
- Log.v(TAG, "Start preview");
- for (int i = 0; i < NUMBER_OF_RECORDER_STRESS_LOOPS; i++) {
- runOnLooper(new Runnable() {
- @Override
- public void run() {
- mRecorder = new MediaRecorder();
- }
- });
- Log.v(TAG, "counter = " + i);
- filename = OUTPUT_FILE + i + OUTPUT_FILE_EXT;
- Log.v(TAG, filename);
- mRecorder.setOnErrorListener(mRecorderErrorCallback);
- mRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
- mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
- mRecorder.setOutputFile(filename);
- mRecorder.setVideoFrameRate(mFrameRate);
- mRecorder.setVideoSize(176,144);
- Log.v(TAG, "setEncoder");
- mRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H263);
- mSurfaceHolder = MediaFrameworkTest.getSurfaceView().getHolder();
- Log.v(TAG, "setPreview");
- mRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());
- Log.v(TAG, "prepare");
- mRecorder.prepare();
- Log.v(TAG, "before release");
- Thread.sleep(WAIT_TIME_RECORDER_TEST);
- mRecorder.reset();
- mRecorder.release();
- output.write(", " + i);
- }
-
- output.write("\n\n");
- output.close();
- }
-
- //Stress test case for switching camera and video recorder preview.
- @LargeTest
- public void testStressCameraSwitchRecorder() throws Exception {
- String filename;
- SurfaceHolder mSurfaceHolder;
- mSurfaceHolder = MediaFrameworkTest.getSurfaceView().getHolder();
- File stressOutFile = new File(MEDIA_STRESS_OUTPUT);
- Writer output = new BufferedWriter(new FileWriter(stressOutFile, true));
- output.write("Camera and video recorder preview switching\n");
- output.write("Total number of loops:"
- + NUMBER_OF_SWTICHING_LOOPS_BW_CAMERA_AND_RECORDER + "\n");
-
- Log.v(TAG, "Start preview");
- output.write("No of loop: ");
- for (int i = 0; i < NUMBER_OF_SWTICHING_LOOPS_BW_CAMERA_AND_RECORDER; i++) {
- runOnLooper(new Runnable() {
- @Override
- public void run() {
- mCamera = Camera.open();
- }
- });
- mCamera.setErrorCallback(mCameraErrorCallback);
- mCamera.setPreviewDisplay(mSurfaceHolder);
- mCamera.startPreview();
- Thread.sleep(WAIT_TIME_CAMERA_TEST);
- mCamera.stopPreview();
- mCamera.release();
- mCamera = null;
- Log.v(TAG, "release camera");
- filename = OUTPUT_FILE + i + OUTPUT_FILE_EXT;
- Log.v(TAG, filename);
- runOnLooper(new Runnable() {
- @Override
- public void run() {
- mRecorder = new MediaRecorder();
- }
- });
- mRecorder.setOnErrorListener(mRecorderErrorCallback);
- mRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
- mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
- mRecorder.setOutputFile(filename);
- mRecorder.setVideoFrameRate(mFrameRate);
- mRecorder.setVideoSize(176,144);
- Log.v(TAG, "Media recorder setEncoder");
- mRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H263);
- Log.v(TAG, "mediaRecorder setPreview");
- mRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());
- Log.v(TAG, "prepare");
- mRecorder.prepare();
- Log.v(TAG, "before release");
- Thread.sleep(WAIT_TIME_CAMERA_TEST);
- mRecorder.release();
- Log.v(TAG, "release video recorder");
- output.write(", " + i);
- }
-
- output.write("\n\n");
- output.close();
- }
-
- public void validateRecordedVideo(String recordedFile) throws Exception {
- MediaPlayer mp = new MediaPlayer();
- mp.setDataSource(recordedFile);
- mp.prepare();
- int duration = mp.getDuration();
- if (duration <= 0){
- assertTrue("stressRecordAndPlayback", false);
- }
- mp.release();
- }
-
- public void removeRecodedVideo(String filename){
- File video = new File(filename);
- Log.v(TAG, "remove recorded video " + filename);
- video.delete();
- }
-
- //Stress test case for record a video and play right away.
- @LargeTest
- public void testStressRecordVideoAndPlayback() throws Exception {
- String filename;
- SurfaceHolder mSurfaceHolder;
- mSurfaceHolder = MediaFrameworkTest.getSurfaceView().getHolder();
- File stressOutFile = new File(MEDIA_STRESS_OUTPUT);
- Writer output = new BufferedWriter(
- new FileWriter(stressOutFile, true));
- output.write("Video record and play back stress test:\n");
- output.write("Total number of loops:"
- + NUMBER_OF_RECORDERANDPLAY_STRESS_LOOPS + "\n");
-
- output.write("No of loop: ");
- for (int i = 0; i < mIterations; i++){
- filename = OUTPUT_FILE + i + OUTPUT_FILE_EXT;
- Log.v(TAG, filename);
- runOnLooper(new Runnable() {
- @Override
- public void run() {
- mRecorder = new MediaRecorder();
- }
- });
- Log.v(TAG, "iterations : " + mIterations);
- Log.v(TAG, "videoEncoder : " + mVideoEncoder);
- Log.v(TAG, "audioEncoder : " + mAudioEncoder);
- Log.v(TAG, "frameRate : " + mFrameRate);
- Log.v(TAG, "videoWidth : " + mVideoWidth);
- Log.v(TAG, "videoHeight : " + mVideoHeight);
- Log.v(TAG, "bitRate : " + mBitRate);
- Log.v(TAG, "recordDuration : " + mRecordDuration);
-
- mRecorder.setOnErrorListener(mRecorderErrorCallback);
- mRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
- mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
- mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
- mRecorder.setOutputFile(filename);
- mRecorder.setVideoFrameRate(mFrameRate);
- mRecorder.setVideoSize(mVideoWidth, mVideoHeight);
- mRecorder.setVideoEncoder(mVideoEncoder);
- mRecorder.setAudioEncoder(mAudioEncoder);
- Log.v(TAG, "mediaRecorder setPreview");
- mRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());
- mRecorder.prepare();
- mRecorder.start();
- Thread.sleep(mRecordDuration);
- Log.v(TAG, "Before stop");
- mRecorder.stop();
- mRecorder.release();
- //start the playback
- MediaPlayer mp = new MediaPlayer();
- mp.setDataSource(filename);
- mp.setDisplay(MediaFrameworkTest.getSurfaceView().getHolder());
- mp.prepare();
- mp.start();
- Thread.sleep(mRecordDuration);
- mp.release();
- validateRecordedVideo(filename);
- if (mRemoveVideo) {
- removeRecodedVideo(filename);
- }
- output.write(", " + i);
- }
-
- output.write("\n\n");
- output.close();
- }
-}
diff --git a/tests/tests/mediastress/src/android/mediastress/cts/MediaStressTestRunner.java b/tests/tests/mediastress/src/android/mediastress/cts/MediaStressTestRunner.java
deleted file mode 100755
index 087153b..0000000
--- a/tests/tests/mediastress/src/android/mediastress/cts/MediaStressTestRunner.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.mediastress.cts;
-
-
-
-import android.test.InstrumentationTestRunner;
-import android.test.InstrumentationTestSuite;
-import android.util.Log;
-
-import java.io.IOException;
-import junit.framework.Assert;
-import junit.framework.TestSuite;
-
-public class MediaStressTestRunner extends InstrumentationTestRunner {
- // location of video clips under assets
- // test for testing this code, video for full testing
- public static String VIDEO_DIR = "video";
-
- private static String TAG = "MediaStressTestRunner";
-
- @Override
- public TestSuite getAllTests() {
-
- String videos[] = null;
- try {
- videos = getContext().getAssets().list(VIDEO_DIR);
- } catch(IOException e) {
- Assert.fail("cannot read test video clips");
- }
- if (videos == null) {
- Assert.fail("no video clips, dir is empty ");
- }
-
- TestSuite suite = new InstrumentationTestSuite(this);
- Log.v(TAG, "generating playback test " + videos.length);
-
- // add multiple MediaPlayerStressTest so that each instance will
- // test different video clips.
- for(int i = 0; i < videos.length; i++) {
- suite.addTestSuite(MediaPlayerStressTest.class);
- }
- suite.addTestSuite(MediaRecorderStressTest.class);
- return suite;
- }
-
- @Override
- public ClassLoader getLoader() {
- return MediaStressTestRunner.class.getClassLoader();
- }
-}