summaryrefslogtreecommitdiffstats
path: root/tests/AccessoryDisplay
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
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')
-rw-r--r--tests/AccessoryDisplay/sink/src/com/android/accessorydisplay/sink/DisplaySinkService.java8
-rw-r--r--tests/AccessoryDisplay/source/src/com/android/accessorydisplay/source/DisplaySourceService.java10
2 files changed, 15 insertions, 3 deletions
diff --git a/tests/AccessoryDisplay/sink/src/com/android/accessorydisplay/sink/DisplaySinkService.java b/tests/AccessoryDisplay/sink/src/com/android/accessorydisplay/sink/DisplaySinkService.java
index daec845..8189fa9 100644
--- a/tests/AccessoryDisplay/sink/src/com/android/accessorydisplay/sink/DisplaySinkService.java
+++ b/tests/AccessoryDisplay/sink/src/com/android/accessorydisplay/sink/DisplaySinkService.java
@@ -30,6 +30,7 @@ import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
+import java.io.IOException;
import java.nio.ByteBuffer;
public class DisplaySinkService extends Service implements SurfaceHolder.Callback {
@@ -150,7 +151,12 @@ public class DisplaySinkService extends Service implements SurfaceHolder.Callbac
if (mSurface != null) {
MediaFormat format = MediaFormat.createVideoFormat(
"video/avc", mSurfaceWidth, mSurfaceHeight);
- mCodec = MediaCodec.createDecoderByType("video/avc");
+ try {
+ mCodec = MediaCodec.createDecoderByType("video/avc");
+ } catch (IOException e) {
+ throw new RuntimeException(
+ "failed to create video/avc decoder", e);
+ }
mCodec.configure(format, mSurface, null, 0);
mCodec.start();
mCodecBufferInfo = new BufferInfo();
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();