Commit 5e1b4308 by andrewlewis Committed by Andrew Lewis

Fix check for missing profile/level

SparseIntArray.get(key) defaults to zero for missing keys (the null check was
left over from when a Map was used).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=196957452
parent e23392a4
...@@ -482,13 +482,13 @@ public final class MediaCodecUtil { ...@@ -482,13 +482,13 @@ public final class MediaCodecUtil {
return null; return null;
} }
Integer profile = AVC_PROFILE_NUMBER_TO_CONST.get(profileInteger); int profile = AVC_PROFILE_NUMBER_TO_CONST.get(profileInteger, -1);
if (profile == null) { if (profile == -1) {
Log.w(TAG, "Unknown AVC profile: " + profileInteger); Log.w(TAG, "Unknown AVC profile: " + profileInteger);
return null; return null;
} }
Integer level = AVC_LEVEL_NUMBER_TO_CONST.get(levelInteger); int level = AVC_LEVEL_NUMBER_TO_CONST.get(levelInteger, -1);
if (level == null) { if (level == -1) {
Log.w(TAG, "Unknown AVC level: " + levelInteger); Log.w(TAG, "Unknown AVC level: " + levelInteger);
return null; return null;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment