DefaultDecoderFactory.Builder


public final class DefaultDecoderFactory.Builder


A builder for DefaultDecoderFactory instances.

Summary

Public constructors

Builder(Context context)

Creates a new Builder.

Public methods

DefaultDecoderFactory

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

DefaultDecoderFactory.Builder
@CanIgnoreReturnValue
experimentalSetDynamicSchedulingEnabled(
    boolean dynamicSchedulingEnabled
)

Sets whether decoder dynamic scheduling is enabled.

DefaultDecoderFactory.Builder
@CanIgnoreReturnValue
setCodecPriority(
    @C.Priority @IntRange(to = C.PRIORITY_MAX) int codecPriority
)

Sets the codec priority.

DefaultDecoderFactory.Builder
@CanIgnoreReturnValue
setEnableDecoderFallback(boolean enableDecoderFallback)

Sets whether the decoder can fallback.

DefaultDecoderFactory.Builder

Sets the Listener.

DefaultDecoderFactory.Builder

Sets the MediaCodecSelector used when selecting a decoder.

DefaultDecoderFactory.Builder
@CanIgnoreReturnValue
setShouldConfigureOperatingRate(boolean shouldConfigureOperatingRate)

Sets whether a device-specific decoder operating rate should be requested.

Public constructors

Builder

public Builder(Context context)

Creates a new Builder.

Public methods

build

public DefaultDecoderFactory build()

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

experimentalSetDynamicSchedulingEnabled

@CanIgnoreReturnValue
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
boolean dynamicSchedulingEnabled

Whether to enable dynamic scheduling.

setCodecPriority

@CanIgnoreReturnValue
public DefaultDecoderFactory.Builder setCodecPriority(
    @C.Priority @IntRange(to = C.PRIORITY_MAX) 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 priorities like PRIORITY_PROCESSING_FOREGROUND, 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 PRIORITY_PROCESSING_FOREGROUND.

Parameters
@C.Priority @IntRange(to = C.PRIORITY_MAX) int codecPriority

The C.Priority for the codec. Should be at most PRIORITY_MAX.

setEnableDecoderFallback

@CanIgnoreReturnValue
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.

setMediaCodecSelector

@CanIgnoreReturnValue
public DefaultDecoderFactory.Builder setMediaCodecSelector(MediaCodecSelector mediaCodecSelector)

Sets the MediaCodecSelector used when selecting a decoder.

The default value is DEFAULT

setShouldConfigureOperatingRate

@CanIgnoreReturnValue
public DefaultDecoderFactory.Builder setShouldConfigureOperatingRate(boolean shouldConfigureOperatingRate)

Sets whether a device-specific decoder operating rate 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
boolean shouldConfigureOperatingRate

Whether to apply an KEY_OPERATING_RATE configuration to the decoder.