Add local video tests.
Also, clean up playVideoTest - removes seemingly unnecessary signal handling
logic, and fixes check to onVideoSizeChangedCalled, as the size was being
changed before our call to wait(), leading us to wait until a 60 second
timeout was reached before proceeding with the test.
Change-Id: Ie4c42e8d66c13ac434b734f0a079620a1381c1b0
diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_mono_24kbps_11025hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_mono_24kbps_11025hz.3gp
new file mode 100644
index 0000000..f274033
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_mono_24kbps_11025hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_mono_24kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_mono_24kbps_22050hz.3gp
new file mode 100644
index 0000000..1352250
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_mono_24kbps_22050hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_128kbps_11025hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_128kbps_11025hz.3gp
new file mode 100644
index 0000000..d410946
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_128kbps_11025hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_128kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_128kbps_22050hz.3gp
new file mode 100644
index 0000000..b62a388
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_128kbps_22050hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_24kbps_11025hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_24kbps_11025hz.3gp
new file mode 100644
index 0000000..c51d6ed
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_24kbps_11025hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_24kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_24kbps_22050hz.3gp
new file mode 100644
index 0000000..321d761
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_24kbps_22050hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_mono_24kbps_11025hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_mono_24kbps_11025hz.3gp
new file mode 100644
index 0000000..ac17582
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_mono_24kbps_11025hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_mono_24kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_mono_24kbps_22050hz.3gp
new file mode 100644
index 0000000..c212fab
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_mono_24kbps_22050hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_128kbps_11025hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_128kbps_11025hz.3gp
new file mode 100644
index 0000000..085f487
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_128kbps_11025hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_24kbps_11025hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_24kbps_11025hz.3gp
new file mode 100644
index 0000000..4931cc9
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_24kbps_11025hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_24kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_24kbps_22050hz.3gp
new file mode 100644
index 0000000..9d89e57
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_24kbps_22050hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_mono_24kbps_11025hz.3gp b/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_mono_24kbps_11025hz.3gp
new file mode 100644
index 0000000..56dcf59
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_mono_24kbps_11025hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_mono_24kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_mono_24kbps_22050hz.3gp
new file mode 100644
index 0000000..8565f63
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_mono_24kbps_22050hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_128kbps_11025hz.3gp b/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_128kbps_11025hz.3gp
new file mode 100644
index 0000000..7485c4f
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_128kbps_11025hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_128kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_128kbps_22050hz.3gp
new file mode 100644
index 0000000..48e9509
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_128kbps_22050hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_24kbps_11025hz.3gp b/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_24kbps_11025hz.3gp
new file mode 100644
index 0000000..1d3ec3b
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_24kbps_11025hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_24kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_24kbps_22050hz.3gp
new file mode 100644
index 0000000..4df6ff6
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_24kbps_22050hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_mono_24kbps_11025hz.3gp b/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_mono_24kbps_11025hz.3gp
new file mode 100644
index 0000000..68e17e9
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_mono_24kbps_11025hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_mono_24kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_mono_24kbps_22050hz.3gp
new file mode 100644
index 0000000..aec9de3
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_mono_24kbps_22050hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_128kbps_11025hz.3gp b/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_128kbps_11025hz.3gp
new file mode 100644
index 0000000..b6862de
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_128kbps_11025hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_128kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_128kbps_22050hz.3gp
new file mode 100644
index 0000000..600dbc0
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_128kbps_22050hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_24kbps_11025hz.3gp b/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_24kbps_11025hz.3gp
new file mode 100644
index 0000000..f341f3d
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_24kbps_11025hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_24kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_24kbps_22050hz.3gp
new file mode 100644
index 0000000..9fa8e48
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_24kbps_22050hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4
new file mode 100644
index 0000000..6388db4
--- /dev/null
+++ b/tests/res/raw/video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/res/raw/video_480x360_mp4_h264_1000kbps_30fps_aac_stereo_128kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_1000kbps_30fps_aac_stereo_128kbps_44100hz.mp4
new file mode 100644
index 0000000..3d9f388
--- /dev/null
+++ b/tests/res/raw/video_480x360_mp4_h264_1000kbps_30fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/res/raw/video_480x360_mp4_h264_1350kbps_25fps_aac_stereo_128kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_1350kbps_25fps_aac_stereo_128kbps_44100hz.mp4
new file mode 100644
index 0000000..ec70546
--- /dev/null
+++ b/tests/res/raw/video_480x360_mp4_h264_1350kbps_25fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_128kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_128kbps_44100hz.mp4
new file mode 100644
index 0000000..0ee179f
--- /dev/null
+++ b/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_192kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_192kbps_44100hz.mp4
new file mode 100644
index 0000000..f0f9c84
--- /dev/null
+++ b/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_192kbps_44100hz.mp4
Binary files differ
diff --git a/tests/res/raw/video_480x360_mp4_h264_500kbps_25fps_aac_stereo_128kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_500kbps_25fps_aac_stereo_128kbps_44100hz.mp4
new file mode 100644
index 0000000..c3c9abc
--- /dev/null
+++ b/tests/res/raw/video_480x360_mp4_h264_500kbps_25fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/res/raw/video_480x360_mp4_h264_500kbps_30fps_aac_stereo_128kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_500kbps_30fps_aac_stereo_128kbps_44100hz.mp4
new file mode 100644
index 0000000..09a1269
--- /dev/null
+++ b/tests/res/raw/video_480x360_mp4_h264_500kbps_30fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayerTest.java b/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
index f688fea..dd5edd7 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
@@ -29,6 +29,10 @@
/**
* Tests for the MediaPlayer API and local video/audio playback.
+ *
+ * The files in res/raw used by testLocalVideo* are (c) copyright 2008,
+ * Blender Foundation / www.bigbuckbunny.org, and are licensed under the Creative Commons
+ * Attribution 3.0 License at http://creativecommons.org/licenses/by/3.0/us/.
*/
public class MediaPlayerTest extends MediaPlayerTestBase {
public void testPlayNullSource() throws Exception {
@@ -98,6 +102,192 @@
playVideoTest(R.raw.testvideo, 352, 288);
}
+ public void testLocalVideo_MP4_H264_480x360_500kbps_25fps_AAC_Stereo_128kbps_44110Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_480x360_mp4_h264_500kbps_25fps_aac_stereo_128kbps_44100hz, 480, 360);
+ }
+
+ public void testLocalVideo_MP4_H264_480x360_500kbps_30fps_AAC_Stereo_128kbps_44110Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_480x360_mp4_h264_500kbps_30fps_aac_stereo_128kbps_44100hz, 480, 360);
+ }
+
+ public void testLocalVideo_MP4_H264_480x360_1000kbps_25fps_AAC_Stereo_128kbps_44110Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz, 480, 360);
+ }
+
+ public void testLocalVideo_MP4_H264_480x360_1000kbps_30fps_AAC_Stereo_128kbps_44110Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_480x360_mp4_h264_1000kbps_30fps_aac_stereo_128kbps_44100hz, 480, 360);
+ }
+
+ public void testLocalVideo_MP4_H264_480x360_1350kbps_25fps_AAC_Stereo_128kbps_44110Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_480x360_mp4_h264_1350kbps_25fps_aac_stereo_128kbps_44100hz, 480, 360);
+ }
+
+ public void testLocalVideo_MP4_H264_480x360_1350kbps_30fps_AAC_Stereo_128kbps_44110Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_128kbps_44100hz, 480, 360);
+ }
+
+ public void testLocalVideo_MP4_H264_480x360_1350kbps_30fps_AAC_Stereo_192kbps_44110Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_192kbps_44100hz, 480, 360);
+ }
+
+ public void testLocalVideo_3gp_H263_176x144_56kbps_12fps_AAC_Mono_24kbps_11025Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_176x144_3gp_h263_56kbps_12fps_aac_mono_24kbps_11025hz, 176, 144);
+ }
+
+ public void testLocalVideo_3gp_H263_176x144_56kbps_12fps_AAC_Mono_24kbps_22050Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_176x144_3gp_h263_56kbps_12fps_aac_mono_24kbps_22050hz, 176, 144);
+ }
+
+ public void testLocalVideo_3gp_H263_176x144_56kbps_12fps_AAC_Stereo_24kbps_11025Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_176x144_3gp_h263_56kbps_12fps_aac_stereo_24kbps_11025hz, 176, 144);
+ }
+
+ public void testLocalVideo_3gp_H263_176x144_56kbps_12fps_AAC_Stereo_24kbps_22050Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_176x144_3gp_h263_56kbps_12fps_aac_stereo_24kbps_11025hz, 176, 144);
+ }
+
+ public void testLocalVideo_3gp_H263_176x144_56kbps_12fps_AAC_Stereo_128kbps_11025Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_176x144_3gp_h263_56kbps_12fps_aac_stereo_128kbps_11025hz, 176, 144);
+ }
+
+ public void testLocalVideo_3gp_H263_176x144_56kbps_12fps_AAC_Stereo_128kbps_22050Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_176x144_3gp_h263_56kbps_12fps_aac_stereo_128kbps_11025hz, 176, 144);
+ }
+
+ public void testLocalVideo_3gp_H263_176x144_56kbps_25fps_AAC_Mono_24kbps_11025Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_176x144_3gp_h263_56kbps_25fps_aac_mono_24kbps_11025hz, 176, 144);
+ }
+
+ public void testLocalVideo_3gp_H263_176x144_56kbps_25fps_AAC_Mono_24kbps_22050Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_176x144_3gp_h263_56kbps_25fps_aac_mono_24kbps_22050hz, 176, 144);
+ }
+
+ public void testLocalVideo_3gp_H263_176x144_56kbps_25fps_AAC_Stereo_24kbps_11025Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_176x144_3gp_h263_56kbps_25fps_aac_stereo_24kbps_11025hz, 176, 144);
+ }
+
+ public void testLocalVideo_3gp_H263_176x144_56kbps_25fps_AAC_Stereo_24kbps_22050Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_176x144_3gp_h263_56kbps_25fps_aac_stereo_24kbps_11025hz, 176, 144);
+ }
+
+ public void testLocalVideo_3gp_H263_176x144_56kbps_25fps_AAC_Stereo_128kbps_11025Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_176x144_3gp_h263_56kbps_25fps_aac_stereo_128kbps_11025hz, 176, 144);
+ }
+
+ public void testLocalVideo_3gp_H263_176x144_56kbps_25fps_AAC_Stereo_128kbps_22050Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_176x144_3gp_h263_56kbps_25fps_aac_stereo_128kbps_11025hz, 176, 144);
+ }
+
+ public void testLocalVideo_3gp_H263_176x144_300kbps_12fps_AAC_Mono_24kbps_11025Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_176x144_3gp_h263_300kbps_12fps_aac_mono_24kbps_11025hz, 176, 144);
+ }
+
+ public void testLocalVideo_3gp_H263_176x144_300kbps_12fps_AAC_Mono_24kbps_22050Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_176x144_3gp_h263_300kbps_12fps_aac_mono_24kbps_22050hz, 176, 144);
+ }
+
+ public void testLocalVideo_3gp_H263_176x144_300kbps_12fps_AAC_Stereo_24kbps_11025Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_176x144_3gp_h263_300kbps_12fps_aac_stereo_24kbps_11025hz, 176, 144);
+ }
+
+ public void testLocalVideo_3gp_H263_176x144_300kbps_12fps_AAC_Stereo_24kbps_22050Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_176x144_3gp_h263_300kbps_12fps_aac_stereo_24kbps_11025hz, 176, 144);
+ }
+
+ public void testLocalVideo_3gp_H263_176x144_300kbps_12fps_AAC_Stereo_128kbps_11025Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_176x144_3gp_h263_300kbps_12fps_aac_stereo_128kbps_11025hz, 176, 144);
+ }
+
+ public void testLocalVideo_3gp_H263_176x144_300kbps_12fps_AAC_Stereo_128kbps_22050Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_176x144_3gp_h263_300kbps_12fps_aac_stereo_128kbps_11025hz, 176, 144);
+ }
+
+ public void testLocalVideo_3gp_H263_176x144_300kbps_25fps_AAC_Mono_24kbps_11025Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_176x144_3gp_h263_300kbps_25fps_aac_mono_24kbps_11025hz, 176, 144);
+ }
+
+ public void testLocalVideo_3gp_H263_176x144_300kbps_25fps_AAC_Mono_24kbps_22050Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_176x144_3gp_h263_300kbps_25fps_aac_mono_24kbps_22050hz, 176, 144);
+ }
+
+ public void testLocalVideo_3gp_H263_176x144_300kbps_25fps_AAC_Stereo_24kbps_11025Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_176x144_3gp_h263_300kbps_25fps_aac_stereo_24kbps_11025hz, 176, 144);
+ }
+
+ public void testLocalVideo_3gp_H263_176x144_300kbps_25fps_AAC_Stereo_24kbps_22050Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_176x144_3gp_h263_300kbps_25fps_aac_stereo_24kbps_11025hz, 176, 144);
+ }
+
+ public void testLocalVideo_3gp_H263_176x144_300kbps_25fps_AAC_Stereo_128kbps_11025Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_176x144_3gp_h263_300kbps_25fps_aac_stereo_128kbps_11025hz, 176, 144);
+ }
+
+ public void testLocalVideo_3gp_H263_176x144_300kbps_25fps_AAC_Stereo_128kbps_22050Hz()
+ throws Exception {
+ playVideoTest(
+ R.raw.video_176x144_3gp_h263_300kbps_25fps_aac_stereo_128kbps_11025hz, 176, 144);
+ }
+
public void testCallback() throws Throwable {
final int mp4Duration = 8484;
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayerTestBase.java b/tests/tests/media/src/android/media/cts/MediaPlayerTestBase.java
index b79764e..660b539 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayerTestBase.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayerTestBase.java
@@ -19,16 +19,12 @@
import android.content.res.AssetFileDescriptor;
import android.content.res.Resources;
import android.media.MediaPlayer;
-import android.os.Looper;
import android.test.ActivityInstrumentationTestCase2;
-import android.util.Log;
/**
* Base class for tests which use MediaPlayer to play audio or video.
*/
public class MediaPlayerTestBase extends ActivityInstrumentationTestCase2<MediaStubActivity> {
- private static String TAG = "MediaPlayerTestBase";
-
protected static final int SLEEP_TIME = 1000;
protected static final int LONG_SLEEP_TIME = 6000;
@@ -66,12 +62,6 @@
protected Context mContext;
protected Resources mResources;
- // Video Playback
- private static Object sVideoSizeChanged;
- private static Object sLock;
- private static Looper sLooper = null;
- private static final int WAIT_FOR_COMMAND_TO_COMPLETE = 60000; //1 min max.
-
/*
* InstrumentationTestRunner.onStart() calls Looper.prepare(), which creates a looper
* for the current thread. However, since we don't actually call loop() in the test,
@@ -100,46 +90,6 @@
super.tearDown();
}
- private static MediaPlayer.OnVideoSizeChangedListener mOnVideoSizeChangedListener =
- new MediaPlayer.OnVideoSizeChangedListener() {
- @Override
- public void onVideoSizeChanged(MediaPlayer mp, int width, int height) {
- synchronized (sVideoSizeChanged) {
- Log.v(TAG, "sizechanged notification received ...");
- sVideoSizeChanged.notify();
- }
- }
- };
-
- /*
- * Initializes the message looper so that the mediaPlayer object can
- * receive the callback messages.
- */
- private static void initializeMessageLooper() {
- new Thread() {
- @Override
- public void run() {
- // Set up a looper to be used by camera.
- Looper.prepare();
- // Save the looper so that we can terminate this thread
- // after we are done with it.
- sLooper = Looper.myLooper();
- synchronized (sLock) {
- sLock.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() {
- sLooper.quit();
- }
-
protected void loadResource(int resid) throws Exception {
AssetFileDescriptor afd = mResources.openRawResourceFd(resid);
try {
@@ -150,15 +100,21 @@
}
}
- protected void playVideoTest(int resid, int width, int height) throws Exception {
+ protected void playVideoTest(int resid, final int width, final int height) throws Exception {
final float leftVolume = 0.5f;
final float rightVolume = 0.5f;
- sLock = new Object();
- sVideoSizeChanged = new Object();
loadResource(resid);
mMediaPlayer.setDisplay(getActivity().getSurfaceHolder());
mMediaPlayer.setScreenOnWhilePlaying(true);
+ mMediaPlayer.setOnVideoSizeChangedListener(new MediaPlayer.OnVideoSizeChangedListener() {
+ @Override
+ public void onVideoSizeChanged(MediaPlayer mp, int w, int h) {
+ mOnVideoSizeChangedCalled.signal();
+ assertEquals(width, w);
+ assertEquals(height, h);
+ }
+ });
mMediaPlayer.setOnErrorListener(new MediaPlayer.OnErrorListener() {
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
@@ -167,35 +123,7 @@
}
});
mMediaPlayer.prepare();
-
- int videoWidth = 0;
- int videoHeight = 0;
- synchronized (sLock) {
- initializeMessageLooper();
- try {
- sLock.wait(WAIT_FOR_COMMAND_TO_COMPLETE);
- } catch(Exception e) {
- Log.v(TAG, "looper was interrupted.");
- return;
- }
- }
- try {
- mMediaPlayer.setOnVideoSizeChangedListener(mOnVideoSizeChangedListener);
- synchronized (sVideoSizeChanged) {
- try {
- sVideoSizeChanged.wait(WAIT_FOR_COMMAND_TO_COMPLETE);
- } catch (Exception e) {
- Log.v(TAG, "wait was interrupted");
- }
- }
- videoWidth = mMediaPlayer.getVideoWidth();
- videoHeight = mMediaPlayer.getVideoHeight();
- terminateMessageLooper();
- } catch (Exception e) {
- Log.e(TAG, e.getMessage());
- }
- assertEquals(width, videoWidth);
- assertEquals(height, videoHeight);
+ mOnVideoSizeChangedCalled.waitForSignal();
mMediaPlayer.start();
mMediaPlayer.setVolume(leftVolume, rightVolume);