Fixing build issue with L-sdk
Based on https://codereview.appspot.com/153000043/ BUG=https://code.google.com/p/chromium/issues/detail?id=420293 R=niklas.enbom@webrtc.org, serya@chromium.org, yfriedman@chromium.org Review URL: https://webrtc-codereview.appspot.com/29659004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7374 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -333,7 +333,8 @@ class MediaCodecVideoDecoder {
|
||||
format.setInteger(MediaFormat.KEY_COLOR_FORMAT, properties.colorFormat);
|
||||
}
|
||||
Log.d(TAG, " Format: " + format);
|
||||
mediaCodec = MediaCodec.createByCodecName(properties.codecName);
|
||||
mediaCodec =
|
||||
MediaCodecVideoEncoder.createByCodecName(properties.codecName);
|
||||
if (mediaCodec == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -152,6 +152,16 @@ class MediaCodecVideoEncoder {
|
||||
}
|
||||
}
|
||||
|
||||
static MediaCodec createByCodecName(String codecName) {
|
||||
try {
|
||||
// In the L-SDK this call can throw IOException so in order to work in
|
||||
// both cases catch an exception.
|
||||
return MediaCodec.createByCodecName(codecName);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Return the array of input buffers, or null on failure.
|
||||
private ByteBuffer[] initEncode(int width, int height, int kbps, int fps) {
|
||||
Log.d(TAG, "Java initEncode: " + width + " x " + height +
|
||||
@ -175,7 +185,7 @@ class MediaCodecVideoEncoder {
|
||||
format.setInteger(MediaFormat.KEY_FRAME_RATE, fps);
|
||||
format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 100);
|
||||
Log.d(TAG, " Format: " + format);
|
||||
mediaCodec = MediaCodec.createByCodecName(properties.codecName);
|
||||
mediaCodec = createByCodecName(properties.codecName);
|
||||
if (mediaCodec == null) {
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user