diff options
| author | 2024-03-09 00:37:48 +0000 | |
|---|---|---|
| committer | 2024-03-09 00:37:48 +0000 | |
| commit | 4ea8bc4f3832ded8bdba2e4e7f20d5d40f9c8c07 (patch) | |
| tree | 4b18f1355c4fae414ae717bb6c089b7e2e13a310 | |
| parent | 14e2771690940ff791bc05b9313e179c36a97781 (diff) | |
| parent | 86bf87a99a3ef3dfa553967f157c263145fc7879 (diff) | |
Merge "media: trivial implementation of MediaCodec.detachOutputSurface" into main am: 86bf87a99a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2974125
Change-Id: Id38aa0ea4e71319d9d84a9fce5368d50668e2e8c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | media/java/android/media/MediaCodec.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java index 5b479b5f9c11..2999d76fd2ae 100644 --- a/media/java/android/media/MediaCodec.java +++ b/media/java/android/media/MediaCodec.java @@ -2345,6 +2345,15 @@ final public class MediaCodec { throw new IllegalArgumentException("Can't use crypto and descrambler together!"); } + // at the moment no codecs support detachable surface + if (android.media.codec.Flags.nullOutputSurface()) { + // Detached surface flag is only meaningful if surface is null. Otherwise, it is + // ignored. + if (surface == null && (flags & CONFIGURE_FLAG_DETACHED_SURFACE) != 0) { + throw new IllegalArgumentException("Codec does not support detached surface"); + } + } + String[] keys = null; Object[] values = null; @@ -2419,7 +2428,8 @@ final public class MediaCodec { * output. * * @throws IllegalStateException if the codec was not - * configured in surface mode. + * configured in surface mode or if the codec does not support + * detaching the output surface. * @see CONFIGURE_FLAG_DETACHED_SURFACE */ @FlaggedApi(FLAG_NULL_OUTPUT_SURFACE) @@ -2429,6 +2439,7 @@ final public class MediaCodec { } // note: we still have a surface in detached mode, so keep mHasSurface // we also technically allow calling detachOutputSurface multiple times in a row + throw new IllegalStateException("codec does not support detaching output surface"); // native_detachSurface(); } |