From 062784a9f26efcdffbcf0c2e39464676b36be426 Mon Sep 17 00:00:00 2001 From: Lajos Molnar Date: Tue, 24 May 2022 14:22:52 -0700 Subject: [PATCH] media: clarify that flush() is not supported for encoders. Bug: 146022133 Change-Id: If1083bb6c6193b01bdd29e60dfc907df8e052663 --- media/java/android/media/MediaCodec.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java index d5b7adaeb57b9..ccc23b7069ba5 100644 --- a/media/java/android/media/MediaCodec.java +++ b/media/java/android/media/MediaCodec.java @@ -291,8 +291,11 @@ import java.util.concurrent.locks.ReentrantLock; most of its life. When you queue an input buffer with the {@linkplain #BUFFER_FLAG_END_OF_STREAM end-of-stream marker}, the codec transitions to the End-of-Stream sub-state. In this state the codec no longer accepts further input buffers, but still generates output buffers until the - end-of-stream is reached on the output. You can move back to the Flushed sub-state at any time - while in the Executing state using {@link #flush}. + end-of-stream is reached on the output. For decoders, you can move back to the Flushed sub-state + at any time while in the Executing state using {@link #flush}. +

+ Note: Going back to Flushed state is only supported for decoders, and may not + work for encoders (the behavior is undefined).

Call {@link #stop} to return the codec to the Uninitialized state, whereupon it may be configured again. When you are done using a codec, you must release it by calling {@link #release}.