Share via


MediaCodec.Flush Method

Definition

Flush both input and output ports of the component.

[Android.Runtime.Register("flush", "()V", "")]
public void Flush ();
[<Android.Runtime.Register("flush", "()V", "")>]
member this.Flush : unit -> unit
Attributes

Exceptions

if not in the Executing state.

upon codec error.

Remarks

Flush both input and output ports of the component.

Upon return, all indices previously returned in calls to #dequeueInputBuffer dequeueInputBuffer and #dequeueOutputBuffer dequeueOutputBuffer &mdash; or obtained via Callback#onInputBufferAvailable onInputBufferAvailable or Callback#onOutputBufferAvailable onOutputBufferAvailable callbacks &mdash; become invalid, and all buffers are owned by the codec.

If the codec is configured in asynchronous mode, call #start after flush has returned to resume codec operations. The codec will not request input buffers until this has happened. <strong>Note, however, that there may still be outstanding onOutputBufferAvailable callbacks that were not handled prior to calling flush. The indices returned via these callbacks also become invalid upon calling flush and should be discarded.</strong>

If the codec is configured in synchronous mode, codec will resume automatically if it is configured with an input surface. Otherwise, it will resume when #dequeueInputBuffer dequeueInputBuffer is called.

Java documentation for android.media.MediaCodec.flush().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to