Package com.castlabs.android.player
Class AbrConfiguration.Builder
java.lang.Object
com.castlabs.android.player.AbrConfiguration.Builder
- Enclosing class:
AbrConfiguration
A builder for ABR configuration instances
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbandwidthFraction
(float bandwidthFraction) The fraction of the bandwidth estimation that we consider the effective bandwidth.bytesThreshold
(int bytesThreshold) Set theAbrConfiguration.bytesThreshold
degradationPenalty
(float degradationPenalty) degradationRecovery
(float degradationRecovery) downloadTimeFactor
(float downloadTimeFactor) Safety factor that is applied to download time calculationsget()
Get the ABR configuration created by this builderinitialTrackSelection
(int initialTrackSelection, boolean keepInitialSelection) The initial track selection can be used to manually select a track by index initially, in combination withkeepInitialSelection
.maxDurationForQualityDecrease
(long maxDurationForQualityDecrease, TimeUnit unit) The maximum amount of data that is expected to be buffered before a quality decrease is permitted.maxInitialBitrate
(long maxInitialBitrate) The bandwidth estimation in bits per second that is used when the bandwidth estimator reports that it can not estimate due to lack of information.method
(int method) Select the underlying ABR method as one ofAbrConfiguration.METHOD_COMMON_NBA
,AbrConfiguration.METHOD_EXO
,AbrConfiguration.METHOD_ITERATE
, orAbrConfiguration.METHOD_FLIP
.minDegradationSamples
(int minDegradationSamples) minDurationForQualityIncrease
(long minDurationForQualityIncrease, TimeUnit unit) The minimum amount of that data is expected to be buffered before a quality increase is permitted.minDurationToRetainAfterDiscard
(long minDurationToRetainAfterDiscard, TimeUnit unit) The minimum duration of the buffer to retain after discarding the segments when switching to significantly higher quality (i.e.minSampledBytes
(long minSampledBytes) Set theAbrConfiguration.minSampledBytes
percentile
(float percentile) Set theAbrConfiguration.percentile
percentileWeight
(int percentileWeight) Set the weight used for the sliding percentile bandwidth estimatorsafeBufferSize
(long safeBufferSize, TimeUnit unit) Minimum target buffer considered safe.timeThresholdMs
(int timeThresholdMs) Set theAbrConfiguration.timeThresholdMs
useCMSD
(boolean value)
-
Constructor Details
-
Builder
public Builder() -
Builder
-
-
Method Details
-
maxInitialBitrate
The bandwidth estimation in bits per second that is used when the bandwidth estimator reports that it can not estimate due to lack of information. This is usually used for the initial quality selection when no network estimation was collected yet.- Parameters:
maxInitialBitrate
- The initial bitrate- Returns:
- The builder
-
minDurationForQualityIncrease
public AbrConfiguration.Builder minDurationForQualityIncrease(long minDurationForQualityIncrease, TimeUnit unit) The minimum amount of that data is expected to be buffered before a quality increase is permitted.- Parameters:
minDurationForQualityIncrease
- timeunit
- time unit- Returns:
- The builder
-
maxDurationForQualityDecrease
public AbrConfiguration.Builder maxDurationForQualityDecrease(long maxDurationForQualityDecrease, TimeUnit unit) The maximum amount of data that is expected to be buffered before a quality decrease is permitted.- Parameters:
maxDurationForQualityDecrease
- timeunit
- time unit- Returns:
- The builder
-
bandwidthFraction
The fraction of the bandwidth estimation that we consider the effective bandwidth.- Parameters:
bandwidthFraction
- The bandwidth fraction- Returns:
- The builder
-
initialTrackSelection
public AbrConfiguration.Builder initialTrackSelection(int initialTrackSelection, boolean keepInitialSelection) The initial track selection can be used to manually select a track by index initially, in combination withkeepInitialSelection
. You can also useSdkConsts.VIDEO_QUALITY_HIGHEST
orSdkConsts.VIDEO_QUALITY_LOWEST
. The default value isSdkConsts.VIDEO_QUALITY_ADAPTIVE
. The tracks are in descending bitrate order and therefore the index having value of 0 corresponds to the quality with the highest bitrate.Please note that
maxInitialBitrate
is a better option if you want to influence the initial track selection because you will no need to know the actual indices.- Parameters:
initialTrackSelection
- The initially selected index or one ofSdkConsts.VIDEO_QUALITY_LOWEST
,SdkConsts.VIDEO_QUALITY_HIGHEST
,SdkConsts.VIDEO_QUALITY_ADAPTIVE
keepInitialSelection
- If true, the initial selection will be kept and ABR will be effectively disabled- Returns:
- The builder
-
method
Select the underlying ABR method as one ofAbrConfiguration.METHOD_COMMON_NBA
,AbrConfiguration.METHOD_EXO
,AbrConfiguration.METHOD_ITERATE
, orAbrConfiguration.METHOD_FLIP
.- Parameters:
method
- The method- Returns:
- The builder
-
minDurationToRetainAfterDiscard
public AbrConfiguration.Builder minDurationToRetainAfterDiscard(long minDurationToRetainAfterDiscard, TimeUnit unit) The minimum duration of the buffer to retain after discarding the segments when switching to significantly higher quality (i.e. from SD to HD) thus facilitating faster switch to a higher quality.- Parameters:
minDurationToRetainAfterDiscard
- timeunit
- time unit- Returns:
- The builder
-
safeBufferSize
Minimum target buffer considered safe. Buffer below or equals this threshold results in emergency handling.- Parameters:
safeBufferSize
- timeunit
- time unit- Returns:
- The builder
-
downloadTimeFactor
Safety factor that is applied to download time calculations- Parameters:
downloadTimeFactor
- download time factor- Returns:
- The builder
-
percentileWeight
Set the weight used for the sliding percentile bandwidth estimator- Parameters:
percentileWeight
- The weight- Returns:
- The builder
-
percentile
Set theAbrConfiguration.percentile
- Parameters:
percentile
- The percentile- Returns:
- The builder
-
bytesThreshold
Set theAbrConfiguration.bytesThreshold
- Parameters:
bytesThreshold
- The bytesThreshold- Returns:
- The builder
-
timeThresholdMs
Set theAbrConfiguration.timeThresholdMs
- Parameters:
timeThresholdMs
- The timeThresholdMs- Returns:
- The builder
-
minSampledBytes
Set theAbrConfiguration.minSampledBytes
- Parameters:
minSampledBytes
- The minSampledBytes- Returns:
- The builder
-
degradationRecovery
- Parameters:
degradationRecovery
- The recovery value- Returns:
- The builder
-
degradationPenalty
- Parameters:
degradationPenalty
- The penalty value- Returns:
- The builder
-
minDegradationSamples
- Parameters:
minDegradationSamples
- The penalty value- Returns:
- The builder
-
useCMSD
- Parameters:
value
- whether to enable CMSD parsing- Returns:
- The builder
-
get
Get the ABR configuration created by this builder- Returns:
- The ABR configuration
-