Unable to further increase buffer size for exoplayer after a certain point
griffinfscribd opened this issue · comments
I’m new to using exoplayer and am having some trouble increasing the buffer size.
Here is the scenario for what I’m trying to accomplish:
When I play audio in the exoplayer, the audio will be buffered and loaded. After the buffering finishes, I go from online to offline and I want to be able to play audio offline at an increased length hence why I want to increase the playback buffer size.
I have been able to increase this buffer duration by setting the loadControl
on the exoplayer instance via setLoadControl
and to that LoadControl
, set the buffer duration using setBufferDurationMs
and increase the values for minBufferMs
and maxBufferMs
.
Going well so far. The amount of audio played offline after buffering has increased. What has me stumped is that when I try to increase the value of minBufferMs
, then play the audio offline after buffering, the length of the audio buffered seems to stay constant after a certain value of minBufferMs
. For example, as I increase minBufferMs
to 30 minutes or 2 hour equivalent of milliseconds, it never buffers more than 17 minutes of audio.
Let’s say I want to increase the amount of buffered audio to be played offline to 30 minutes, or even more. My issue is being able to do just that but there seems a fixed amount of audio buffered regardless of how high I increase the bufferMs for the loadControl. I am guessing it might be due to some limit to the buffer being set somewhere.
I’ve tried several other things - for LoadControl
’s Builder setBufferDurationMs
, I’ve experimented with reducing the bufferForPlaybackMs
, bufferForPlaybackAfterRebufferMs
to different values without any difference. I’ve tried changing the Allocator and setting the allocator to have a lower individualAllocationSize
. I’ve tried bumping up the targetBufferBytes
. Outside of the LoadControl
, I tried playing around with the CacheDataSource
in hopes that maybe it’d help by setting a cache with differing parameters.
I’ve tried playing around with the DefaultAudioSink
and bumping up the PcmBufferDuration without much success.
I am hoping to get some guidance on where I should focus my attention further to achieve what I’m trying to do? I’ve tried fiddling with some settings but my worry is that I went through the right place mentioned above, but I didn’t understand it enough to put in the right values for the parameters and such.
My guess is that the limitation comes from the memory limit in DefaultLoadControl
. There is a time limit (controlled by minBufferMs
and maxBuffersMs
), which you already played around with. But there is also a memory limit that takes precedence by default. The default for audio-only is 12.8MB, which corresponds to about 100 kbit/s for 17 minutes of audio, matching your observation.
Could you try setting a higher limit with setTargetBufferBytes
and/or instruct DefaultLoadControl
to prefer the time limits of the memory limits (setPrioritizeTimeOverSizeThresholds(true)
)?
If that doesn't work, please let us know the exact configuration you tried and maybe also share a sample file you tested with so we can reproduce the issue.
Thank you @tonihei, I was able to resolve my issue and overcome the limitation with setTargetBufferBytes
. Although I tried setTargetBufferBytes
previously, my mistake was that it was not set to a high enough amount of bytes. Looking at setPrioritizeTimeOverSizeThresholds(true)
helped me figure that out.
Closing issue since it's resolved.