AudioSink.AudioSinkConfig.Builder


public final class AudioSink.AudioSinkConfig.Builder


Builder for AudioSinkConfig.

Summary

Public constructors

Builder(Format format)

Creates a new builder.

Public methods

AudioSink.AudioSinkConfig

Builds an AudioSinkConfig instance.

AudioSink.AudioSinkConfig.Builder

Sets the MediaPeriodId of the playback this audio sink is configured for.

AudioSink.AudioSinkConfig.Builder

Sets a mapping from input to output channels.

AudioSink.AudioSinkConfig.Builder
@CanIgnoreReturnValue
setPreferredBufferSizeOverride(int preferredBufferSizeOverride)

This method is deprecated.

Use similar setters on lower-level components like AudioOutput instead, e.g. by modifying preferredBufferSize.

AudioSink.AudioSinkConfig.Builder

Sets the Timeline of the playback this audio sink is configured for.

Public constructors

Builder

public Builder(Format format)

Creates a new builder.

Parameters
Format format

The format of audio data provided in the input buffers.

Public methods

build

public AudioSink.AudioSinkConfig build()

Builds an AudioSinkConfig instance.

setMediaPeriodId

@CanIgnoreReturnValue
public AudioSink.AudioSinkConfig.Builder setMediaPeriodId(@Nullable MediaSource.MediaPeriodId mediaPeriodId)

Sets the MediaPeriodId of the playback this audio sink is configured for.

Can be used together with the Timeline to identify the concrete item in the playlist.

If the MediaPeriodId is non-null and the provided Timeline non-empty, the value must refer to a valid period in the provided Timeline.

Parameters
@Nullable MediaSource.MediaPeriodId mediaPeriodId

The MediaPeriodId, or null to leave it undefined.

Returns
AudioSink.AudioSinkConfig.Builder

This builder.

setOutputChannelMapping

@CanIgnoreReturnValue
public AudioSink.AudioSinkConfig.Builder setOutputChannelMapping(
    @Nullable ImmutableIntArray outputChannelMapping
)

Sets a mapping from input to output channels.

Parameters
@Nullable ImmutableIntArray outputChannelMapping

A mapping from input to output channels that is applied to this sink's input as a preprocessing step, if handling PCM input. Specify null to leave the input unchanged. Otherwise, the element at index i specifies index of the input channel to map to output channel i when preprocessing input buffers. After the map is applied the audio data will have outputChannels.length channels.

Returns
AudioSink.AudioSinkConfig.Builder

This builder.

setPreferredBufferSizeOverride

@CanIgnoreReturnValue
public AudioSink.AudioSinkConfig.Builder setPreferredBufferSizeOverride(int preferredBufferSizeOverride)

Sets a specific size for the playback buffer in bytes.

This method should not be needed as the buffer size is only applicable to lower-level components like the AudioOutput and should be set there.

Parameters
int preferredBufferSizeOverride

A specific size for the playback buffer in bytes, or 0 to infer a suitable buffer size automatically.

Returns
AudioSink.AudioSinkConfig.Builder

This builder.

setTimeline

@CanIgnoreReturnValue
public AudioSink.AudioSinkConfig.Builder setTimeline(Timeline timeline)

Sets the Timeline of the playback this audio sink is configured for.

Can be used together with the MediaPeriodId to identify the concrete item in the playlist.

Parameters
Timeline timeline

The Timeline.

Returns
AudioSink.AudioSinkConfig.Builder

This builder.