diff options
| -rw-r--r-- | api/current.txt | 1 | ||||
| -rw-r--r-- | api/system-current.txt | 1 | ||||
| -rw-r--r-- | media/java/android/media/MediaCodecInfo.java | 21 |
3 files changed, 23 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt index bcc36ef3cf73..f25edb1a29e7 100644 --- a/api/current.txt +++ b/api/current.txt @@ -15578,6 +15578,7 @@ package android.media { public static final class MediaCodecInfo.VideoCapabilities { method public boolean areSizeAndRateSupported(int, int, double); + method public android.util.Range<java.lang.Double> getAchievableFrameRatesFor(int, int); method public android.util.Range<java.lang.Integer> getBitrateRange(); method public int getHeightAlignment(); method public android.util.Range<java.lang.Integer> getSupportedFrameRates(); diff --git a/api/system-current.txt b/api/system-current.txt index 22ca12f7acd6..fc8547525aee 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -16791,6 +16791,7 @@ package android.media { public static final class MediaCodecInfo.VideoCapabilities { method public boolean areSizeAndRateSupported(int, int, double); + method public android.util.Range<java.lang.Double> getAchievableFrameRatesFor(int, int); method public android.util.Range<java.lang.Integer> getBitrateRange(); method public int getHeightAlignment(); method public android.util.Range<java.lang.Integer> getSupportedFrameRates(); diff --git a/media/java/android/media/MediaCodecInfo.java b/media/java/android/media/MediaCodecInfo.java index b497001b6d3d..ff1b57d54aaf 100644 --- a/media/java/android/media/MediaCodecInfo.java +++ b/media/java/android/media/MediaCodecInfo.java @@ -1136,6 +1136,27 @@ public final class MediaCodecInfo { } /** + * Returns the range of achievable video frame rates for a video size. + * May return {@code null}, if the codec did not publish any measurement + * data. + * <p> + * This is a performance estimate, based on full-speed decoding + * and encoding measurements of common video sizes supported by the codec. + * + * @param width the width of the video + * @param height the height of the video + * + * @throws IllegalArgumentException if the video size is not supported. + */ + public Range<Double> getAchievableFrameRatesFor(int width, int height) { + if (!supports(width, height, null)) { + throw new IllegalArgumentException("unsupported size"); + } + // TODO: get this data from the codec + return null; + } + + /** * Returns whether a given video size ({@code width} and * {@code height}) and {@code frameRate} combination is supported. */ |