Share via


MediaCodec.Callback.OnMetricsFlushed(MediaCodec, PersistableBundle) Method

Definition

Called when the metrics for this codec have been flushed "mid-stream" due to the start of a new subsession during execution.

[Android.Runtime.Register("onMetricsFlushed", "(Landroid/media/MediaCodec;Landroid/os/PersistableBundle;)V", "GetOnMetricsFlushed_Landroid_media_MediaCodec_Landroid_os_PersistableBundle_Handler", ApiSince=36)]
public virtual void OnMetricsFlushed(Android.Media.MediaCodec codec, Android.OS.PersistableBundle metrics);
[<Android.Runtime.Register("onMetricsFlushed", "(Landroid/media/MediaCodec;Landroid/os/PersistableBundle;)V", "GetOnMetricsFlushed_Landroid_media_MediaCodec_Landroid_os_PersistableBundle_Handler", ApiSince=36)>]
abstract member OnMetricsFlushed : Android.Media.MediaCodec * Android.OS.PersistableBundle -> unit
override this.OnMetricsFlushed : Android.Media.MediaCodec * Android.OS.PersistableBundle -> unit

Parameters

codec
MediaCodec

The MediaCodec object.

metrics
PersistableBundle

The flushed metrics for this codec. This is a PersistableBundle containing the set of attributes and values available for the media being handled by this instance of MediaCodec. The attributes are described in MetricsConstants. Additional vendor-specific fields may also be present.

Attributes

Remarks

Called when the metrics for this codec have been flushed "mid-stream" due to the start of a new subsession during execution.

A new codec subsession normally starts when the codec is reconfigured after stop(), but it can also happen mid-stream e.g. if the video size changes. When this happens, the metrics for the previous subsession are flushed, and MediaCodec#getMetrics will return the metrics for the new subsession.

For subsessions that begin due to a reconfiguration, the metrics for the prior subsession can be retrieved via MediaCodec#getMetrics prior to calling #configure.

When a new subsession begins "mid-stream", the metrics for the prior subsession are flushed just before the Callback#onOutputFormatChanged event, so this <b>optional</b> callback is provided to be able to capture the final metrics for the previous subsession.

Java documentation for android.media.MediaCodec.Callback.onMetricsFlushed(android.media.MediaCodec, android.os.PersistableBundle).

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