summaryrefslogtreecommitdiff
path: root/media
diff options
context:
space:
mode:
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/AudioDeviceInfo.java25
-rw-r--r--media/java/android/media/MediaCodec.java31
-rw-r--r--media/java/android/media/MediaRecorder.java7
3 files changed, 39 insertions, 24 deletions
diff --git a/media/java/android/media/AudioDeviceInfo.java b/media/java/android/media/AudioDeviceInfo.java
index 09b382ee46d0..a186566aec0b 100644
--- a/media/java/android/media/AudioDeviceInfo.java
+++ b/media/java/android/media/AudioDeviceInfo.java
@@ -25,7 +25,6 @@ import android.util.SparseIntArray;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.TreeSet;
@@ -515,29 +514,7 @@ public final class AudioDeviceInfo {
* For forward compatibility, applications should ignore entries it does not recognize.
*/
public @NonNull int[] getEncodings() {
- final int[] encodings = AudioFormat.filterPublicFormats(mPort.formats());
- boolean hasFloat = false;
- boolean hasExtendedIntegerPrecision = false;
-
- for (int encoding : encodings) {
- if (AudioFormat.isEncodingLinearPcm(encoding)) {
- if (encoding == AudioFormat.ENCODING_PCM_FLOAT) {
- hasFloat = true;
- } else if (AudioFormat.getBytesPerSample(encoding) > 2) {
- hasExtendedIntegerPrecision = true;
- }
- }
- }
- if (hasExtendedIntegerPrecision && !hasFloat) {
- // R and earlier compatibility - add ENCODING_PCM_FLOAT to the end
- // (replacing the zero pad). This ensures pre-S apps that look
- // for ENCODING_PCM_FLOAT continue to see that encoding if the device supports
- // extended precision integers.
- int[] encodingsPlusFloat = Arrays.copyOf(encodings, encodings.length + 1);
- encodingsPlusFloat[encodings.length] = AudioFormat.ENCODING_PCM_FLOAT;
- return encodingsPlusFloat;
- }
- return encodings;
+ return AudioFormat.filterPublicFormats(mPort.formats());
}
/**
diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java
index cc05ecd3f18e..8b9153621165 100644
--- a/media/java/android/media/MediaCodec.java
+++ b/media/java/android/media/MediaCodec.java
@@ -72,6 +72,37 @@ import java.util.concurrent.locks.ReentrantLock;
Finally, you request (or receive) a filled output buffer, consume its contents and release it
back to the codec.
+ <h3 id=qualityFloor><a name="qualityFloor">Minimum Quality Floor for Video Encoding</h3>
+ <p>
+ Beginning with {@link android.os.Build.VERSION_CODES#S}, Android's Video MediaCodecs enforce a
+ minimum quality floor. The intent is to eliminate poor quality video encodings. This quality
+ floor is applied when the codec is in Variable Bitrate (VBR) mode; it is not applied when
+ the codec is in Constant Bitrate (CBR) mode. The quality floor enforcement is also restricted
+ to a particular size range; this size range is currently for video resolutions
+ larger than 320x240 up through 1920x1080.
+
+ <p>
+ When this quality floor is in effect, the codec and supporting framework code will work to
+ ensure that the generated video is of at least a "fair" or "good" quality. The metric
+ used to choose these targets is the VMAF (Video Multi-method Assessment Function) with a
+ target score of 70 for selected test sequences.
+
+ <p>
+ The typical effect is that
+ some videos will generate a higher bitrate than originally configured. This will be most
+ notable for videos which were configured with very low bitrates; the codec will use a bitrate
+ that is determined to be more likely to generate an "fair" or "good" quality video. Another
+ situation is where a video includes very complicated content (lots of motion and detail);
+ in such configurations, the codec will use extra bitrate as needed to avoid losing all of
+ the content's finer detail.
+
+ <p>
+ This quality floor will not impact content captured at high bitrates (a high bitrate should
+ already provide the codec with sufficient capacity to encode all of the detail).
+ The quality floor does not operate on CBR encodings.
+ The quality floor currently does not operate on resolutions of 320x240 or lower, nor on
+ videos with resolution above 1920x1080.
+
<h3>Data Types</h3>
<p>
Codecs operate on three kinds of data: compressed data, raw audio data and raw video data.
diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java
index 341bb8d5309a..7d80e931c943 100644
--- a/media/java/android/media/MediaRecorder.java
+++ b/media/java/android/media/MediaRecorder.java
@@ -1096,6 +1096,13 @@ public class MediaRecorder implements AudioRouting,
* clipped internally to ensure the video recording can proceed smoothly based on
* the capabilities of the platform.
*
+ * <p>
+ * NB: the actual bitrate and other encoding characteristics may be affected by
+ * the minimum quality floor behavior introduced in
+ * {@link android.os.Build.VERSION_CODES#S}. More detail on how and where this
+ * impacts video encoding can be found in the
+ * {@link MediaCodec} page and looking for "quality floor" (near the top of the page).
+ *
* @param bitRate the video encoding bit rate in bits per second.
*/
public void setVideoEncodingBitRate(int bitRate) {