Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/development' into feature/multiB…
Browse files Browse the repository at this point in the history
…uild
  • Loading branch information
dsilhavy committed Jan 20, 2025
2 parents 0c67a43 + c5320b5 commit d2a47b3
Show file tree
Hide file tree
Showing 15 changed files with 2,581 additions and 1,758 deletions.
3,948 changes: 2,494 additions & 1,454 deletions index.d.ts

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions samples/abr/LowestBitrateRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ function LowestBitrateRuleClass() {
let factory = dashjs.FactoryMaker;
let SwitchRequest = factory.getClassFactoryByName('SwitchRequest');
let MetricsModel = factory.getSingletonFactoryByName('MetricsModel');
let StreamController = factory.getSingletonFactoryByName('StreamController');
let context = this.context;
let instance;

Expand All @@ -56,18 +55,18 @@ function LowestBitrateRuleClass() {
console.log(metrics);

// Get current bitrate
let streamController = StreamController(context).getInstance();
let abrController = rulesContext.getAbrController();
let current = abrController.getQualityFor(mediaType, streamController.getActiveStreamInfo().id);

const abrController = rulesContext.getAbrController();
const representation = rulesContext.getRepresentation();
// If already in lowest bitrate, don't do anything
if (current === 0) {
if (abrController.isPlayingAtLowestQuality(representation)) {
return SwitchRequest(context).create();
}

// Ask to switch to the lowest bitrate
const mediaInfo = rulesContext.getMediaInfo();
const newRepresentation = abrController.getOptimalRepresentationForBitrate(mediaInfo, 0, true);
let switchRequest = SwitchRequest(context).create();
switchRequest.quality = 0;
switchRequest.representation = newRepresentation;
switchRequest.reason = 'Always switching to the lowest bitrate';
switchRequest.priority = SwitchRequest.PRIORITY.STRONG;
return switchRequest;
Expand Down
44 changes: 23 additions & 21 deletions samples/abr/custom-abr-rules.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,34 @@
function init() {
var video,
player,
url = "https://dash.akamaized.net/akamai/bbb_30fps/bbb_30fps.mpd";
url = 'https://dash.akamaized.net/akamai/bbb_30fps/bbb_30fps.mpd';

video = document.querySelector("video");
video = document.querySelector('video');
player = dashjs.MediaPlayer().create();

/* don't use dash.js default rules */
player.updateSettings({
abr: {
activeRules: {
throughputRule: {
active: false
},
bolaRule: {
active: false
},
insufficientBufferRule: {
active: false
},
switchHistoryRule: {
active: false
},
droppedFramesRule: {
active: false
},
abandonRequestsRule: {
active: false
streaming: {
abr: {
rules: {
throughputRule: {
active: false
},
bolaRule: {
active: false
},
insufficientBufferRule: {
active: false
},
switchHistoryRule: {
active: false
},
droppedFramesRule: {
active: false
},
abandonRequestsRule: {
active: false
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions samples/advanced/monitoring.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@

if (dashMetrics && streamInfo) {
const periodIdx = streamInfo.index;
var repSwitch = dashMetrics.getCurrentRepresentationSwitch('video', true);
var bufferLevel = dashMetrics.getCurrentBufferLevel('video', true);
var repSwitch = dashMetrics.getCurrentRepresentationSwitch('video');
var bufferLevel = dashMetrics.getCurrentBufferLevel('video');
var bitrate = repSwitch ? Math.round(dashAdapter.getBandwidthForRepresentation(repSwitch.to, periodIdx) / 1000) : NaN;
var currentRep = player.getCurrentRepresentationForType('video');
var frameRate = currentRep.frameRate;
Expand Down
202 changes: 0 additions & 202 deletions samples/dash-if-reference-player/app/rules/DownloadRatioRule.js

This file was deleted.

1 change: 0 additions & 1 deletion samples/dash-if-reference-player/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
<script src="../../contrib/akamai/controlbar/ControlBar.js"></script>
<script src="app/src/cast.js"></script>
<script src="app/main.js"></script>
<script src="app/rules/DownloadRatioRule.js"></script>
<script src="app/rules/ThroughputRule.js"></script>

<!-- Google Cast -->
Expand Down
4 changes: 2 additions & 2 deletions src/dash/vo/ClientDataReporting.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
*/
class ClientDataReporting {
constructor() {
this.adaptationSets = null;
this.adaptationSetsArray = [];
this.cmcdParameters = null;
this.serviceLocations = null;
this.serviceLocationsArray = [];
this.adaptationSets = null;
this.adaptationSetsArray = [];
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/dash/vo/Mpd.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@
*/
class Mpd {
constructor() {
this.manifest = null;
this.suggestedPresentationDelay = 0;
this.availabilityStartTime = null;
this.availabilityEndTime = Number.POSITIVE_INFINITY;
this.timeShiftBufferDepth = Number.POSITIVE_INFINITY;
this.availabilityStartTime = null;
this.manifest = null;
this.maxSegmentDuration = Number.POSITIVE_INFINITY;
this.publishTime = null;
this.minimumUpdatePeriod = NaN;
this.mediaPresentationDuration = NaN;
this.minimumUpdatePeriod = NaN;
this.publishTime = null;
this.suggestedPresentationDelay = 0;
this.timeShiftBufferDepth = Number.POSITIVE_INFINITY;
}
}

Expand Down
25 changes: 12 additions & 13 deletions src/dash/vo/Segment.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,28 @@
*/
class Segment {
constructor() {
this.indexRange = null;
// Ignore and discard this segment after
this.availabilityEndTime = NaN;
// Do not schedule this segment until
this.availabilityStartTime = NaN;
this.duration = NaN;
// The index of the segment in the list of segments. We start at 0
this.index = null;
this.mediaRange = null;
this.indexRange = null;
this.media = null;
this.duration = NaN;
// this is the time that should be inserted into the media url
this.replacementTime = null;
// this is the number that should be inserted into the media url
this.replacementNumber = NaN;
this.mediaRange = null;
// This is supposed to match the time encoded in the media Segment
this.mediaStartTime = NaN;
// When the source buffer timeOffset is set to mseTimeOffset this is the
// time that will match the seekTarget and video.currentTime
this.presentationStartTime = NaN;
// Do not schedule this segment until
this.availabilityStartTime = NaN;
// Ignore and discard this segment after
this.availabilityEndTime = NaN;
// this is the number that should be inserted into the media url
this.replacementNumber = NaN;
// this is the time that should be inserted into the media url
this.replacementTime = null;
this.representation = null;
// For dynamic mpd's, this is the wall clock time that the video
// element currentTime should be presentationStartTime
this.wallStartTime = NaN;
this.representation = null;
}
}

Expand Down
Loading

0 comments on commit d2a47b3

Please sign in to comment.