public final class

DefaultDecoderFactory.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.media3.transformer.DefaultDecoderFactory.Builder

Overview

A builder for DefaultDecoderFactory instances.

Summary

Constructors
publicBuilder(Context context)

Creates a new DefaultDecoderFactory.Builder.

Methods
public DefaultDecoderFactorybuild()

Creates an instance of DefaultDecoderFactory, using defaults if values are unset.

public DefaultDecoderFactory.BuilderexperimentalSetDynamicSchedulingEnabled(boolean dynamicSchedulingEnabled)

Sets whether decoder dynamic scheduling is enabled.

public DefaultDecoderFactory.BuildersetCodecPriority(int codecPriority)

Sets the codec priority.

public DefaultDecoderFactory.BuildersetEnableDecoderFallback(boolean enableDecoderFallback)

Sets whether the decoder can fallback.

public DefaultDecoderFactory.BuildersetListener(DefaultDecoderFactory.Listener listener)

Sets the DefaultDecoderFactory.Listener.

public DefaultDecoderFactory.BuildersetMediaCodecSelector(MediaCodecSelector mediaCodecSelector)

Sets the MediaCodecSelector used when selecting a decoder.

public DefaultDecoderFactory.BuildersetShouldConfigureOperatingRate(boolean shouldConfigureOperatingRate)

Sets whether a device-specific decoder should be requested.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder(Context context)

Creates a new DefaultDecoderFactory.Builder.

Methods

Sets the DefaultDecoderFactory.Listener.

public DefaultDecoderFactory.Builder setEnableDecoderFallback(boolean enableDecoderFallback)

Sets whether the decoder can fallback.

This decides whether to enable fallback to lower-priority decoders if decoder initialization fails. This may result in using a decoder that is less efficient or slower than the primary decoder.

The default value is false.

public DefaultDecoderFactory.Builder setCodecPriority(int codecPriority)

Sets the codec priority.

Specifying codec priority allows the resource manager in the platform to reclaim less important codecs before more important codecs.

It is recommended to use predefined like C.PRIORITY_PROCESSING_FOREGROUND, C.PRIORITY_PROCESSING_BACKGROUND or priority values defined relative to those defaults.

This method is a no-op on API versions before 35.

The default value is C.PRIORITY_PROCESSING_FOREGROUND.

Parameters:

codecPriority: The for the codec. Should be at most C.PRIORITY_MAX.

public DefaultDecoderFactory.Builder setShouldConfigureOperatingRate(boolean shouldConfigureOperatingRate)

Sets whether a device-specific decoder should be requested.

This is a best-effort hint to the codec. Setting this to true might improve decoding performance.

The effect of this field will be most noticeable when no other MediaCodec instances are in use.

Defaults to false.

Parameters:

shouldConfigureOperatingRate: Whether to apply an configuration to the decoder.

public DefaultDecoderFactory.Builder setMediaCodecSelector(MediaCodecSelector mediaCodecSelector)

Sets the MediaCodecSelector used when selecting a decoder.

The default value is MediaCodecSelector.DEFAULT

public DefaultDecoderFactory.Builder experimentalSetDynamicSchedulingEnabled(boolean dynamicSchedulingEnabled)

Sets whether decoder dynamic scheduling is enabled.

If enabled, the ExoPlayerAssetLoader can change how often the rendering loop for decoders created by this factory is run.

On some devices, setting this to true will feed and drain decoders more frequently, and will lead to improved performance.

The default value is false.

This method is experimental, and will be renamed or removed in a future release.

Parameters:

dynamicSchedulingEnabled: Whether to enable dynamic scheduling.

public DefaultDecoderFactory build()

Creates an instance of DefaultDecoderFactory, using defaults if values are unset.