am 336efd31: Merge "Fix various Wear media CTS failures." into lmp-sprout-dev
* commit '336efd3166534cb44ad2be876ba7f8ea30db65c7':
Fix various Wear media CTS failures.
diff --git a/tests/tests/media/src/android/media/cts/ClearKeySystemTest.java b/tests/tests/media/src/android/media/cts/ClearKeySystemTest.java
index 673c1d7..ff05246 100644
--- a/tests/tests/media/src/android/media/cts/ClearKeySystemTest.java
+++ b/tests/tests/media/src/android/media/cts/ClearKeySystemTest.java
@@ -403,11 +403,6 @@
}
}
- private boolean hasAudioOutput() {
- return getInstrumentation().getTargetContext().getPackageManager()
- .hasSystemFeature(PackageManager.FEATURE_AUDIO_OUTPUT);
- }
-
/**
* Tests clear key system playback.
*/
diff --git a/tests/tests/media/src/android/media/cts/DecoderTest.java b/tests/tests/media/src/android/media/cts/DecoderTest.java
index 8917144..d71d38a 100644
--- a/tests/tests/media/src/android/media/cts/DecoderTest.java
+++ b/tests/tests/media/src/android/media/cts/DecoderTest.java
@@ -79,42 +79,6 @@
masterFd.close();
}
- private boolean hasCodecForMimeType(String mimeType) {
- MediaCodecList list = new MediaCodecList(MediaCodecList.ALL_CODECS);
- for (MediaCodecInfo info : list.getCodecInfos()) {
- for (String type : info.getSupportedTypes()) {
- if (type.equalsIgnoreCase(mimeType)) {
- return true;
- }
- }
- }
- return false;
- }
-
- private boolean hasH264() {
- return hasCodecForMimeType("video/avc");
- }
-
- private boolean hasHEVC() {
- return hasCodecForMimeType("video/hevc");
- }
-
- private boolean hasH263() {
- return hasCodecForMimeType("video/3gpp");
- }
-
- private boolean hasMpeg4() {
- return hasCodecForMimeType("video/mp4v-es");
- }
-
- private boolean hasVP8() {
- return hasCodecForMimeType("video/x-vnd.on2.vp8");
- }
-
- private boolean hasVP9() {
- return hasCodecForMimeType("video/x-vnd.on2.vp9");
- }
-
// TODO: add similar tests for other audio and video formats
public void testBug11696552() throws Exception {
MediaCodec mMediaCodec = MediaCodec.createDecoderByType("audio/mp4a-latm");
@@ -212,8 +176,8 @@
MediaFormat format = ex.getTrackFormat(0);
String mime = format.getString(MediaFormat.KEY_MIME);
assertTrue("not a video track. Wrong test file?", mime.startsWith("video/"));
- if (!hasCodecForMimeType(mime)) {
- Log.i(TAG, "Could not find a codec for mimeType: " + mime);
+ if (!hasCodecForMimeType(mime, false)) {
+ Log.i(TAG, "SKIPPING testBFrames(): Could not find a codec for mimeType: " + mime);
return;
}
MediaCodec dec = MediaCodec.createDecoderByType(mime);
@@ -881,7 +845,8 @@
}
public void testCodecBasicH264() throws Exception {
- if (!hasH264()) {
+ if (!hasH264(false)) {
+ Log.i(TAG, "SKIPPING testCodecBasicH264(): No codec found.");
return;
}
Surface s = getActivity().getSurfaceHolder().getSurface();
@@ -897,7 +862,8 @@
}
public void testCodecBasicHEVC() throws Exception {
- if (!hasHEVC()) {
+ if (!hasHEVC(false)) {
+ Log.i(TAG, "SKIPPING testCodecBasicHEVC(): No codec found.");
return;
}
Surface s = getActivity().getSurfaceHolder().getSurface();
@@ -913,7 +879,8 @@
}
public void testCodecBasicH263() throws Exception {
- if (!hasH263()) {
+ if (!hasH263(false)) {
+ Log.i(TAG, "SKIPPING testCodecBasicH263(): No codec found.");
return;
}
Surface s = getActivity().getSurfaceHolder().getSurface();
@@ -929,7 +896,8 @@
}
public void testCodecBasicMpeg4() throws Exception {
- if (!hasMpeg4()) {
+ if (!hasMpeg4(false)) {
+ Log.i(TAG, "SKIPPING testCodecBasicMpeg4(): No codec found.");
return;
}
Surface s = getActivity().getSurfaceHolder().getSurface();
@@ -945,7 +913,8 @@
}
public void testCodecBasicVP8() throws Exception {
- if (!hasVP8()) {
+ if (!hasVP8(false)) {
+ Log.i(TAG, "SKIPPING testCodecBasicVP8(): No codec found.");
return;
}
Surface s = getActivity().getSurfaceHolder().getSurface();
@@ -961,7 +930,8 @@
}
public void testCodecBasicVP9() throws Exception {
- if (!hasVP9()) {
+ if (!hasVP9(false)) {
+ Log.i(TAG, "SKIPPING testCodecBasicVP9(): No codec found.");
return;
}
Surface s = getActivity().getSurfaceHolder().getSurface();
@@ -977,7 +947,8 @@
}
public void testCodecEarlyEOSH263() throws Exception {
- if (!hasH263()) {
+ if (!hasH263(false)) {
+ Log.i(TAG, "SKIPPING testCodecEarlyEOSH263(): No codec found.");
return;
}
Surface s = getActivity().getSurfaceHolder().getSurface();
@@ -988,7 +959,8 @@
}
public void testCodecEarlyEOSH264() throws Exception {
- if (!hasH264()) {
+ if (!hasH264(false)) {
+ Log.i(TAG, "SKIPPING testCodecEarlyEOSH264(): No codec found.");
return;
}
Surface s = getActivity().getSurfaceHolder().getSurface();
@@ -999,7 +971,8 @@
}
public void testCodecEarlyEOSHEVC() throws Exception {
- if (!hasHEVC()) {
+ if (!hasHEVC(false)) {
+ Log.i(TAG, "SKIPPING testCodecEarlyEOSHEVC(): No codec found.");
return;
}
Surface s = getActivity().getSurfaceHolder().getSurface();
@@ -1010,7 +983,8 @@
}
public void testCodecEarlyEOSMpeg4() throws Exception {
- if (!hasMpeg4()) {
+ if (!hasMpeg4(false)) {
+ Log.i(TAG, "SKIPPING testCodecEarlyEOSMpeg4(): No codec found.");
return;
}
Surface s = getActivity().getSurfaceHolder().getSurface();
@@ -1021,7 +995,8 @@
}
public void testCodecEarlyEOSVP8() throws Exception {
- if (!hasVP8()) {
+ if (!hasVP8(false)) {
+ Log.i(TAG, "SKIPPING testCodecEarlyEOSVP8(): No codec found.");
return;
}
Surface s = getActivity().getSurfaceHolder().getSurface();
@@ -1032,7 +1007,8 @@
}
public void testCodecEarlyEOSVP9() throws Exception {
- if (!hasVP9()) {
+ if (!hasVP9(false)) {
+ Log.i(TAG, "SKIPPING testCodecEarlyEOSVP9(): No codec found.");
return;
}
Surface s = getActivity().getSurfaceHolder().getSurface();
@@ -1043,7 +1019,8 @@
}
public void testCodecResetsH264WithoutSurface() throws Exception {
- if (!hasH264()) {
+ if (!hasH264(false)) {
+ Log.i(TAG, "SKIPPING testCodecResetsH264WithoutSurface(): No codec found.");
return;
}
testCodecResets(
@@ -1051,7 +1028,8 @@
}
public void testCodecResetsH264WithSurface() throws Exception {
- if (!hasH264()) {
+ if (!hasH264(false)) {
+ Log.i(TAG, "SKIPPING testCodecResetsH264WithSurface(): No codec found.");
return;
}
Surface s = getActivity().getSurfaceHolder().getSurface();
@@ -1060,7 +1038,8 @@
}
public void testCodecResetsHEVCWithoutSurface() throws Exception {
- if (!hasHEVC()) {
+ if (!hasHEVC(false)) {
+ Log.i(TAG, "SKIPPING testCodecResetsHEVCWithoutSurface(): No codec found.");
return;
}
testCodecResets(
@@ -1068,7 +1047,8 @@
}
public void testCodecResetsHEVCWithSurface() throws Exception {
- if (!hasHEVC()) {
+ if (!hasHEVC(false)) {
+ Log.i(TAG, "SKIPPING testCodecResetsHEVCWithSurface(): No codec found.");
return;
}
Surface s = getActivity().getSurfaceHolder().getSurface();
@@ -1077,7 +1057,8 @@
}
public void testCodecResetsH263WithoutSurface() throws Exception {
- if (!hasH263()) {
+ if (!hasH263(false)) {
+ Log.i(TAG, "SKIPPING testCodecResetsH263WithoutSurface(): No codec found.");
return;
}
testCodecResets(
@@ -1085,7 +1066,8 @@
}
public void testCodecResetsH263WithSurface() throws Exception {
- if (!hasH263()) {
+ if (!hasH263(false)) {
+ Log.i(TAG, "SKIPPING testCodecResetsH263WithSurface(): No codec found.");
return;
}
Surface s = getActivity().getSurfaceHolder().getSurface();
@@ -1094,7 +1076,8 @@
}
public void testCodecResetsMpeg4WithoutSurface() throws Exception {
- if (!hasMpeg4()) {
+ if (!hasMpeg4(false)) {
+ Log.i(TAG, "SKIPPING testCodecResetsMpeg4WithoutSurface(): No codec found.");
return;
}
testCodecResets(
@@ -1102,7 +1085,8 @@
}
public void testCodecResetsMpeg4WithSurface() throws Exception {
- if (!hasMpeg4()) {
+ if (!hasMpeg4(false)) {
+ Log.i(TAG, "SKIPPING testCodecResetsMpeg4WithSurface(): No codec found.");
return;
}
Surface s = getActivity().getSurfaceHolder().getSurface();
@@ -1111,7 +1095,8 @@
}
public void testCodecResetsVP8WithoutSurface() throws Exception {
- if (!hasVP8()) {
+ if (!hasVP8(false)) {
+ Log.i(TAG, "SKIPPING testCodecResetsVP8WithoutSurface(): No codec found.");
return;
}
testCodecResets(
@@ -1119,7 +1104,8 @@
}
public void testCodecResetsVP8WithSurface() throws Exception {
- if (!hasVP8()) {
+ if (!hasVP8(false)) {
+ Log.i(TAG, "SKIPPING testCodecResetsVP8WithSurface(): No codec found.");
return;
}
Surface s = getActivity().getSurfaceHolder().getSurface();
@@ -1128,7 +1114,8 @@
}
public void testCodecResetsVP9WithoutSurface() throws Exception {
- if (!hasVP9()) {
+ if (!hasVP9(false)) {
+ Log.i(TAG, "SKIPPING testCodecResetsVP9WithoutSurface(): No codec found.");
return;
}
testCodecResets(
@@ -1136,7 +1123,8 @@
}
public void testCodecResetsVP9WithSurface() throws Exception {
- if (!hasVP9()) {
+ if (!hasVP9(false)) {
+ Log.i(TAG, "SKIPPING testCodecResetsVP9WithSurface(): No codec found.");
return;
}
Surface s = getActivity().getSurfaceHolder().getSurface();
@@ -1245,6 +1233,13 @@
extractor.setDataSource(testFd.getFileDescriptor(), testFd.getStartOffset(),
testFd.getLength());
extractor.selectTrack(0); // consider variable looping on track
+ MediaFormat format = extractor.getTrackFormat(0);
+ String mimeType = format.getString(MediaFormat.KEY_MIME);
+ if (!hasCodecForMimeType(mimeType, false)) {
+ Log.i(TAG, "SKIPPING testEOSBehavior() for resid=" + movie + " No codec found for "
+ + "mimeType = " + mimeType);
+ return;
+ }
List<Long> outputChecksums = new ArrayList<Long>();
List<Long> outputTimestamps = new ArrayList<Long>();
Arrays.sort(stopAtSample);
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayerTest.java b/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
index 799fd59..39036a6 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
@@ -21,6 +21,11 @@
import android.content.pm.PackageManager;
import android.content.res.AssetFileDescriptor;
import android.media.AudioManager;
+import android.media.MediaCodec;
+import android.media.MediaCodecInfo;
+import android.media.MediaCodecList;
+import android.media.MediaExtractor;
+import android.media.MediaFormat;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnErrorListener;
import android.media.MediaRecorder;
@@ -375,6 +380,11 @@
}
public void testPlayAudioTwice() throws Exception {
+ if (!hasAudioOutput()) {
+ Log.i(LOG_TAG, "SKIPPING testPlayAudioTwice(). No audio output.");
+ return;
+ }
+
final int resid = R.raw.camera_click;
MediaPlayer mp = MediaPlayer.create(mContext, resid);
@@ -621,6 +631,10 @@
}
private void testGapless(int resid1, int resid2) throws Exception {
+ if (!hasAudioOutput()) {
+ Log.i(LOG_TAG, "SKIPPING testPlayAudioTwice(). No audio output.");
+ return;
+ }
MediaPlayer mp1 = new MediaPlayer();
mp1.setAudioStreamType(AudioManager.STREAM_MUSIC);
@@ -731,7 +745,12 @@
}
});
- loadResource(R.raw.testvideo);
+ try {
+ loadResource(R.raw.testvideo);
+ } catch (UnsupportedCodecException e) {
+ Log.i(LOG_TAG, "SKIPPING testVideoSurfaceResetting(). Could not find codec.");
+ return;
+ }
playLoadedVideo(352, 288, -1);
Thread.sleep(SLEEP_TIME);
@@ -1082,7 +1101,12 @@
}
public void testDeselectTrack() throws Throwable {
- loadResource(R.raw.testvideo_with_2_subtitles);
+ try {
+ loadResource(R.raw.testvideo_with_2_subtitles);
+ } catch (UnsupportedCodecException e) {
+ Log.i(LOG_TAG, "SKIPPING testDeselectTrack(). Could not find codec.");
+ return;
+ }
runTestOnUiThread(new Runnable() {
public void run() {
try {
@@ -1153,7 +1177,12 @@
}
public void testChangeSubtitleTrack() throws Throwable {
- loadResource(R.raw.testvideo_with_2_subtitles);
+ try {
+ loadResource(R.raw.testvideo_with_2_subtitles);
+ } catch (UnsupportedCodecException e) {
+ Log.i(LOG_TAG, "SKIPPING testChangeSubtitleTrack(). Could not find codec.");
+ return;
+ }
mMediaPlayer.setDisplay(getActivity().getSurfaceHolder());
mMediaPlayer.setScreenOnWhilePlaying(true);
@@ -1241,7 +1270,12 @@
}
public void testGetTrackInfo() throws Throwable {
- loadResource(R.raw.testvideo_with_2_subtitles);
+ try {
+ loadResource(R.raw.testvideo_with_2_subtitles);
+ } catch (UnsupportedCodecException e) {
+ Log.i(LOG_TAG, "SKIPPING testGetTrackInfo(). Could not find codec.");
+ return;
+ }
runTestOnUiThread(new Runnable() {
public void run() {
try {
@@ -1316,7 +1350,13 @@
public void testCallback() throws Throwable {
final int mp4Duration = 8484;
- loadResource(R.raw.testvideo);
+ try {
+ loadResource(R.raw.testvideo);
+ } catch (UnsupportedCodecException e) {
+ Log.i(LOG_TAG, "SKIPPING testCallback(). Could not find codec.");
+ return;
+ }
+
mMediaPlayer.setDisplay(getActivity().getSurfaceHolder());
mMediaPlayer.setScreenOnWhilePlaying(true);
@@ -1388,6 +1428,11 @@
public void testRecordAndPlay() throws Exception {
if (!hasMicrophone()) {
+ Log.i(LOG_TAG, "SKIPPING testRecordAndPlay(). No microphone.");
+ return;
+ }
+ if (!hasH263(false)) {
+ Log.i(LOG_TAG, "SKIPPING testRecordAndPlay(). Cound not find codec.");
return;
}
File outputFile = new File(Environment.getExternalStorageDirectory(),
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayerTestBase.java b/tests/tests/media/src/android/media/cts/MediaPlayerTestBase.java
index 61d8792..9225203 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayerTestBase.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayerTestBase.java
@@ -16,8 +16,15 @@
package android.media.cts;
import android.content.Context;
+
+import android.content.pm.PackageManager;
import android.content.res.AssetFileDescriptor;
import android.content.res.Resources;
+import android.media.MediaCodec;
+import android.media.MediaCodecInfo;
+import android.media.MediaCodecList;
+import android.media.MediaExtractor;
+import android.media.MediaFormat;
import android.media.MediaPlayer;
import android.test.ActivityInstrumentationTestCase2;
@@ -143,6 +150,10 @@
}
protected void loadResource(int resid) throws Exception {
+ if (!supportsPlayback(resid)) {
+ throw new UnsupportedCodecException();
+ }
+
AssetFileDescriptor afd = mResources.openRawResourceFd(resid);
try {
mMediaPlayer.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(),
@@ -197,6 +208,12 @@
}
protected void playVideoTest(int resid, int width, int height) throws Exception {
+ if (!supportsPlayback(resid)) {
+ LOG.info("SKIPPING playVideoTest() for resid=" + resid
+ + " Could not find a codec for playback.");
+ return;
+ }
+
loadResource(resid);
playLoadedVideo(width, height, 0);
}
@@ -278,4 +295,69 @@
}
private static class PrepareFailedException extends Exception {}
+ public static class UnsupportedCodecException extends Exception {}
+
+ public boolean supportsPlayback(int resid) throws IOException {
+ // First determine if the device supports playback of the requested resource.
+ AssetFileDescriptor fd = mResources.openRawResourceFd(resid);
+ MediaExtractor ex = new MediaExtractor();
+ ex.setDataSource(fd.getFileDescriptor(), fd.getStartOffset(), fd.getLength());
+ MediaFormat format = ex.getTrackFormat(0);
+ String mimeType = format.getString(MediaFormat.KEY_MIME);
+ return hasCodecForMimeType(mimeType, false);
+ }
+
+ public boolean supportsPlayback(String path) throws IOException {
+ MediaExtractor ex = new MediaExtractor();
+ ex.setDataSource(path);
+ MediaFormat format = ex.getTrackFormat(0);
+ String mimeType = format.getString(MediaFormat.KEY_MIME);
+ return hasCodecForMimeType(mimeType, false);
+ }
+
+ public static boolean hasCodecForMimeType(String mimeType, boolean encoder) {
+ MediaCodecList list = new MediaCodecList(MediaCodecList.ALL_CODECS);
+ for (MediaCodecInfo info : list.getCodecInfos()) {
+ if (encoder != info.isEncoder()) {
+ continue;
+ }
+
+ for (String type : info.getSupportedTypes()) {
+ if (type.equalsIgnoreCase(mimeType)) {
+ LOG.info("Found codec for mimeType=" + mimeType + " codec=" + info.getName());
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public static boolean hasH264(boolean encoder) {
+ return hasCodecForMimeType("video/avc", encoder);
+ }
+
+ public static boolean hasHEVC(boolean encoder) {
+ return hasCodecForMimeType("video/hevc", encoder);
+ }
+
+ public static boolean hasH263(boolean encoder) {
+ return hasCodecForMimeType("video/3gpp", encoder);
+ }
+
+ public static boolean hasMpeg4(boolean encoder) {
+ return hasCodecForMimeType("video/mp4v-es", encoder);
+ }
+
+ public static boolean hasVP8(boolean encoder) {
+ return hasCodecForMimeType("video/x-vnd.on2.vp8", encoder);
+ }
+
+ public static boolean hasVP9(boolean encoder) {
+ return hasCodecForMimeType("video/x-vnd.on2.vp9", encoder);
+ }
+
+ public boolean hasAudioOutput() {
+ return getInstrumentation().getTargetContext().getPackageManager()
+ .hasSystemFeature(PackageManager.FEATURE_AUDIO_OUTPUT);
+ }
}
diff --git a/tests/tests/media/src/android/media/cts/NativeDecoderTest.java b/tests/tests/media/src/android/media/cts/NativeDecoderTest.java
index fc27dfa..76620c1 100644
--- a/tests/tests/media/src/android/media/cts/NativeDecoderTest.java
+++ b/tests/tests/media/src/android/media/cts/NativeDecoderTest.java
@@ -195,10 +195,14 @@
testDecoder(R.raw.video_1280x720_webm_vp9_309kbps_25fps_vorbis_stereo_128kbps_44100hz);
testDecoder(R.raw.video_176x144_3gp_h263_300kbps_12fps_aac_mono_24kbps_11025hz);
testDecoder(R.raw.video_480x360_mp4_mpeg4_860kbps_25fps_aac_stereo_128kbps_44100hz);
-
}
private void testDecoder(int res) throws Exception {
+ if (!supportsPlayback(res)) {
+ Log.i(TAG, "SKIPPING testDecoder() resid=" + res + " Unsupported decorder.");
+ return;
+ }
+
AssetFileDescriptor fd = mResources.openRawResourceFd(res);
int[] jdata = getDecodedData(
@@ -382,6 +386,11 @@
}
private void testVideoPlayback(int res) throws Exception {
+ if (!supportsPlayback(res)) {
+ Log.i(TAG, "SKIPPING testVideoPlayback() resid=" + res + " Unsupported decorder.");
+ return;
+ }
+
AssetFileDescriptor fd = mResources.openRawResourceFd(res);
boolean ret = testPlaybackNative(mActivity.getSurfaceHolder().getSurface(),
diff --git a/tests/tests/media/src/android/media/cts/StreamingMediaPlayerTest.java b/tests/tests/media/src/android/media/cts/StreamingMediaPlayerTest.java
index 419f3e0..0c2bcf0 100644
--- a/tests/tests/media/src/android/media/cts/StreamingMediaPlayerTest.java
+++ b/tests/tests/media/src/android/media/cts/StreamingMediaPlayerTest.java
@@ -28,6 +28,8 @@
* Tests of MediaPlayer streaming capabilities.
*/
public class StreamingMediaPlayerTest extends MediaPlayerTestBase {
+ private static final String TAG = "StreamingMediaPlayerTest";
+
private CtsTestServer mServer;
/* RTSP tests are more flaky and vulnerable to network condition.
@@ -62,6 +64,11 @@
*/
// Streaming HTTP video from YouTube
public void testHTTP_H263_AMR_Video1() throws Exception {
+ if (!hasH263(false)) {
+ Log.i(TAG, "Skipping testHTTP_H263_AMR_Video1(): No codec found.");
+ return;
+ }
+
playVideoTest("http://redirector.c.youtube.com/videoplayback?id=271de9756065677e"
+ "&itag=13&source=youtube&ip=0.0.0.0&ipbits=0&expire=19000000000"
+ "&sparams=ip,ipbits,expire,id,itag,source"
@@ -70,6 +77,11 @@
+ "&key=ik0&user=android-device-test", 176, 144);
}
public void testHTTP_H263_AMR_Video2() throws Exception {
+ if (!hasH263(false)) {
+ Log.i(TAG, "Skipping testHTTP_H263_AMR_Video2(): No codec found.");
+ return;
+ }
+
playVideoTest("http://redirector.c.youtube.com/videoplayback?id=c80658495af60617"
+ "&itag=13&source=youtube&ip=0.0.0.0&ipbits=0&expire=19000000000"
+ "&sparams=ip,ipbits,expire,id,itag,source"
@@ -79,6 +91,11 @@
}
public void testHTTP_MPEG4SP_AAC_Video1() throws Exception {
+ if (!hasH264(false)) {
+ Log.i(TAG, "Skipping testHTTP_MPEG4SP_AAC_Video1(): No codec found.");
+ return;
+ }
+
playVideoTest("http://redirector.c.youtube.com/videoplayback?id=271de9756065677e"
+ "&itag=17&source=youtube&ip=0.0.0.0&ipbits=0&expire=19000000000"
+ "&sparams=ip,ipbits,expire,id,itag,source"
@@ -87,6 +104,11 @@
+ "&key=ik0&user=android-device-test", 176, 144);
}
public void testHTTP_MPEG4SP_AAC_Video2() throws Exception {
+ if (!hasH264(false)) {
+ Log.i(TAG, "Skipping testHTTP_MPEG4SP_AAC_Video2(): No codec found.");
+ return;
+ }
+
playVideoTest("http://redirector.c.youtube.com/videoplayback?id=c80658495af60617"
+ "&itag=17&source=youtube&ip=0.0.0.0&ipbits=0&expire=19000000000"
+ "&sparams=ip,ipbits,expire,id,itag,source"
@@ -96,6 +118,11 @@
}
public void testHTTP_H264Base_AAC_Video1() throws Exception {
+ if (!hasH264(false)) {
+ Log.i(TAG, "Skipping testHTTP_H264Base_AAC_Video1(): No codec found.");
+ return;
+ }
+
playVideoTest("http://redirector.c.youtube.com/videoplayback?id=271de9756065677e"
+ "&itag=18&source=youtube&ip=0.0.0.0&ipbits=0&expire=19000000000"
+ "&sparams=ip,ipbits,expire,id,itag,source"
@@ -104,6 +131,11 @@
+ "&key=ik0&user=android-device-test", 640, 360);
}
public void testHTTP_H264Base_AAC_Video2() throws Exception {
+ if (!hasH264(false)) {
+ Log.i(TAG, "Skipping testHTTP_H264Base_AAC_Video2(): No codec found.");
+ return;
+ }
+
playVideoTest("http://redirector.c.youtube.com/videoplayback?id=c80658495af60617"
+ "&itag=18&source=youtube&ip=0.0.0.0&ipbits=0&expire=19000000000"
+ "&sparams=ip,ipbits,expire,id,itag,source"
@@ -114,6 +146,11 @@
// Streaming HLS video from YouTube
public void testHLS() throws Exception {
+ if (!hasH264(false)) {
+ Log.i(TAG, "Skipping testHLS(): No codec found.");
+ return;
+ }
+
// Play stream for 60 seconds
playLiveVideoTest("http://www.youtube.com/api/manifest/hls_variant/id/"
+ "0168724d02bd9945/itag/5/source/youtube/playlist_type/DVR/ip/"
@@ -165,6 +202,11 @@
stream_url = stream_url + "?" + CtsTestServer.NOLENGTH_POSTFIX;
}
+ if (!supportsPlayback(stream_url)) {
+ Log.i(TAG, "Failed to find codec for: '" + stream_url + "'. Skipping test.");
+ return;
+ }
+
mMediaPlayer.setDataSource(stream_url);
mMediaPlayer.setDisplay(getActivity().getSurfaceHolder());
@@ -252,14 +294,26 @@
}
public void testPlayHlsStream() throws Throwable {
+ if (!hasH264(false)) {
+ Log.i(TAG, "Skipping testPlayHlsStream(): No codec found.");
+ return;
+ }
localHlsTest("hls.m3u8", false, false);
}
public void testPlayHlsStreamWithQueryString() throws Throwable {
+ if (!hasH264(false)) {
+ Log.i(TAG, "Skipping testPlayHlsStreamWithQueryString(): No codec found.");
+ return;
+ }
localHlsTest("hls.m3u8", true, false);
}
public void testPlayHlsStreamWithRedirect() throws Throwable {
+ if (!hasH264(false)) {
+ Log.i(TAG, "Skipping testPlayHlsStreamWithRedirect(): No codec found.");
+ return;
+ }
localHlsTest("hls.m3u8", false, true);
}