diff options
author | Andy Hung <hunga@google.com> | 2013-11-04 14:42:09 -0800 |
---|---|---|
committer | Andy Hung <hunga@google.com> | 2013-11-05 18:54:43 -0800 |
commit | 52d8aa79a31c5042d2b43d06f08fa28489b27d1b (patch) | |
tree | 1b3da59936eefe7295378bf432afbd684a23174b /tests/AccessoryDisplay | |
parent | 2ea312c1bf5f618f4877806b07e0fb2aa4541e6f (diff) | |
download | frameworks_base-52d8aa79a31c5042d2b43d06f08fa28489b27d1b.zip frameworks_base-52d8aa79a31c5042d2b43d06f08fa28489b27d1b.tar.gz frameworks_base-52d8aa79a31c5042d2b43d06f08fa28489b27d1b.tar.bz2 |
Add "throws IOException" to MediaCodec constructors (3)
Change to add "throws IOException" to android.media.MediaCodec
(createByCodecName|createDecoderByType|createEncoderByType). The exception was
previously thrown through the native JNI, but not explicitly declared.
Requires changes to existing code for declaration compatibility.
Bug: 11364276
Change-Id: Ia0d3481397285cb1503bedde37d4651934b3a481
Signed-off-by: Andy Hung <hunga@google.com>
Diffstat (limited to 'tests/AccessoryDisplay')
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..9e6ced1 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( + "IOException in MediaCodec.createDecoderByType for video/avc", 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..9207fb2 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( + "IOException in MediaCodec.createEncoderByType for video/avc", e); + } codec.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE); Surface surface = codec.createInputSurface(); codec.start(); |