Class DefaultAudioTrackBufferSizeProvider
- java.lang.Object
-
- com.google.android.exoplayer2.audio.DefaultAudioTrackBufferSizeProvider
-
- All Implemented Interfaces:
DefaultAudioSink.AudioTrackBufferSizeProvider
@Deprecated public class DefaultAudioTrackBufferSizeProvider extends Object implements DefaultAudioSink.AudioTrackBufferSizeProvider
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 anAudioTrack.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDefaultAudioTrackBufferSizeProvider.BuilderDeprecated.A builder to createDefaultAudioTrackBufferSizeProviderinstances.
-
Field Summary
Fields Modifier and Type Field Description intac3BufferMultiplicationFactorDeprecated.The multiplication factor to apply to AC3 passthrough buffer to avoid underruns on some devices (e.g., Broadcom 7271).protected intmaxPcmBufferDurationUsDeprecated.The maximum length for PCMAudioTrackbuffers, in microseconds.protected intminPcmBufferDurationUsDeprecated.The minimum length for PCMAudioTrackbuffers, in microseconds.protected intoffloadBufferDurationUsDeprecated.The length for offloadAudioTrackbuffers, in microseconds.protected intpassthroughBufferDurationUsDeprecated.The length for passthroughAudioTrackbuffers, in microseconds.protected intpcmBufferMultiplicationFactorDeprecated.The multiplication factor to apply to the minimum buffer size requested.-
Fields inherited from interface com.google.android.exoplayer2.audio.DefaultAudioSink.AudioTrackBufferSizeProvider
DEFAULT
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDefaultAudioTrackBufferSizeProvider(DefaultAudioTrackBufferSizeProvider.Builder builder)Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected static intdurationUsToBytes(int durationUs, int samplingRate, int frameSize)Deprecated.protected intget1xBufferSizeInBytes(int minBufferSizeInBytes, int encoding, int outputMode, int pcmFrameSize, int sampleRate, int bitrate)Deprecated.Returns the buffer size for playback at 1x speed.intgetBufferSizeInBytes(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 anAudioTrackfor a specific format and output mode.protected static intgetMaximumEncodedRateBytesPerSecond(@com.google.android.exoplayer2.C.Encoding int encoding)Deprecated.protected intgetOffloadBufferSizeInBytes(@com.google.android.exoplayer2.C.Encoding int encoding)Deprecated.Returns the buffer size for offload playback.protected intgetPassthroughBufferSizeInBytes(@com.google.android.exoplayer2.C.Encoding int encoding, int bitrate)Deprecated.Returns the buffer size for passthrough playback.protected intgetPcmBufferSizeInBytes(int minBufferSizeInBytes, int samplingRate, int frameSize)Deprecated.Returns the buffer size for PCM playback.
-
-
-
Field Detail
-
minPcmBufferDurationUs
protected final int minPcmBufferDurationUs
Deprecated.The minimum length for PCMAudioTrackbuffers, in microseconds.
-
maxPcmBufferDurationUs
protected final int maxPcmBufferDurationUs
Deprecated.The maximum length for PCMAudioTrackbuffers, in microseconds.
-
pcmBufferMultiplicationFactor
protected final int pcmBufferMultiplicationFactor
Deprecated.The multiplication factor to apply to the minimum buffer size requested.
-
passthroughBufferDurationUs
protected final int passthroughBufferDurationUs
Deprecated.The length for passthroughAudioTrackbuffers, in microseconds.
-
offloadBufferDurationUs
protected final int offloadBufferDurationUs
Deprecated.The length for offloadAudioTrackbuffers, in microseconds.
-
ac3BufferMultiplicationFactor
public final int ac3BufferMultiplicationFactor
Deprecated.The multiplication factor to apply to AC3 passthrough buffer to avoid underruns on some devices (e.g., Broadcom 7271).
-
-
Constructor Detail
-
DefaultAudioTrackBufferSizeProvider
protected DefaultAudioTrackBufferSizeProvider(DefaultAudioTrackBufferSizeProvider.Builder builder)
Deprecated.
-
-
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, int bitrate, double maxAudioTrackPlaybackSpeed)Deprecated.Description copied from interface:DefaultAudioSink.AudioTrackBufferSizeProviderReturns the buffer size to use when creating anAudioTrackfor a specific format and output mode.- Specified by:
getBufferSizeInBytesin interfaceDefaultAudioSink.AudioTrackBufferSizeProvider- Parameters:
minBufferSizeInBytes- The minimum buffer size in bytes required to play this format. SeeAudioTrack.getMinBufferSize(int, int, int).encoding- TheC.Encodingof the format.outputMode- How the audio will be played. One of theoutput modes.pcmFrameSize- The size of the PCM frames if theencodingis 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, orFormat.NO_VALUEifencodingis PCM or the bitrate is not known.maxAudioTrackPlaybackSpeed- The maximum speed the content will be played usingAudioTrack.setPlaybackParams(android.media.PlaybackParams). 0.5 is 2x slow motion, 1 is real time, 2 is 2x fast forward, etc. This will be1unlessDefaultAudioSink.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.
-
get1xBufferSizeInBytes
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.
-
getPcmBufferSizeInBytes
protected int getPcmBufferSizeInBytes(int minBufferSizeInBytes, int samplingRate, int frameSize)Deprecated.Returns the buffer size for PCM playback.
-
getPassthroughBufferSizeInBytes
protected int getPassthroughBufferSizeInBytes(@com.google.android.exoplayer2.C.Encoding int encoding, int bitrate)Deprecated.Returns the buffer size for passthrough playback.
-
getOffloadBufferSizeInBytes
protected int getOffloadBufferSizeInBytes(@com.google.android.exoplayer2.C.Encoding int encoding)
Deprecated.Returns the buffer size for offload playback.
-
durationUsToBytes
protected static int durationUsToBytes(int durationUs, int samplingRate, int frameSize)Deprecated.
-
getMaximumEncodedRateBytesPerSecond
protected static int getMaximumEncodedRateBytesPerSecond(@com.google.android.exoplayer2.C.Encoding int encoding)
Deprecated.
-
-