Interface DefaultAudioSink.AudioTrackBufferSizeProvider
-
- All Known Implementing Classes:
DefaultAudioTrackBufferSizeProvider
- Enclosing class:
- DefaultAudioSink
public static interface DefaultAudioSink.AudioTrackBufferSizeProvider
Provides the buffer size to use when creating anAudioTrack
.
-
-
Field Summary
Fields Modifier and Type Field Description static DefaultAudioSink.AudioTrackBufferSizeProvider
DEFAULT
Default instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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)
Returns the buffer size to use when creating anAudioTrack
for a specific format and output mode.
-
-
-
Field Detail
-
DEFAULT
static final DefaultAudioSink.AudioTrackBufferSizeProvider DEFAULT
Default instance.
-
-
Method Detail
-
getBufferSizeInBytes
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)
Returns the buffer size to use when creating anAudioTrack
for a specific format and output mode.- Parameters:
minBufferSizeInBytes
- The minimum buffer size in bytes required to play this format. SeeAudioTrack.getMinBufferSize(int, int, int)
.encoding
- TheC.Encoding
of the format.outputMode
- How the audio will be played. One of theoutput modes
.pcmFrameSize
- The size of the PCM frames if theencoding
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, orFormat.NO_VALUE
ifencoding
is 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 be1
unlessDefaultAudioSink.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
.
-
-