Merge "Change the media player stress test to repor the total number of failure and the total number of info. Register the surface callback in the test application bug# 2909064"
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
|
||||
<application>
|
||||
<uses-library android:name="android.test.runner" />
|
||||
<activity android:label="@string/app_name"
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.graphics.Color;
|
||||
import android.media.MediaPlayer;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.PowerManager;
|
||||
import android.provider.Downloads;
|
||||
import android.util.Log;
|
||||
import android.util.Log;
|
||||
@@ -48,7 +49,7 @@ import java.io.FileDescriptor;
|
||||
import java.net.InetAddress;
|
||||
|
||||
|
||||
public class MediaFrameworkTest extends Activity {
|
||||
public class MediaFrameworkTest extends Activity implements SurfaceHolder.Callback {
|
||||
|
||||
//public static Surface video_sf;
|
||||
public static SurfaceView mSurfaceView;
|
||||
@@ -63,11 +64,13 @@ public class MediaFrameworkTest extends Activity {
|
||||
|
||||
public static Bitmap mDestBitmap;
|
||||
public static ImageView mOverlayView;
|
||||
|
||||
private SurfaceHolder mSurfaceHolder = null;
|
||||
private String TAG = "MediaFrameworkTest";
|
||||
private PowerManager.WakeLock mWakeLock = null;
|
||||
|
||||
public MediaFrameworkTest() {
|
||||
}
|
||||
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
@@ -76,7 +79,9 @@ public class MediaFrameworkTest extends Activity {
|
||||
mSurfaceView = (SurfaceView)findViewById(R.id.surface_view);
|
||||
mOverlayView = (ImageView)findViewById(R.id.overlay_layer);
|
||||
ViewGroup.LayoutParams lp = mSurfaceView.getLayoutParams();
|
||||
mSurfaceView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
|
||||
mSurfaceHolder = mSurfaceView.getHolder();
|
||||
mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
|
||||
mSurfaceHolder.addCallback(this);
|
||||
|
||||
//Get the midi fd
|
||||
midiafd = this.getResources().openRawResourceFd(R.raw.testmidi);
|
||||
@@ -86,8 +91,31 @@ public class MediaFrameworkTest extends Activity {
|
||||
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);
|
||||
|
||||
@@ -60,11 +60,11 @@ public class CodecTest {
|
||||
private static boolean onPrepareSuccess = false;
|
||||
public static boolean onCompleteSuccess = false;
|
||||
public static boolean mPlaybackError = false;
|
||||
public static boolean mIsMediaInfoUnknown = false;
|
||||
public static boolean mIsMediaInfoVideoTrackLagging = false;
|
||||
public static boolean mIsMediaInfoBadInterleaving = false;
|
||||
public static boolean mIsMediaInfoNotSeekable = false;
|
||||
public static boolean mIsMediaInfoMetdataUpdate = 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";
|
||||
@@ -765,19 +765,19 @@ public class CodecTest {
|
||||
public boolean onInfo(MediaPlayer mp, int what, int extra) {
|
||||
switch (what){
|
||||
case MediaPlayer.MEDIA_INFO_UNKNOWN:
|
||||
mIsMediaInfoUnknown = true;
|
||||
mMediaInfoUnknownCount++;
|
||||
break;
|
||||
case MediaPlayer.MEDIA_INFO_VIDEO_TRACK_LAGGING:
|
||||
mIsMediaInfoVideoTrackLagging = true;
|
||||
mMediaInfoVideoTrackLaggingCount++;
|
||||
break;
|
||||
case MediaPlayer.MEDIA_INFO_BAD_INTERLEAVING:
|
||||
mIsMediaInfoBadInterleaving = true;
|
||||
mMediaInfoBadInterleavingCount++;
|
||||
break;
|
||||
case MediaPlayer.MEDIA_INFO_NOT_SEEKABLE:
|
||||
mIsMediaInfoNotSeekable = true;
|
||||
mMediaInfoNotSeekableCount++;
|
||||
break;
|
||||
case MediaPlayer.MEDIA_INFO_METADATA_UPDATE:
|
||||
mIsMediaInfoMetdataUpdate = true;
|
||||
mMediaInfoMetdataUpdateCount++;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
@@ -791,11 +791,11 @@ public class CodecTest {
|
||||
int nextPosition = 0;
|
||||
int waittime = 0;
|
||||
onCompleteSuccess = false;
|
||||
mIsMediaInfoUnknown = false;
|
||||
mIsMediaInfoVideoTrackLagging = false;
|
||||
mIsMediaInfoBadInterleaving = false;
|
||||
mIsMediaInfoNotSeekable = false;
|
||||
mIsMediaInfoMetdataUpdate = false;
|
||||
mMediaInfoUnknownCount = 0;
|
||||
mMediaInfoVideoTrackLaggingCount = 0;
|
||||
mMediaInfoBadInterleavingCount = 0;
|
||||
mMediaInfoNotSeekableCount = 0;
|
||||
mMediaInfoMetdataUpdateCount = 0;
|
||||
mPlaybackError = false;
|
||||
String testResult;
|
||||
|
||||
|
||||
@@ -65,11 +65,11 @@ public class MediaPlayerStressTest extends InstrumentationTestCase {
|
||||
output.write("File Name: " + filename);
|
||||
output.write(" Complete: " + CodecTest.onCompleteSuccess);
|
||||
output.write(" Error: " + CodecTest.mPlaybackError);
|
||||
output.write(" Unknown Info: " + CodecTest.mIsMediaInfoUnknown);
|
||||
output.write(" Track Lagging: " + CodecTest.mIsMediaInfoVideoTrackLagging);
|
||||
output.write(" BadInterleaving: " + CodecTest.mIsMediaInfoBadInterleaving);
|
||||
output.write(" Not Seekable: " + CodecTest.mIsMediaInfoNotSeekable);
|
||||
output.write(" Info Meta data update: " + CodecTest.mIsMediaInfoMetdataUpdate);
|
||||
output.write(" Unknown Info: " + CodecTest.mMediaInfoUnknownCount);
|
||||
output.write(" Track Lagging: " + CodecTest.mMediaInfoVideoTrackLaggingCount);
|
||||
output.write(" BadInterleaving: " + CodecTest.mMediaInfoBadInterleavingCount);
|
||||
output.write(" Not Seekable: " + CodecTest.mMediaInfoNotSeekableCount);
|
||||
output.write(" Info Meta data update: " + CodecTest.mMediaInfoMetdataUpdateCount);
|
||||
output.write("\n");
|
||||
}
|
||||
|
||||
@@ -92,21 +92,11 @@ public class MediaPlayerStressTest extends InstrumentationTestCase {
|
||||
else if (CodecTest.mPlaybackError){
|
||||
mTotalPlaybackError++;
|
||||
}
|
||||
else if (CodecTest.mIsMediaInfoUnknown){
|
||||
mTotalInfoUnknown++;
|
||||
}
|
||||
else if (CodecTest.mIsMediaInfoVideoTrackLagging){
|
||||
mTotalVideoTrackLagging++;
|
||||
}
|
||||
else if (CodecTest.mIsMediaInfoBadInterleaving){
|
||||
mTotalBadInterleaving++;
|
||||
}
|
||||
else if (CodecTest.mIsMediaInfoNotSeekable){
|
||||
mTotalNotSeekable++;
|
||||
}
|
||||
else if (CodecTest.mIsMediaInfoMetdataUpdate){
|
||||
mTotalMetaDataUpdate++;
|
||||
}
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user