diff --git a/library/src/main/java/com/google/android/exoplayer/MediaCodecUtil.java b/library/src/main/java/com/google/android/exoplayer/MediaCodecUtil.java index f3dbc7e7d1..5dbe3c5a11 100644 --- a/library/src/main/java/com/google/android/exoplayer/MediaCodecUtil.java +++ b/library/src/main/java/com/google/android/exoplayer/MediaCodecUtil.java @@ -15,6 +15,7 @@ */ package com.google.android.exoplayer; +import com.google.android.exoplayer.util.Assertions; import com.google.android.exoplayer.util.MimeTypes; import com.google.android.exoplayer.util.Util; @@ -179,6 +180,33 @@ public class MediaCodecUtil { return capabilities.isFeatureSupported(CodecCapabilities.FEATURE_AdaptivePlayback); } + /** + * Tests whether the device advertises it can decode video of a given type at a specified + * width, height, and frame rate. + *
+ * Must not be called if the device SDK version is less than 21.
+ *
+ * @param mimeType The mime type.
+ * @param secure Whether the decoder is required to support secure decryption. Always pass false
+ * unless secure decryption really is required.
+ * @param width Width in pixels.
+ * @param height Height in pixels.
+ * @param frameRate Frame rate in frames per second.
+ * @return Whether the decoder advertises support of the given size and frame rate.
+ */
+ @TargetApi(21)
+ public static boolean isSizeAndRateSupportedV21(String mimeType, boolean secure,
+ int width, int height, double frameRate) throws DecoderQueryException {
+ Assertions.checkState(Util.SDK_INT >= 21);
+ Pair