Merge "media: VideoCapabilities: publish codec performance data"
diff --git a/api/current.txt b/api/current.txt
index bcc36ef..f25edb1 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -15578,6 +15578,7 @@
 
   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 22ca12f..fc85475 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -16791,6 +16791,7 @@
 
   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 b497001..ff1b57d 100644
--- a/media/java/android/media/MediaCodecInfo.java
+++ b/media/java/android/media/MediaCodecInfo.java
@@ -1136,6 +1136,27 @@
         }
 
         /**
+         * 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.
          */