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

Unified Diff: webrtc/api/android/java/src/org/webrtc/MediaCodecVideoDecoder.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 | « no previous file | webrtc/api/android/java/src/org/webrtc/MediaCodecVideoEncoder.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/android/java/src/org/webrtc/MediaCodecVideoDecoder.java
diff --git a/webrtc/api/android/java/src/org/webrtc/MediaCodecVideoDecoder.java b/webrtc/api/android/java/src/org/webrtc/MediaCodecVideoDecoder.java
index 63871f840ef7f4ad69f578093d1d78495355f359..9583667f7ab5e9cd904158f3a4716837c966b7db 100644
--- a/webrtc/api/android/java/src/org/webrtc/MediaCodecVideoDecoder.java
+++ b/webrtc/api/android/java/src/org/webrtc/MediaCodecVideoDecoder.java
@@ -178,8 +178,13 @@ public class MediaCodecVideoDecoder {
}
Logging.d(TAG, "Trying to find HW decoder for mime " + mime);
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 decoder codec info", e);
+ }
+ if (info == null || info.isEncoder()) {
continue;
}
String name = null;
@@ -207,8 +212,13 @@ public class MediaCodecVideoDecoder {
}
// Check if codec supports either yuv420 or nv12.
- CodecCapabilities capabilities =
- info.getCapabilitiesForType(mime);
+ CodecCapabilities capabilities;
+ try {
+ capabilities = info.getCapabilitiesForType(mime);
+ } catch (IllegalArgumentException e) {
+ Logging.e(TAG, "Cannot retrieve decoder capabilities", e);
+ continue;
+ }
for (int colorFormat : capabilities.colorFormats) {
Logging.v(TAG, " Color: 0x" + Integer.toHexString(colorFormat));
}
« no previous file with comments | « no previous file | webrtc/api/android/java/src/org/webrtc/MediaCodecVideoEncoder.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698