Move test case to StagefrightTest

so it is tested with MediaExtractor as well.

Bug: 19779574
Bug: 31156921
Change-Id: I08fbd8e28d23bafea816ea853382a11325c10b7e
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayerTest.java b/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
index 7701439..09e5fda 100755
--- a/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
@@ -97,10 +97,6 @@
         }
     }
 
-    public void testonInputBufferFilledSigsegv() throws Exception {
-        testIfMediaServerDied(R.raw.on_input_buffer_filled_sigsegv);
-    }
-
     public void testFlacHeapOverflow() throws Exception {
         testIfMediaServerDied(R.raw.heap_oob_flac);
     }
diff --git a/tests/tests/media/res/raw/on_input_buffer_filled_sigsegv.mp4 b/tests/tests/security/res/raw/bug_19779574.mp4
similarity index 100%
rename from tests/tests/media/res/raw/on_input_buffer_filled_sigsegv.mp4
rename to tests/tests/security/res/raw/bug_19779574.mp4
Binary files differ
diff --git a/tests/tests/security/src/android/security/cts/StagefrightTest.java b/tests/tests/security/src/android/security/cts/StagefrightTest.java
index 0b8be0f..e3100f6 100644
--- a/tests/tests/security/src/android/security/cts/StagefrightTest.java
+++ b/tests/tests/security/src/android/security/cts/StagefrightTest.java
@@ -368,6 +368,11 @@
         doStagefrightTest(R.raw.bug_27855419);
     }
 
+    @SecurityTest
+    public void testStagefright_bug_19779574() throws Exception {
+        doStagefrightTest(R.raw.bug_19779574);
+    }
+
     private void doStagefrightTest(final int rid) throws Exception {
         doStagefrightTestMediaPlayer(rid);
         doStagefrightTestMediaCodec(rid);
@@ -652,6 +657,7 @@
                     MediaCodecInfo.CodecCapabilities caps = info.getCapabilitiesForType(mime);
                     if (caps != null) {
                         matchingCodecs.add(info.getName());
+                        Log.i(TAG, "Found matching codec " + info.getName() + " for track " + t);
                     }
                 } catch (IllegalArgumentException e) {
                     // type is not supported
@@ -662,7 +668,12 @@
                 Log.w(TAG, "no codecs for track " + t + ", type " + mime);
             }
             // decode this track once with each matching codec
-            ex.selectTrack(t);
+            try {
+                ex.selectTrack(t);
+            } catch (IllegalArgumentException e) {
+                Log.w(TAG, "couldn't select track " + t);
+                // continue on with codec initialization anyway, since that might still crash
+            }
             for (String codecName: matchingCodecs) {
                 Log.i(TAG, "Decoding track " + t + " using codec " + codecName);
                 ex.seekTo(0, MediaExtractor.SEEK_TO_CLOSEST_SYNC);
@@ -674,6 +685,7 @@
                 try {
                     codec.configure(format, surface, null, 0);
                     codec.start();
+                    Log.i(TAG, "started codec " + codecName);
                 } catch (Exception e) {
                     Log.i(TAG, "Failed to start/configure:", e);
                 }