summaryrefslogtreecommitdiff
path: root/media/java
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2019-02-04 23:25:48 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-02-04 23:25:48 +0000
commitf727b8cf97a809f094ee14c99a44d300222566dd (patch)
treed7777c80dc4b07864f4a19d46f25f7e226b9b90f /media/java
parenta9f577b5c66be60ac2aa65fc5d68442c02c8a3c2 (diff)
parentbb609f8319317d3417e80b672a40f361c0a390f2 (diff)
Merge "Expose a few keys that's already used by apps"
Diffstat (limited to 'media/java')
-rw-r--r--media/java/android/media/MediaCodec.java33
-rw-r--r--media/java/android/media/MediaFormat.java57
2 files changed, 90 insertions, 0 deletions
diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java
index 0c3d6255f871..c6c2fdd00674 100644
--- a/media/java/android/media/MediaCodec.java
+++ b/media/java/android/media/MediaCodec.java
@@ -3373,6 +3373,8 @@ final public class MediaCodec {
/**
* Change a video encoder's target bitrate on the fly. The value is an
* Integer object containing the new bitrate in bps.
+ *
+ * @see #setParameters(Bundle)
*/
public static final String PARAMETER_KEY_VIDEO_BITRATE = "video-bitrate";
@@ -3384,12 +3386,43 @@ final public class MediaCodec {
* input-side of the encoder in that case.
* The value is an Integer object containing the value 1 to suspend
* or the value 0 to resume.
+ *
+ * @see #setParameters(Bundle)
*/
public static final String PARAMETER_KEY_SUSPEND = "drop-input-frames";
/**
+ * When {@link #PARAMETER_KEY_SUSPEND} is present, the client can also
+ * optionally use this key to specify the timestamp (in micro-second)
+ * at which the suspend/resume operation takes effect.
+ *
+ * Note that the specified timestamp must be greater than or equal to the
+ * timestamp of any previously queued suspend/resume operations.
+ *
+ * The value is a long int, indicating the timestamp to suspend/resume.
+ *
+ * @see #setParameters(Bundle)
+ */
+ public static final String PARAMETER_KEY_SUSPEND_TIME = "drop-start-time-us";
+
+ /**
+ * Specify an offset (in micro-second) to be added on top of the timestamps
+ * onward. A typical use case is to apply an adjust to the timestamps after
+ * a period of pause by the user.
+ *
+ * This parameter can only be used on an encoder in "surface-input" mode.
+ *
+ * The value is a long int, indicating the timestamp offset to be applied.
+ *
+ * @see #setParameters(Bundle)
+ */
+ public static final String PARAMETER_KEY_OFFSET_TIME = "time-offset-us";
+
+ /**
* Request that the encoder produce a sync frame "soon".
* Provide an Integer with the value 0.
+ *
+ * @see #setParameters(Bundle)
*/
public static final String PARAMETER_KEY_REQUEST_SYNC_FRAME = "request-sync";
diff --git a/media/java/android/media/MediaFormat.java b/media/java/android/media/MediaFormat.java
index c82b5f6f12a1..4ca0216c80f2 100644
--- a/media/java/android/media/MediaFormat.java
+++ b/media/java/android/media/MediaFormat.java
@@ -463,6 +463,63 @@ public final class MediaFormat {
= "repeat-previous-frame-after";
/**
+ * Instruct the video encoder in "surface-input" mode to drop excessive
+ * frames from the source, so that the input frame rate to the encoder
+ * does not exceed the specified fps.
+ *
+ * The associated value is a float, representing the max frame rate to
+ * feed the encoder at.
+ *
+ * @hide
+ */
+ public static final String KEY_MAX_FPS_TO_ENCODER
+ = "max-fps-to-encoder";
+
+ /**
+ * Instruct the video encoder in "surface-input" mode to limit the gap of
+ * timestamp between any two adjacent frames fed to the encoder to the
+ * specified amount (in micro-second).
+ *
+ * The associated value is a long int. When positive, it represents the max
+ * timestamp gap between two adjacent frames fed to the encoder. When negative,
+ * the absolute value represents a fixed timestamp gap between any two adjacent
+ * frames fed to the encoder. Note that this will also apply even when the
+ * original timestamp goes backward in time. Under normal conditions, such frames
+ * would be dropped and not sent to the encoder.
+ *
+ * The output timestamp will be restored to the original timestamp and will
+ * not be affected.
+ *
+ * This is used in some special scenarios where input frames arrive sparingly
+ * but it's undesirable to allocate more bits to any single frame, or when it's
+ * important to ensure all frames are captured (rather than captured in the
+ * correct order).
+ *
+ * @hide
+ */
+ public static final String KEY_MAX_PTS_GAP_TO_ENCODER
+ = "max-pts-gap-to-encoder";
+
+ /**
+ * If specified when configuring a video encoder that's in "surface-input"
+ * mode, it will instruct the encoder to put the surface source in suspended
+ * state when it's connected. No video frames will be accepted until a resume
+ * operation (see {@link MediaCodec#PARAMETER_KEY_SUSPEND}), optionally with
+ * timestamp specified via {@link MediaCodec#PARAMETER_KEY_SUSPEND_TIME}, is
+ * received.
+ *
+ * The value is an integer, with 1 indicating to create with the surface
+ * source suspended, or 0 otherwise. The default value is 0.
+ *
+ * If this key is not set or set to 0, the surface source will accept buffers
+ * as soon as it's connected to the encoder (although they may not be encoded
+ * immediately). This key can be used when the client wants to prepare the
+ * encoder session in advance, but do not want to accept buffers immediately.
+ */
+ public static final String KEY_CREATE_INPUT_SURFACE_SUSPENDED
+ = "create-input-buffers-suspended";
+
+ /**
* If specified when configuring a video decoder rendering to a surface,
* causes the decoder to output "blank", i.e. black frames to the surface
* when stopped to clear out any previously displayed contents.