docs/doc/reference/com/google/android/exoplayer2/audio/DefaultAudioTrackBufferSizeProvider.html
Package com.google.android.exoplayer2.audio
All Implemented Interfaces:DefaultAudioSink.AudioTrackBufferSizeProvider
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public classDefaultAudioTrackBufferSizeProviderextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[DefaultAudioSink.AudioTrackBufferSizeProvider](DefaultAudioSink.AudioTrackBufferSizeProvider.html "interface in com.google.android.exoplayer2.audio")
Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
Provide the buffer size to use when creating an AudioTrack.
Nested Classes | Modifier and Type | Class | Description |
| --- | --- | --- |
| static class | DefaultAudioTrackBufferSizeProvider.Builder |
Deprecated.
A builder to create DefaultAudioTrackBufferSizeProvider instances.
|
Fields | Modifier and Type | Field | Description |
| --- | --- | --- |
| int | ac3BufferMultiplicationFactor |
Deprecated.
The multiplication factor to apply to AC3 passthrough buffer to avoid underruns on some devices (e.g., Broadcom 7271).
|
| protected int | maxPcmBufferDurationUs |
Deprecated.
The maximum length for PCM AudioTrack buffers, in microseconds.
|
| protected int | minPcmBufferDurationUs |
Deprecated.
The minimum length for PCM AudioTrack buffers, in microseconds.
|
| protected int | offloadBufferDurationUs |
Deprecated.
The length for offload AudioTrack buffers, in microseconds.
|
| protected int | passthroughBufferDurationUs |
Deprecated.
The length for passthrough AudioTrack buffers, in microseconds.
|
| protected int | pcmBufferMultiplicationFactor |
Deprecated.
The multiplication factor to apply to the minimum buffer size requested. |
-
DEFAULT
Constructors | Modifier | Constructor | Description |
| --- | --- | --- |
| protected | DefaultAudioTrackBufferSizeProvider(DefaultAudioTrackBufferSizeProvider.Builder builder) |
Deprecated.
|
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| protected static int | durationUsToBytes(int durationUs, int samplingRate, int frameSize) |
Deprecated.
|
| protected int | get1xBufferSizeInBytes(int minBufferSizeInBytes, int encoding, int outputMode, int pcmFrameSize, int sampleRate, int bitrate) |
Deprecated.
Returns the buffer size for playback at 1x speed.
|
| int | getBufferSizeInBytes(int minBufferSizeInBytes, @com.google.android.exoplayer2.C.Encoding int encoding, @com.google.android.exoplayer2.audio.DefaultAudioSink.OutputMode int outputMode, int pcmFrameSize, int sampleRate, int bitrate, double maxAudioTrackPlaybackSpeed) |
Deprecated.
Returns the buffer size to use when creating an AudioTrack for a specific format and output mode.
|
| protected static int | getMaximumEncodedRateBytesPerSecond(@com.google.android.exoplayer2.C.Encoding int encoding) |
Deprecated.
|
| protected int | getOffloadBufferSizeInBytes(@com.google.android.exoplayer2.C.Encoding int encoding) |
Deprecated.
Returns the buffer size for offload playback.
|
| protected int | getPassthroughBufferSizeInBytes(@com.google.android.exoplayer2.C.Encoding int encoding, int bitrate) |
Deprecated.
Returns the buffer size for passthrough playback.
|
| protected int | getPcmBufferSizeInBytes(int minBufferSizeInBytes, int samplingRate, int frameSize) |
Deprecated.
Returns the buffer size for PCM playback. |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
protected final int minPcmBufferDurationUs
Deprecated.
The minimum length for PCM AudioTrack buffers, in microseconds.
-
protected final int maxPcmBufferDurationUs
Deprecated.
The maximum length for PCM AudioTrack buffers, in microseconds.
-
protected final int pcmBufferMultiplicationFactor
Deprecated.
The multiplication factor to apply to the minimum buffer size requested.
-
protected final int passthroughBufferDurationUs
Deprecated.
The length for passthrough AudioTrack buffers, in microseconds.
-
protected final int offloadBufferDurationUs
Deprecated.
The length for offload AudioTrack buffers, in microseconds.
-
public final int ac3BufferMultiplicationFactor
Deprecated.
The multiplication factor to apply to AC3 passthrough buffer to avoid underruns on some devices (e.g., Broadcom 7271).
-
protected DefaultAudioTrackBufferSizeProvider([DefaultAudioTrackBufferSizeProvider.Builder](DefaultAudioTrackBufferSizeProvider.Builder.html "class in com.google.android.exoplayer2.audio")builder)
Deprecated.
-
public int getBufferSizeInBytes(int minBufferSizeInBytes,
@com.google.android.exoplayer2.C.Encoding int encoding,
@com.google.android.exoplayer2.audio.DefaultAudioSink.OutputMode int outputMode,
int pcmFrameSize,
int sampleRate,
int bitrate,
double maxAudioTrackPlaybackSpeed)
Deprecated.
Description copied from interface: DefaultAudioSink.AudioTrackBufferSizeProvider
Returns the buffer size to use when creating an AudioTrack for a specific format and output mode.
Specified by:getBufferSizeInBytes in interface DefaultAudioSink.AudioTrackBufferSizeProviderParameters:minBufferSizeInBytes - The minimum buffer size in bytes required to play this format. See AudioTrack.getMinBufferSize(int, int, int).encoding - The C.Encoding of the format.outputMode - How the audio will be played. One of the output modes.pcmFrameSize - The size of the PCM frames if the encoding is PCM, 1 otherwise, in bytes.sampleRate - The sample rate of the format, in Hz.bitrate - The bitrate of the audio stream if the stream is compressed, or Format.NO_VALUE if encoding is PCM or the bitrate is not known.maxAudioTrackPlaybackSpeed - The maximum speed the content will be played using AudioTrack.setPlaybackParams(android.media.PlaybackParams). 0.5 is 2x slow motion, 1 is real time, 2 is 2x fast forward, etc. This will be 1 unless DefaultAudioSink.Builder.setEnableAudioTrackPlaybackParams(boolean) is enabled.Returns:The computed buffer size in bytes. It should always be >= minBufferSizeInBytes. The computed buffer size must contain an integer number of frames: bufferSizeInBytes % pcmFrameSize == 0.
-
protected int get1xBufferSizeInBytes(int minBufferSizeInBytes,
int encoding,
int outputMode,
int pcmFrameSize,
int sampleRate,
int bitrate)
Deprecated.
Returns the buffer size for playback at 1x speed.
-
protected int getPcmBufferSizeInBytes(int minBufferSizeInBytes,
int samplingRate,
int frameSize)
Deprecated.
Returns the buffer size for PCM playback.
-
protected int getPassthroughBufferSizeInBytes(@com.google.android.exoplayer2.C.Encoding int encoding,
int bitrate)
Deprecated.
Returns the buffer size for passthrough playback.
-
protected int getOffloadBufferSizeInBytes(@com.google.android.exoplayer2.C.Encoding int encoding)
Deprecated.
Returns the buffer size for offload playback.
-
protected static int durationUsToBytes(int durationUs,
int samplingRate,
int frameSize)
Deprecated.
-
protected static int getMaximumEncodedRateBytesPerSecond(@com.google.android.exoplayer2.C.Encoding int encoding)
Deprecated.