In our experience ExoPlayer does not use lower bitrate even there is latency in downloading big chunks and this causes freezing and buffering. However the bandwith is 6 Mbit, because of VBR sometimes the size of one 2 second chunk differs from 1.5 MegeByte to 15 MegaByte. In our experience when there is increase in bitrate the player still tries to download next chunk using same bitrate instead of lowering bitrate. What is causing this problem. Is there a way or configuration to fix this?
We are using default values of buffer sizes and track selection durations.
private const val ADAPTIVE_MIN_DURATION_FOR_QUALITY_INCREASE_MS = 10000
private const val ADAPTIVE_MAX_DURATION_FOR_QUALITY_DECREASE_MS = 25000
private const val ADAPTIVE_MIN_DURATION_TO_RETAIN_AFTER_DISCARD_MS = 25000
private const val ADAPTIVE_BANDWIDTH_FRACTION = 0.70f
private const val ADAPTIVE_BUFFERED_FRACTION_TO_LIVE_EDGE_FOR_QUALITY_INCREASE = 0.75f
public static final int DEFAULT_MIN_BUFFER_MS = 50_000;
public static final int DEFAULT_MAX_BUFFER_MS = 50_000;
public static final int DEFAULT_BUFFER_FOR_PLAYBACK_MS = 2500;
public static final int DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS = 5000;
//MPD File
<?xml version="1.0" encoding="UTF-8"?>
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:cenc="urn:mpeg:cenc:2013" xmlns:mspr="urn:microsoft:playready" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd" profiles="urn:mpeg:dash:profile:isoff-live:2011" type="dynamic" minimumUpdatePeriod="PT500S" suggestedPresentationDelay="PT2S" availabilityStartTime="2020-09-09T00:10:16Z" publishTime="2021-01-23T17:28:55Z" minBufferTime="PT4.0S" timeShiftBufferDepth="PT86400.0S">
<ProgramInformation />
<Period id="0" start="PT0.0S">
<AdaptationSet id="0" contentType="video" segmentAlignment="true" bitstreamSwitching="true" maxFrameRate="50/1">
<Representation id="0" mimeType="video/mp4" codecs="avc1.4d4015" bandwidth="800000" width="480" height="270" frameRate="25/1">
<SegmentTemplate timescale="12800" duration="25600" initialization="ExtAst1599610204_init_$RepresentationID$.m4i?hw_dash=1&servicetype=1&rrsip=izmottrrs.tvplus.com.tr:443&zoneoffset=0&devkbps=190-7000&accounttype=1&limitflux=-1&limitdur=-1&tenantId=9001&validdev=5499,5270&vqe=3&mount=1000001&targetdev=5387&pbf=2_2_2_2331729884" media="ExtAst1599610204_chunk_20200909T001000_$RepresentationID$_$Number$.m4v?hw_dash=1&servicetype=1&rrsip=izmottrrs.tvplus.com.tr:443&zoneoffset=0&devkbps=190-7000&accounttype=1&limitflux=-1&limitdur=-1&tenantId=9001&validdev=5499,5270&vqe=3&mount=1000001&targetdev=5387&pbf=2_2_2_2331729884" startNumber="1" />
</Representation>
<Representation id="1" mimeType="video/mp4" codecs="avc1.4d401e" bandwidth="1400000" width="704" height="396" frameRate="25/1">
<SegmentTemplate timescale="12800" duration="25600" initialization="ExtAst1599610204_init_$RepresentationID$.m4i?hw_dash=1&servicetype=1&rrsip=izmottrrs.tvplus.com.tr:443&zoneoffset=0&devkbps=190-7000&accounttype=1&limitflux=-1&limitdur=-1&tenantId=9001&validdev=5499,5270&vqe=3&mount=1000001&targetdev=5387&pbf=2_2_2_2331729884" media="ExtAst1599610204_chunk_20200909T001000_$RepresentationID$_$Number$.m4v?hw_dash=1&servicetype=1&rrsip=izmottrrs.tvplus.com.tr:443&zoneoffset=0&devkbps=190-7000&accounttype=1&limitflux=-1&limitdur=-1&tenantId=9001&validdev=5499,5270&vqe=3&mount=1000001&targetdev=5387&pbf=2_2_2_2331729884" startNumber="1" />
</Representation>
<Representation id="2" mimeType="video/mp4" codecs="avc1.4d401f" bandwidth="2000000" width="960" height="540" frameRate="25/1">
<SegmentTemplate timescale="12800" duration="25600" initialization="ExtAst1599610204_init_$RepresentationID$.m4i?hw_dash=1&servicetype=1&rrsip=izmottrrs.tvplus.com.tr:443&zoneoffset=0&devkbps=190-7000&accounttype=1&limitflux=-1&limitdur=-1&tenantId=9001&validdev=5499,5270&vqe=3&mount=1000001&targetdev=5387&pbf=2_2_2_2331729884" media="ExtAst1599610204_chunk_20200909T001000_$RepresentationID$_$Number$.m4v?hw_dash=1&servicetype=1&rrsip=izmottrrs.tvplus.com.tr:443&zoneoffset=0&devkbps=190-7000&accounttype=1&limitflux=-1&limitdur=-1&tenantId=9001&validdev=5499,5270&vqe=3&mount=1000001&targetdev=5387&pbf=2_2_2_2331729884" startNumber="1" />
</Representation>
<Representation id="3" mimeType="video/mp4" codecs="avc1.4d4020" bandwidth="3150000" width="1280" height="720" frameRate="50/1">
<SegmentTemplate timescale="12800" duration="25600" initialization="ExtAst1599610204_init_$RepresentationID$.m4i?hw_dash=1&servicetype=1&rrsip=izmottrrs.tvplus.com.tr:443&zoneoffset=0&devkbps=190-7000&accounttype=1&limitflux=-1&limitdur=-1&tenantId=9001&validdev=5499,5270&vqe=3&mount=1000001&targetdev=5387&pbf=2_2_2_2331729884" media="ExtAst1599610204_chunk_20200909T001000_$RepresentationID$_$Number$.m4v?hw_dash=1&servicetype=1&rrsip=izmottrrs.tvplus.com.tr:443&zoneoffset=0&devkbps=190-7000&accounttype=1&limitflux=-1&limitdur=-1&tenantId=9001&validdev=5499,5270&vqe=3&mount=1000001&targetdev=5387&pbf=2_2_2_2331729884" startNumber="1" />
</Representation>
<Representation id="4" mimeType="video/mp4" codecs="avc1.4d402a" bandwidth="6000000" width="1920" height="1080" frameRate="50/1">
<SegmentTemplate timescale="12800" duration="25600" initialization="ExtAst1599610204_init_$RepresentationID$.m4i?hw_dash=1&servicetype=1&rrsip=izmottrrs.tvplus.com.tr:443&zoneoffset=0&devkbps=190-7000&accounttype=1&limitflux=-1&limitdur=-1&tenantId=9001&validdev=5499,5270&vqe=3&mount=1000001&targetdev=5387&pbf=2_2_2_2331729884" media="ExtAst1599610204_chunk_20200909T001000_$RepresentationID$_$Number$.m4v?hw_dash=1&servicetype=1&rrsip=izmottrrs.tvplus.com.tr:443&zoneoffset=0&devkbps=190-7000&accounttype=1&limitflux=-1&limitdur=-1&tenantId=9001&validdev=5499,5270&vqe=3&mount=1000001&targetdev=5387&pbf=2_2_2_2331729884" startNumber="1" />
</Representation>
<Representation id="5" mimeType="video/mp4" codecs="avc1.4d400d" bandwidth="400000" width="416" height="234" frameRate="25/1">
<SegmentTemplate timescale="12800" duration="25600" initialization="ExtAst1599610204_init_$RepresentationID$.m4i?hw_dash=1&servicetype=1&rrsip=izmottrrs.tvplus.com.tr:443&zoneoffset=0&devkbps=190-7000&accounttype=1&limitflux=-1&limitdur=-1&tenantId=9001&validdev=5499,5270&vqe=3&mount=1000001&targetdev=5387&pbf=2_2_2_2331729884" media="ExtAst1599610204_chunk_20200909T001000_$RepresentationID$_$Number$.m4v?hw_dash=1&servicetype=1&rrsip=izmottrrs.tvplus.com.tr:443&zoneoffset=0&devkbps=190-7000&accounttype=1&limitflux=-1&limitdur=-1&tenantId=9001&validdev=5499,5270&vqe=3&mount=1000001&targetdev=5387&pbf=2_2_2_2331729884" startNumber="1" />
</Representation>
<Representation id="6" mimeType="video/mp4" codecs="avc1.4d400d" bandwidth="200000" width="416" height="234" frameRate="25/1">
<SegmentTemplate timescale="12800" duration="25600" initialization="ExtAst1599610204_init_$RepresentationID$.m4i?hw_dash=1&servicetype=1&rrsip=izmottrrs.tvplus.com.tr:443&zoneoffset=0&devkbps=190-7000&accounttype=1&limitflux=-1&limitdur=-1&tenantId=9001&validdev=5499,5270&vqe=3&mount=1000001&targetdev=5387&pbf=2_2_2_2331729884" media="ExtAst1599610204_chunk_20200909T001000_$RepresentationID$_$Number$.m4v?hw_dash=1&servicetype=1&rrsip=izmottrrs.tvplus.com.tr:443&zoneoffset=0&devkbps=190-7000&accounttype=1&limitflux=-1&limitdur=-1&tenantId=9001&validdev=5499,5270&vqe=3&mount=1000001&targetdev=5387&pbf=2_2_2_2331729884" startNumber="1" />
</Representation>
</AdaptationSet>
<AdaptationSet id="1" contentType="audio" segmentAlignment="true" bitstreamSwitching="true" lang="tur">
<Representation id="8" mimeType="audio/mp4" codecs="mp4a.40.5" bandwidth="128000" audioSamplingRate="48000">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2" />
<SegmentTemplate timescale="48000" duration="96000" initialization="ExtAst1599610204_init_$RepresentationID$.m4i?hw_dash=1&servicetype=1&rrsip=izmottrrs.tvplus.com.tr:443&zoneoffset=0&devkbps=190-7000&accounttype=1&limitflux=-1&limitdur=-1&tenantId=9001&validdev=5499,5270&vqe=3&mount=1000001&targetdev=5387&pbf=2_2_2_2331729884" media="ExtAst1599610204_chunk_20200909T001000_$RepresentationID$_$Number$.m4a?hw_dash=1&servicetype=1&rrsip=izmottrrs.tvplus.com.tr:443&zoneoffset=0&devkbps=190-7000&accounttype=1&limitflux=-1&limitdur=-1&tenantId=9001&validdev=5499,5270&vqe=3&mount=1000001&targetdev=5387&pbf=2_2_2_2331729884" startNumber="1" />
</Representation>
</AdaptationSet>
</Period>
<UTCTiming schemeIdUri="urn:mpeg:dash:utc:http-iso:2014" value="https://time.akamai.com/?iso" />
</MPD>
I made a workaround for this. It works mostly.
protected boolean canSelectFormat(Format format, int trackBitrate, float playbackSpeed, long effectiveBitrate) {
if (lastBufferEvaluationMediaChunk != null && trackBitrate == lastBufferEvaluationMediaChunk.trackFormat.bitrate) {
long chunkDurationInSeconds = (lastBufferEvaluationMediaChunk.endTimeUs - lastBufferEvaluationMediaChunk.startTimeUs) / 1_000_000;
double chunkBitrate = lastBufferEvaluationMediaChunk.bytesLoaded() / chunkDurationInSeconds * 8.0;
double bitrateCoefficient = chunkBitrate / trackBitrate;
if (bitrateCoefficient > 1.0f) {
return Math.round(trackBitrate * playbackSpeed) * bitrateCoefficient <= effectiveBitrate;
}
}
return Math.round(trackBitrate * playbackSpeed) <= effectiveBitrate;
}