Class DefaultAudioTrackBufferSizeProvider
- java.lang.Object
-
- com.google.android.exoplayer2.audio.DefaultAudioTrackBufferSizeProvider
-
public class DefaultAudioTrackBufferSizeProvider extends Object
Provide the buffer size to use when creating anAudioTrack
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DefaultAudioTrackBufferSizeProvider.Builder
A builder to createDefaultAudioTrackBufferSizeProvider
instances.
-
Field Summary
Fields Modifier and Type Field Description int
ac3BufferMultiplicationFactor
The multiplication factor to apply to AC3 passthrough buffer to avoid underruns on some devices (e.g., Broadcom 7271).static com.google.android.exoplayer2.audio.DefaultAudioSink.AudioTrackBufferSizeProvider
DEFAULT
Default instance.protected int
maxPcmBufferDurationUs
The maximum length for PCMAudioTrack
buffers, in microseconds.protected int
minPcmBufferDurationUs
The minimum length for PCMAudioTrack
buffers, in microseconds.protected int
offloadBufferDurationUs
The length for offloadAudioTrack
buffers, in microseconds.protected int
passthroughBufferDurationUs
The length for passthroughAudioTrack
buffers, in microseconds.protected int
pcmBufferMultiplicationFactor
The multiplication factor to apply to the minimum buffer size requested.
-
Constructor Summary
Constructors Modifier Constructor Description protected
DefaultAudioTrackBufferSizeProvider(DefaultAudioTrackBufferSizeProvider.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static int
durationUsToBytes(int durationUs, int samplingRate, int frameSize)
protected int
get1xBufferSizeInBytes(int minBufferSizeInBytes, int encoding, int outputMode, int pcmFrameSize, int sampleRate)
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, double maxAudioTrackPlaybackSpeed)
protected static int
getMaximumEncodedRateBytesPerSecond(@com.google.android.exoplayer2.C.Encoding int encoding)
protected int
getOffloadBufferSizeInBytes(@com.google.android.exoplayer2.C.Encoding int encoding)
Returns the buffer size for offload playback.protected int
getPassthroughBufferSizeInBytes(@com.google.android.exoplayer2.C.Encoding int encoding)
Returns the buffer size for passthrough playback.protected int
getPcmBufferSizeInBytes(int minBufferSizeInBytes, int samplingRate, int frameSize)
Returns the buffer size for PCM playback.
-
-
-
Field Detail
-
minPcmBufferDurationUs
protected final int minPcmBufferDurationUs
The minimum length for PCMAudioTrack
buffers, in microseconds.
-
maxPcmBufferDurationUs
protected final int maxPcmBufferDurationUs
The maximum length for PCMAudioTrack
buffers, in microseconds.
-
pcmBufferMultiplicationFactor
protected final int pcmBufferMultiplicationFactor
The multiplication factor to apply to the minimum buffer size requested.
-
passthroughBufferDurationUs
protected final int passthroughBufferDurationUs
The length for passthroughAudioTrack
buffers, in microseconds.
-
offloadBufferDurationUs
protected final int offloadBufferDurationUs
The length for offloadAudioTrack
buffers, in microseconds.
-
ac3BufferMultiplicationFactor
public final int ac3BufferMultiplicationFactor
The multiplication factor to apply to AC3 passthrough buffer to avoid underruns on some devices (e.g., Broadcom 7271).
-
DEFAULT
public static final com.google.android.exoplayer2.audio.DefaultAudioSink.AudioTrackBufferSizeProvider DEFAULT
Default instance.
-
-
Constructor Detail
-
DefaultAudioTrackBufferSizeProvider
protected DefaultAudioTrackBufferSizeProvider(DefaultAudioTrackBufferSizeProvider.Builder builder)
-
-
Method Detail
-
getBufferSizeInBytes
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, double maxAudioTrackPlaybackSpeed)
-
get1xBufferSizeInBytes
protected int get1xBufferSizeInBytes(int minBufferSizeInBytes, int encoding, int outputMode, int pcmFrameSize, int sampleRate)
Returns the buffer size for playback at 1x speed.
-
getPcmBufferSizeInBytes
protected int getPcmBufferSizeInBytes(int minBufferSizeInBytes, int samplingRate, int frameSize)
Returns the buffer size for PCM playback.
-
getPassthroughBufferSizeInBytes
protected int getPassthroughBufferSizeInBytes(@com.google.android.exoplayer2.C.Encoding int encoding)
Returns the buffer size for passthrough playback.
-
getOffloadBufferSizeInBytes
protected int getOffloadBufferSizeInBytes(@com.google.android.exoplayer2.C.Encoding int encoding)
Returns the buffer size for offload playback.
-
durationUsToBytes
protected static int durationUsToBytes(int durationUs, int samplingRate, int frameSize)
-
getMaximumEncodedRateBytesPerSecond
protected static int getMaximumEncodedRateBytesPerSecond(@com.google.android.exoplayer2.C.Encoding int encoding)
-
-