public interface

DefaultAudioSink.AudioProcessorChain

 androidx.media3.exoplayer.audio.DefaultAudioSink.AudioProcessorChain

Subclasses:

DefaultAudioSink.DefaultAudioProcessorChain

Overview

Provides a chain of audio processors, which are used for any user-defined processing and applying playback parameters (if supported). Because applying playback parameters can skip and stretch/compress audio, the sink will query the chain for information on how to transform its output position to map it onto a media position, via DefaultAudioSink.AudioProcessorChain.getMediaDuration(long) and DefaultAudioSink.AudioProcessorChain.getSkippedOutputFrameCount().

Summary

Methods
public PlaybackParametersapplyPlaybackParameters(PlaybackParameters playbackParameters)

Configures audio processors to apply the specified playback parameters immediately, returning the new playback parameters, which may differ from those passed in.

public booleanapplySkipSilenceEnabled(boolean skipSilenceEnabled)

Configures audio processors to apply whether to skip silences immediately, returning the new value.

public AudioProcessorgetAudioProcessors()

Returns the fixed chain of audio processors that will process audio.

public longgetMediaDuration(long playoutDuration)

Returns the media duration corresponding to the specified playout duration, taking speed adjustment due to audio processing into account.

public longgetSkippedOutputFrameCount()

Returns the number of output audio frames skipped since the audio processors were last flushed.

Methods

public AudioProcessor getAudioProcessors()

Returns the fixed chain of audio processors that will process audio. This method is called once during initialization, but audio processors may change state to become active/inactive during playback.

public PlaybackParameters applyPlaybackParameters(PlaybackParameters playbackParameters)

Configures audio processors to apply the specified playback parameters immediately, returning the new playback parameters, which may differ from those passed in. Only called when processors have no input pending.

Parameters:

playbackParameters: The playback parameters to try to apply.

Returns:

The playback parameters that were actually applied.

public boolean applySkipSilenceEnabled(boolean skipSilenceEnabled)

Configures audio processors to apply whether to skip silences immediately, returning the new value. Only called when processors have no input pending.

Parameters:

skipSilenceEnabled: Whether silences should be skipped in the audio stream.

Returns:

The new value.

public long getMediaDuration(long playoutDuration)

Returns the media duration corresponding to the specified playout duration, taking speed adjustment due to audio processing into account.

The scaling performed by this method will use the actual playback speed achieved by the audio processor chain, on average, since it was last flushed. This may differ very slightly from the target playback speed.

Parameters:

playoutDuration: The playout duration to scale.

Returns:

The corresponding media duration, in the same units as duration.

public long getSkippedOutputFrameCount()

Returns the number of output audio frames skipped since the audio processors were last flushed.