Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dvb:probability should be 1000 by default #3414

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/streaming/constants/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ class Constants {
this.SUPPLEMENTAL_PROPERTY_LL_SCHEME = 'urn:dvb:dash:lowlatency:critical:2019';
this.XML = 'XML';
this.ARRAY_BUFFER = 'ArrayBuffer';
this.DVB_REPORTING_URL = 'dvb:reportingUrl';
this.DVB_PROBABILITY = 'dvb:probability';
}

constructor () {
Expand Down
11 changes: 5 additions & 6 deletions src/streaming/metrics/reporting/reporters/DVBReporting.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function DVBReporting(config) {

rangeController = rc;

reportingUrl = entry['dvb:reportingUrl'];
reportingUrl = entry.dvb_reportingUrl;

// If a required attribute is missing, the Reporting descriptor may
// be ignored by the Player
Expand All @@ -151,11 +151,10 @@ function DVBReporting(config) {
// static for the duration of the MPD, regardless of MPD updates.
// (i.e. only calling reset (or failure) changes this state)
if (!reportingPlayerStatusDecided) {
// NOTE: DVB spec has a typo where it incorrectly references the
// priority attribute, which should be probability
probability = entry['dvb:probability'] || entry['dvb:priority'] || 0;
// If the @priority attribute is set to 1000, it shall be a reporting Player.
// If the @priority attribute is missing, the Player shall not be a reporting Player.
probability = entry.dvb_probability;
// TS 103 285 Clause 10.12.3.4
// If the @probability attribute is set to 1000, it shall be a reporting Player.
// If the @probability attribute is absent it will take the default value of 1000.
// For any other value of the @probability attribute, it shall decide at random whether to be a
// reporting Player, such that the probability of being one is @probability/1000.
if (probability && (probability === 1000 || ((probability / 1000) >= randomNumberGenerator.random()))) {
Expand Down
14 changes: 10 additions & 4 deletions src/streaming/metrics/utils/ManifestParsing.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,16 @@ function ManifestParsing (config) {
return;
}

for (const prop in reporting) {
if (reporting.hasOwnProperty(prop)) {
reportingEntry[prop] = reporting[prop];
}
dsilhavy marked this conversation as resolved.
Show resolved Hide resolved
if (reporting.hasOwnProperty('value')) {
reportingEntry.value = reporting.value;
}

if (reporting.hasOwnProperty(constants.DVB_REPORTING_URL)) {
reportingEntry.dvb_reportingUrl = reporting[constants.DVB_REPORTING_URL];
dsilhavy marked this conversation as resolved.
Show resolved Hide resolved
}

if (reporting.hasOwnProperty(constants.DVB_PROBABILITY)) {
reportingEntry.dvb_probability = reporting[constants.DVB_PROBABILITY];
dsilhavy marked this conversation as resolved.
Show resolved Hide resolved
}

metricEntry.Reporting.push(reportingEntry);
Expand Down
10 changes: 9 additions & 1 deletion src/streaming/metrics/vo/Reporting.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,19 @@
* @class
* @ignore
*/

// TS 103 285 Clause 10.12.3.3
const DEFAULT_DVB_PROBABILITY = 1000;

class Reporting {
constructor() {
// Reporting is a DescriptorType and doesn't have any additional fields

this.schemeIdUri = '';
this.value = '';

// DVB Extensions
this.dvb_reportingUrl = '';
this.dvb_probability = DEFAULT_DVB_PROBABILITY;
}
}

Expand Down
2 changes: 2 additions & 0 deletions test/unit/streaming.constants.Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@ describe('Constants', function () {
expect(Constants.START_TIME).to.equal('starttime');
expect(Constants.BAD_ARGUMENT_ERROR).to.equal('Invalid Arguments');
expect(Constants.MISSING_CONFIG_ERROR).to.equal('Missing config parameter(s)');
expect(Constants.DVB_REPORTING_URL).to.equal('dvb:reportingUrl');
expect(Constants.DVB_PROBABILITY).to.equal('dvb:probability');
});
});