Merge "media: avoid recursion when evaluating profile support" into nyc-dev

This commit is contained in:
TreeHugger Robot
2016-06-01 00:58:28 +00:00
committed by Android (Google) Code Review

View File

@@ -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;
}
}