Skip to content

Commit

Permalink
Improve the AbandonRequestsRule.js by using traces from progress even…
Browse files Browse the repository at this point in the history
…t. Also allow configuration of relevant parameters via settings. (#4369)
  • Loading branch information
dsilhavy authored Jan 25, 2024
1 parent 894d80a commit 19ddc54
Show file tree
Hide file tree
Showing 12 changed files with 426 additions and 232 deletions.
34 changes: 25 additions & 9 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1176,15 +1176,31 @@ declare namespace dashjs {
abr?: {
limitBitrateByPortal?: boolean;
usePixelRatioInLimitBitrateByPortal?: boolean;
activeRules?: {
throughputRule?: boolean,
bolaRule?: boolean,
insufficientBufferRule?: boolean,
switchHistoryRule?: boolean,
droppedFramesRule?: boolean,
abandonRequestsRule?: boolean
l2ARule?: boolean
loLPRule?: boolean
rules?: {
throughputRule?: {
active?: boolean
},
bolaRule?: {
active?: boolean
},
insufficientBufferRule?: {
active?: boolean
},
switchHistoryRule?: {
active?: boolean
},
droppedFramesRule?: {
active?: boolean
},
abandonRequestsRule?: {
active?: boolean
}
l2ARule?: {
active?: boolean
}
loLPRule?: {
active?: boolean
}
},
throughput?: {
averageCalculationMode?: ThroughputCalculationModes,
Expand Down
26 changes: 19 additions & 7 deletions samples/abr/abr.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,25 @@
player.updateSettings({
streaming: {
abr: {
activeRules: {
throughputRule: true,
bolaRule: false,
insufficientBufferRule: true,
switchHistoryRule: false,
droppedFramesRule: false,
abandonRequestsRule: false
rules: {
throughputRule: {
active: true
} ,
bolaRule: {
active: false
},
insufficientBufferRule: {
active: true
},
switchHistoryRule: {
active: false
},
droppedFramesRule: {
active: false
},
abandonRequestsRule: {
active: false
}
}
}
}
Expand Down
24 changes: 18 additions & 6 deletions samples/abr/custom-abr-rules.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,24 @@
player.updateSettings({
abr: {
activeRules: {
throughputRule: false,
bolaRule: false,
insufficientBufferRule: false,
switchHistoryRule: false,
droppedFramesRule: false,
abandonRequestsRule: false
throughputRule: {
active: false
},
bolaRule: {
active: false
},
insufficientBufferRule: {
active: false
},
switchHistoryRule: {
active: false
},
droppedFramesRule: {
active: false
},
abandonRequestsRule: {
active: false
}
}
}
});
Expand Down
50 changes: 33 additions & 17 deletions samples/dash-if-reference-player/app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -574,15 +574,31 @@ app.controller('DashController', ['$scope', '$window', 'sources', 'contributors'
$scope.player.updateSettings({
streaming: {
abr: {
activeRules: {
throughputRule: $scope.activeAbrRules.throughputRule,
bolaRule: $scope.activeAbrRules.bolaRule,
insufficientBufferRule: $scope.activeAbrRules.insufficientBufferRule,
switchHistoryRule: $scope.activeAbrRules.switchHistoryRule,
droppedFramesRule: $scope.activeAbrRules.droppedFramesRule,
abandonRequestsRule: $scope.activeAbrRules.abandonRequestsRule,
l2ARule: $scope.activeAbrRules.l2ARule,
loLPRule: $scope.activeAbrRules.loLPRule,
rules: {
throughputRule: {
active: $scope.activeAbrRules.throughputRule
},
bolaRule: {
active: $scope.activeAbrRules.bolaRule
},
insufficientBufferRule: {
active: $scope.activeAbrRules.insufficientBufferRule,
},
switchHistoryRule: {
active: $scope.activeAbrRules.switchHistoryRule
},
droppedFramesRule: {
active: $scope.activeAbrRules.droppedFramesRule
},
abandonRequestsRule: {
active: $scope.activeAbrRules.abandonRequestsRule
},
l2ARule: {
active: $scope.activeAbrRules.l2ARule
},
loLPRule: {
active: $scope.activeAbrRules.loLPRule
}
}
}
}
Expand Down Expand Up @@ -2071,14 +2087,14 @@ app.controller('DashController', ['$scope', '$window', 'sources', 'contributors'

function setAbrRules() {
var currentConfig = $scope.player.getSettings();
$scope.activeAbrRules.throughputRule = currentConfig.streaming.abr.activeRules.throughputRule;
$scope.activeAbrRules.bolaRule = currentConfig.streaming.abr.activeRules.bolaRule;
$scope.activeAbrRules.insufficientBufferRule = currentConfig.streaming.abr.activeRules.insufficientBufferRule;
$scope.activeAbrRules.switchHistoryRule = currentConfig.streaming.abr.activeRules.switchHistoryRule;
$scope.activeAbrRules.droppedFramesRule = currentConfig.streaming.abr.activeRules.droppedFramesRule;
$scope.activeAbrRules.abandonRequestsRule = currentConfig.streaming.abr.activeRules.abandonRequestsRule;
$scope.activeAbrRules.loLPRule = currentConfig.streaming.abr.activeRules.loLPRule;
$scope.activeAbrRules.l2ARule = currentConfig.streaming.abr.activeRules.l2ARule;
$scope.activeAbrRules.throughputRule = currentConfig.streaming.abr.rules.throughputRule.active;
$scope.activeAbrRules.bolaRule = currentConfig.streaming.abr.rules.bolaRule.active;
$scope.activeAbrRules.insufficientBufferRule = currentConfig.streaming.abr.rules.insufficientBufferRule.active;
$scope.activeAbrRules.switchHistoryRule = currentConfig.streaming.abr.rules.switchHistoryRule.active;
$scope.activeAbrRules.droppedFramesRule = currentConfig.streaming.abr.rules.droppedFramesRule.active;
$scope.activeAbrRules.abandonRequestsRule = currentConfig.streaming.abr.rules.abandonRequestsRule.active;
$scope.activeAbrRules.loLPRule = currentConfig.streaming.abr.rules.loLPRule.active;
$scope.activeAbrRules.l2ARule = currentConfig.streaming.abr.rules.l2ARule.active;
}

function setAdditionalPlaybackOptions() {
Expand Down
34 changes: 25 additions & 9 deletions samples/low-latency/testplayer/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,31 @@ App.prototype._applyParameters = function () {
mode: settings.catchupMechanism
},
abr: {
activeRules: {
throughputRule: settings.abrThroughputRule,
bolaRule: settings.abrBolaRule,
insufficientBufferRule: settings.abrInsufficientBufferRule,
switchHistoryRule: settings.abrSwitchHistoryRule,
droppedFramesRule: settings.abrDroppedFramesRule,
abandonRequestsRule: settings.abrAbandonRequestRule,
l2ARule: settings.abrL2ARule,
loLPRule: settings.abrLoLPRule,
rules: {
throughputRule: {
active: settings.abrThroughputRule
},
bolaRule: {
active: settings.abrBolaRule
},
insufficientBufferRule: {
active: settings.abrInsufficientBufferRule
},
switchHistoryRule: {
active: settings.abrSwitchHistoryRule
},
droppedFramesRule: {
active: settings.abrDroppedFramesRule
},
abandonRequestsRule: {
active: settings.abrAbandonRequestRule
},
l2ARule: {
active: settings.abrL2ARule
},
loLPRule: {
active: settings.abrLoLPRule
},
},
throughput: {
averageCalculationMode: settings.throughputEstimation,
Expand Down
92 changes: 65 additions & 27 deletions src/core/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,32 @@ import Events from './events/Events.js';
* abr: {
* limitBitrateByPortal: false,
* usePixelRatioInLimitBitrateByPortal: false,
* activeRules: {
* throughputRule: true,
* bolaRule: true,
* insufficientBufferRule: true,
* switchHistoryRule: true,
* droppedFramesRule: true,
* abandonRequestsRule: true,
* l2ARule: false,
* loLPRule: false
* rules: {
* throughputRule: {
* active: true
* },
* bolaRule: {
* active: true
* },
* insufficientBufferRule: {
* active: true
* },
* switchHistoryRule: {
* active: true
* },
* droppedFramesRule: {
* active: true
* },
* abandonRequestsRule: {
* active: true
* },
* l2ARule: {
* active: false
* },
* loLPRule: {
* active: false
* }
*
* },
* throughput: {
* averageCalculationMode: Constants.THROUGHPUT_CALCULATION_MODES.EWMA,
Expand Down Expand Up @@ -607,7 +624,7 @@ import Events from './events/Events.js';
* Sets whether to take into account the device's pixel ratio when defining the portal dimensions.
*
* Useful on, for example, retina displays.
* @property {object} [activeRules={throughputRule: true, bolaRule: true, insufficientBufferRule: true,switchHistoryRule: true,droppedFramesRule: true,abandonRequestsRule: true, l2ARule: false, loLPRule: false}]
* @property {object} [activeRules={throughputRule: {active: true}, bolaRule: {active: true}, insufficientBufferRule: {active: true},switchHistoryRule: {active: true},droppedFramesRule: {active: true},abandonRequestsRule: {active: true}, l2ARule: {active: false}, loLPRule: {active: false}}]
* Enable/Disable individual ABR rules. Note that if the throughputRule and the bolaRule are activated at the same time we switch to a dynamic mode.
* In the dynamic mode either ThroughputRule or BolaRule are active but not both at the same time.
*
Expand Down Expand Up @@ -851,14 +868,14 @@ function Settings() {
'streaming.liveCatchup.enabled': Events.SETTING_UPDATED_CATCHUP_ENABLED,
'streaming.liveCatchup.playbackRate.min': Events.SETTING_UPDATED_PLAYBACK_RATE_MIN,
'streaming.liveCatchup.playbackRate.max': Events.SETTING_UPDATED_PLAYBACK_RATE_MAX,
'streaming.abr.activeRules.throughputRule': Events.SETTING_UPDATED_ABR_ACTIVE_RULES,
'streaming.abr.activeRules.bolaRule': Events.SETTING_UPDATED_ABR_ACTIVE_RULES,
'streaming.abr.activeRules.insufficientBufferRule': Events.SETTING_UPDATED_ABR_ACTIVE_RULES,
'streaming.abr.activeRules.switchHistoryRule': Events.SETTING_UPDATED_ABR_ACTIVE_RULES,
'streaming.abr.activeRules.droppedFramesRule': Events.SETTING_UPDATED_ABR_ACTIVE_RULES,
'streaming.abr.activeRules.abandonRequestsRule': Events.SETTING_UPDATED_ABR_ACTIVE_RULES,
'streaming.abr.activeRules.l2ARule': Events.SETTING_UPDATED_ABR_ACTIVE_RULES,
'streaming.abr.activeRules.loLPRule': Events.SETTING_UPDATED_ABR_ACTIVE_RULES,
'streaming.abr.rules.throughputRule.active': Events.SETTING_UPDATED_ABR_ACTIVE_RULES,
'streaming.abr.rules.bolaRule.active': Events.SETTING_UPDATED_ABR_ACTIVE_RULES,
'streaming.abr.rules.insufficientBufferRule.active': Events.SETTING_UPDATED_ABR_ACTIVE_RULES,
'streaming.abr.rules.switchHistoryRule.active': Events.SETTING_UPDATED_ABR_ACTIVE_RULES,
'streaming.abr.rules.droppedFramesRule.active': Events.SETTING_UPDATED_ABR_ACTIVE_RULES,
'streaming.abr.rules.abandonRequestsRule.active': Events.SETTING_UPDATED_ABR_ACTIVE_RULES,
'streaming.abr.rules.l2ARule.active': Events.SETTING_UPDATED_ABR_ACTIVE_RULES,
'streaming.abr.rules.loLPRule.active': Events.SETTING_UPDATED_ABR_ACTIVE_RULES,
};

/**
Expand Down Expand Up @@ -1016,15 +1033,36 @@ function Settings() {
limitBitrateByPortal: false,
usePixelRatioInLimitBitrateByPortal: false,
enableSupplementalPropertyAdaptationSetSwitching: true,
activeRules: {
throughputRule: true,
bolaRule: true,
insufficientBufferRule: true,
switchHistoryRule: true,
droppedFramesRule: true,
abandonRequestsRule: true,
l2ARule: false,
loLPRule: false
rules: {
throughputRule: {
active: true
},
bolaRule: {
active: true
},
insufficientBufferRule: {
active: true
},
switchHistoryRule: {
active: true
},
droppedFramesRule: {
active: true
},
abandonRequestsRule: {
active: true,
parameters: {
abandonDurationMultiplier: 1.8,
minSegmentDownloadTimeThresholdInMs: 500,
minThroughputSamplesThreshold: 6
}
},
l2ARule: {
active: false
},
loLPRule: {
active: false
}
},
throughput: {
averageCalculationMode: Constants.THROUGHPUT_CALCULATION_MODES.EWMA,
Expand Down
4 changes: 2 additions & 2 deletions src/streaming/controllers/AbrController.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function AbrController() {
// Do not change current value if it has been set before
const currentState = abrRulesCollection.getBolaState(type)
if (currentState === undefined) {
abrRulesCollection.setBolaState(type, settings.get().streaming.abr.activeRules.bolaRule && !_shouldApplyDynamicAbrStrategy());
abrRulesCollection.setBolaState(type, settings.get().streaming.abr.rules.bolaRule.active && !_shouldApplyDynamicAbrStrategy());
}

}
Expand Down Expand Up @@ -720,7 +720,7 @@ function AbrController() {
* @private
*/
function _shouldApplyDynamicAbrStrategy() {
return settings.get().streaming.abr.activeRules.bolaRule && settings.get().streaming.abr.activeRules.throughputRule
return settings.get().streaming.abr.rules.bolaRule.active && settings.get().streaming.abr.rules.throughputRule.active
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/streaming/controllers/ThroughputController.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function ThroughputController() {
}

/**
* Push new values to the throughput model once a HTTP request completed
* Push new values to the throughput model once an HTTP request completed
* @param {object} e
* @private
*/
Expand Down
Loading

0 comments on commit 19ddc54

Please sign in to comment.