summaryrefslogtreecommitdiffstats
path: root/tests/AccessoryDisplay/source/src
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2014-01-16 10:10:38 -0800
committerAndy Hung <hunga@google.com>2014-01-16 12:35:15 -0800
commit83511d2f49c9e272f328730586c3d0a7852247f2 (patch)
treeb9b741001599ebee76df2e670cb4439353fc328e /tests/AccessoryDisplay/source/src
parent4a5eb8fe18337597ece6ca1cedbbb56a0b309c39 (diff)
downloadframeworks_base-83511d2f49c9e272f328730586c3d0a7852247f2.zip
frameworks_base-83511d2f49c9e272f328730586c3d0a7852247f2.tar.gz
frameworks_base-83511d2f49c9e272f328730586c3d0a7852247f2.tar.bz2
Add "throws IOException" to MediaCodec factory methods
android.media.MediaCodec (createByCodecName|createDecoderByType|createEncoderByType) now explicitly throws IOException. Requires changes to existing code for declaration compatibility. Bug: 11364276 Change-Id: I105ecb7c4bd49bf803111253cd23bab161c988f9 Signed-off-by: Andy Hung <hunga@google.com>
Diffstat (limited to 'tests/AccessoryDisplay/source/src')
-rw-r--r--tests/AccessoryDisplay/source/src/com/android/accessorydisplay/source/DisplaySourceService.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/AccessoryDisplay/source/src/com/android/accessorydisplay/source/DisplaySourceService.java b/tests/AccessoryDisplay/source/src/com/android/accessorydisplay/source/DisplaySourceService.java
index 256f900..a4faca5 100644
--- a/tests/AccessoryDisplay/source/src/com/android/accessorydisplay/source/DisplaySourceService.java
+++ b/tests/AccessoryDisplay/source/src/com/android/accessorydisplay/source/DisplaySourceService.java
@@ -32,6 +32,7 @@ import android.os.Message;
import android.view.Display;
import android.view.Surface;
+import java.io.IOException;
import java.nio.ByteBuffer;
public class DisplaySourceService extends Service {
@@ -191,8 +192,13 @@ public class DisplaySourceService extends Service {
format.setInteger(MediaFormat.KEY_BIT_RATE, BIT_RATE);
format.setInteger(MediaFormat.KEY_FRAME_RATE, FRAME_RATE);
format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, I_FRAME_INTERVAL);
-
- MediaCodec codec = MediaCodec.createEncoderByType("video/avc");
+ MediaCodec codec;
+ try {
+ codec = MediaCodec.createEncoderByType("video/avc");
+ } catch (IOException e) {
+ throw new RuntimeException(
+ "failed to create video/avc encoder", e);
+ }
codec.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
Surface surface = codec.createInputSurface();
codec.start();