Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(705)

Unified Diff: webrtc/api/android/java/src/org/webrtc/MediaCodecVideoEncoder.java

Issue 2225073003: Catch exceptions thrown by getCodecInfoAt() and getCapabilitiesForType(). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Check for more exceptions Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/api/android/java/src/org/webrtc/MediaCodecVideoDecoder.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/android/java/src/org/webrtc/MediaCodecVideoEncoder.java
diff --git a/webrtc/api/android/java/src/org/webrtc/MediaCodecVideoEncoder.java b/webrtc/api/android/java/src/org/webrtc/MediaCodecVideoEncoder.java
index da8fb41711e2c0d741f4bb77732733aee29e1277..5c499ee514203faaab2c41c435008ccc3524d2b6 100644
--- a/webrtc/api/android/java/src/org/webrtc/MediaCodecVideoEncoder.java
+++ b/webrtc/api/android/java/src/org/webrtc/MediaCodecVideoEncoder.java
@@ -242,8 +242,13 @@ public class MediaCodecVideoEncoder {
}
for (int i = 0; i < MediaCodecList.getCodecCount(); ++i) {
- MediaCodecInfo info = MediaCodecList.getCodecInfoAt(i);
- if (!info.isEncoder()) {
+ MediaCodecInfo info = null;
+ try {
+ info = MediaCodecList.getCodecInfoAt(i);
+ } catch (IllegalArgumentException e) {
+ Logging.e(TAG, "Cannot retrieve encoder codec info", e);
+ }
+ if (info == null || !info.isEncoder()) {
continue;
}
String name = null;
@@ -281,7 +286,13 @@ public class MediaCodecVideoEncoder {
}
// Check if HW codec supports known color format.
- CodecCapabilities capabilities = info.getCapabilitiesForType(mime);
+ CodecCapabilities capabilities;
+ try {
+ capabilities = info.getCapabilitiesForType(mime);
+ } catch (IllegalArgumentException e) {
+ Logging.e(TAG, "Cannot retrieve encoder capabilities", e);
+ continue;
+ }
for (int colorFormat : capabilities.colorFormats) {
Logging.v(TAG, " Color: 0x" + Integer.toHexString(colorFormat));
}
« no previous file with comments | « webrtc/api/android/java/src/org/webrtc/MediaCodecVideoDecoder.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698