Don't crash if no performance data was provided for the codec using the M API

This commit is contained in:
Cameron Gutman
2022-06-18 10:37:16 -05:00
parent f207a3f6d1
commit c743949df5

View File

@@ -132,7 +132,11 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer implements C
// We'll ask the decoder what it can do for us at this resolution and see if our
// requested frame rate falls below or inside the range of achievable frame rates.
Range<Double> fpsRange = caps.getAchievableFrameRatesFor(prefs.width, prefs.height);
return prefs.fps <= fpsRange.getUpper();
if (fpsRange != null) {
return prefs.fps <= fpsRange.getUpper();
}
// Fall-through to try the Android L API if there's no performance point data
} catch (IllegalArgumentException e) {
// Video size not supported at any frame rate
return false;