diff options
| -rw-r--r-- | media/java/android/media/MediaCodecInfo.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/media/java/android/media/MediaCodecInfo.java b/media/java/android/media/MediaCodecInfo.java index 349d67ec9145..72fb1e9cad70 100644 --- a/media/java/android/media/MediaCodecInfo.java +++ b/media/java/android/media/MediaCodecInfo.java @@ -591,7 +591,12 @@ public final class MediaCodecInfo { } } levelCaps = createFromProfileLevel(mMime, profile, maxLevel); - if (levelCaps != null && !levelCaps.isFormatSupported(format)) { + // remove profile from this format otherwise levelCaps.isFormatSupported will + // get into this same conditon and loop forever. + Map<String, Object> mapWithoutProfile = new HashMap<>(map); + mapWithoutProfile.remove(MediaFormat.KEY_PROFILE); + MediaFormat formatWithoutProfile = new MediaFormat(mapWithoutProfile); + if (levelCaps != null && !levelCaps.isFormatSupported(formatWithoutProfile)) { return false; } } |