Package com.castlabs.android.player
Class AbrConfiguration.Builder
- java.lang.Object
-
- com.castlabs.android.player.AbrConfiguration.Builder
-
- Enclosing class:
- AbrConfiguration
public static class AbrConfiguration.Builder extends Object
A builder for ABR configuration instances
-
-
Constructor Summary
Constructors Constructor Description Builder()
Builder(AbrConfiguration copy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AbrConfiguration.Builder
bandwidthFraction(float bandwidthFraction)
The fraction of the bandwidth estimation that we consider the effective bandwidth.AbrConfiguration.Builder
bytesThreshold(int bytesThreshold)
Set theAbrConfiguration.bytesThreshold
AbrConfiguration.Builder
degradationPenalty(float degradationPenalty)
AbrConfiguration.Builder
degradationRecovery(float degradationRecovery)
AbrConfiguration.Builder
downloadTimeFactor(float downloadTimeFactor)
Safety factor that is applied to download time calculationsAbrConfiguration
get()
Get the ABR configuration created by this builderAbrConfiguration.Builder
initialTrackSelection(int initialTrackSelection, boolean keepInitialSelection)
The initial track selection can be used to manually select a track by index initially, in combination withkeepInitialSelection
.AbrConfiguration.Builder
maxDurationForQualityDecrease(long maxDurationForQualityDecrease, TimeUnit unit)
The maximum amount of data that is expected to be buffered before a quality decrease is permitted.AbrConfiguration.Builder
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.AbrConfiguration.Builder
method(int method)
Select the underlying ABR method as one ofAbrConfiguration.METHOD_COMMON_NBA
,AbrConfiguration.METHOD_EXO
,AbrConfiguration.METHOD_ITERATE
, orAbrConfiguration.METHOD_FLIP
.AbrConfiguration.Builder
minDegradationSamples(int minDegradationSamples)
AbrConfiguration.Builder
minDurationForQualityIncrease(long minDurationForQualityIncrease, TimeUnit unit)
The minimum amount of that data is expected to be buffered before a quality increase is permitted.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.AbrConfiguration.Builder
minSampledBytes(long minSampledBytes)
Set theAbrConfiguration.minSampledBytes
AbrConfiguration.Builder
percentile(float percentile)
Set theAbrConfiguration.percentile
AbrConfiguration.Builder
percentileWeight(int percentileWeight)
Set the weight used for the sliding percentile bandwidth estimatorAbrConfiguration.Builder
safeBufferSize(long safeBufferSize, TimeUnit unit)
Minimum target buffer considered safe.AbrConfiguration.Builder
timeThresholdMs(int timeThresholdMs)
Set theAbrConfiguration.timeThresholdMs
-
-
-
Constructor Detail
-
Builder
public Builder()
-
Builder
public Builder(AbrConfiguration copy)
-
-
Method Detail
-
maxInitialBitrate
public AbrConfiguration.Builder 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. 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
public AbrConfiguration.Builder bandwidthFraction(float 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
public AbrConfiguration.Builder method(int 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
public AbrConfiguration.Builder safeBufferSize(long safeBufferSize, TimeUnit unit)
Minimum target buffer considered safe. Buffer below or equals this threshold results in emergency handling.- Parameters:
safeBufferSize
- timeunit
- time unit- Returns:
- The builder
-
downloadTimeFactor
public AbrConfiguration.Builder downloadTimeFactor(float downloadTimeFactor)
Safety factor that is applied to download time calculations- Parameters:
downloadTimeFactor
- download time factor- Returns:
- The builder
-
percentileWeight
public AbrConfiguration.Builder percentileWeight(int percentileWeight)
Set the weight used for the sliding percentile bandwidth estimator- Parameters:
percentileWeight
- The weight- Returns:
- The builder
-
percentile
public AbrConfiguration.Builder percentile(float percentile)
Set theAbrConfiguration.percentile
- Parameters:
percentile
- The percentile- Returns:
- The builder
-
bytesThreshold
public AbrConfiguration.Builder bytesThreshold(int bytesThreshold)
Set theAbrConfiguration.bytesThreshold
- Parameters:
bytesThreshold
- The bytesThreshold- Returns:
- The builder
-
timeThresholdMs
public AbrConfiguration.Builder timeThresholdMs(int timeThresholdMs)
Set theAbrConfiguration.timeThresholdMs
- Parameters:
timeThresholdMs
- The timeThresholdMs- Returns:
- The builder
-
minSampledBytes
public AbrConfiguration.Builder minSampledBytes(long minSampledBytes)
Set theAbrConfiguration.minSampledBytes
- Parameters:
minSampledBytes
- The minSampledBytes- Returns:
- The builder
-
degradationRecovery
public AbrConfiguration.Builder degradationRecovery(float degradationRecovery)
- Parameters:
degradationRecovery
- The recovery value- Returns:
- The builder
-
degradationPenalty
public AbrConfiguration.Builder degradationPenalty(float degradationPenalty)
- Parameters:
degradationPenalty
- The penalty value- Returns:
- The builder
-
minDegradationSamples
public AbrConfiguration.Builder minDegradationSamples(int minDegradationSamples)
- Parameters:
minDegradationSamples
- The penalty value- Returns:
- The builder
-
get
public AbrConfiguration get()
Get the ABR configuration created by this builder- Returns:
- The ABR configuration
-
-