mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Remove ability to extend the default FormatEvaluator implementations.
This commit is contained in:
parent
9f77c4009e
commit
861d6749ef
1 changed files with 6 additions and 13 deletions
|
|
@ -84,7 +84,7 @@ public interface FormatEvaluator {
|
||||||
/**
|
/**
|
||||||
* Always selects the first format.
|
* Always selects the first format.
|
||||||
*/
|
*/
|
||||||
public static class FixedEvaluator implements FormatEvaluator {
|
public static final class FixedEvaluator implements FormatEvaluator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enable() {
|
public void enable() {
|
||||||
|
|
@ -107,7 +107,7 @@ public interface FormatEvaluator {
|
||||||
/**
|
/**
|
||||||
* Selects randomly between the available formats.
|
* Selects randomly between the available formats.
|
||||||
*/
|
*/
|
||||||
public static class RandomEvaluator implements FormatEvaluator {
|
public static final class RandomEvaluator implements FormatEvaluator {
|
||||||
|
|
||||||
private final Random random;
|
private final Random random;
|
||||||
|
|
||||||
|
|
@ -145,7 +145,7 @@ public interface FormatEvaluator {
|
||||||
* reference implementation only. It is recommended that application developers implement their
|
* reference implementation only. It is recommended that application developers implement their
|
||||||
* own adaptive evaluator to more precisely suit their use case.
|
* own adaptive evaluator to more precisely suit their use case.
|
||||||
*/
|
*/
|
||||||
public static class AdaptiveEvaluator implements FormatEvaluator {
|
public static final class AdaptiveEvaluator implements FormatEvaluator {
|
||||||
|
|
||||||
public static final int DEFAULT_MAX_INITIAL_BITRATE = 800000;
|
public static final int DEFAULT_MAX_INITIAL_BITRATE = 800000;
|
||||||
|
|
||||||
|
|
@ -259,8 +259,9 @@ public interface FormatEvaluator {
|
||||||
/**
|
/**
|
||||||
* Compute the ideal format ignoring buffer health.
|
* Compute the ideal format ignoring buffer health.
|
||||||
*/
|
*/
|
||||||
protected Format determineIdealFormat(Format[] formats, long bitrateEstimate) {
|
private Format determineIdealFormat(Format[] formats, long bitrateEstimate) {
|
||||||
long effectiveBitrate = computeEffectiveBitrateEstimate(bitrateEstimate);
|
long effectiveBitrate = bitrateEstimate == BandwidthMeter.NO_ESTIMATE
|
||||||
|
? maxInitialBitrate : (long) (bitrateEstimate * bandwidthFraction);
|
||||||
for (int i = 0; i < formats.length; i++) {
|
for (int i = 0; i < formats.length; i++) {
|
||||||
Format format = formats[i];
|
Format format = formats[i];
|
||||||
if (format.bitrate <= effectiveBitrate) {
|
if (format.bitrate <= effectiveBitrate) {
|
||||||
|
|
@ -271,14 +272,6 @@ public interface FormatEvaluator {
|
||||||
return formats[formats.length - 1];
|
return formats[formats.length - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Apply overhead factor, or default value in absence of estimate.
|
|
||||||
*/
|
|
||||||
protected long computeEffectiveBitrateEstimate(long bitrateEstimate) {
|
|
||||||
return bitrateEstimate == BandwidthMeter.NO_ESTIMATE
|
|
||||||
? maxInitialBitrate : (long) (bitrateEstimate * bandwidthFraction);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue