Skip to content

Commit 80cb263

Browse files
authored
dvb:probability is 1000 by default and refactor (#3414)
1 parent b0e188f commit 80cb263

File tree

5 files changed

+28
-11
lines changed

5 files changed

+28
-11
lines changed

src/streaming/constants/Constants.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ class Constants {
212212
this.SUPPLEMENTAL_PROPERTY_LL_SCHEME = 'urn:dvb:dash:lowlatency:critical:2019';
213213
this.XML = 'XML';
214214
this.ARRAY_BUFFER = 'ArrayBuffer';
215+
this.DVB_REPORTING_URL = 'dvb:reportingUrl';
216+
this.DVB_PROBABILITY = 'dvb:probability';
215217
}
216218

217219
constructor () {

src/streaming/metrics/reporting/reporters/DVBReporting.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ function DVBReporting(config) {
137137

138138
rangeController = rc;
139139

140-
reportingUrl = entry['dvb:reportingUrl'];
140+
reportingUrl = entry.dvb_reportingUrl;
141141

142142
// If a required attribute is missing, the Reporting descriptor may
143143
// be ignored by the Player
@@ -151,11 +151,10 @@ function DVBReporting(config) {
151151
// static for the duration of the MPD, regardless of MPD updates.
152152
// (i.e. only calling reset (or failure) changes this state)
153153
if (!reportingPlayerStatusDecided) {
154-
// NOTE: DVB spec has a typo where it incorrectly references the
155-
// priority attribute, which should be probability
156-
probability = entry['dvb:probability'] || entry['dvb:priority'] || 0;
157-
// If the @priority attribute is set to 1000, it shall be a reporting Player.
158-
// If the @priority attribute is missing, the Player shall not be a reporting Player.
154+
probability = entry.dvb_probability;
155+
// TS 103 285 Clause 10.12.3.4
156+
// If the @probability attribute is set to 1000, it shall be a reporting Player.
157+
// If the @probability attribute is absent it will take the default value of 1000.
159158
// For any other value of the @probability attribute, it shall decide at random whether to be a
160159
// reporting Player, such that the probability of being one is @probability/1000.
161160
if (probability && (probability === 1000 || ((probability / 1000) >= randomNumberGenerator.random()))) {

src/streaming/metrics/utils/ManifestParsing.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,16 @@ function ManifestParsing (config) {
8888
return;
8989
}
9090

91-
for (const prop in reporting) {
92-
if (reporting.hasOwnProperty(prop)) {
93-
reportingEntry[prop] = reporting[prop];
94-
}
91+
if (reporting.hasOwnProperty('value')) {
92+
reportingEntry.value = reporting.value;
93+
}
94+
95+
if (reporting.hasOwnProperty(constants.DVB_REPORTING_URL)) {
96+
reportingEntry.dvb_reportingUrl = reporting[constants.DVB_REPORTING_URL];
97+
}
98+
99+
if (reporting.hasOwnProperty(constants.DVB_PROBABILITY)) {
100+
reportingEntry.dvb_probability = reporting[constants.DVB_PROBABILITY];
95101
}
96102

97103
metricEntry.Reporting.push(reportingEntry);

src/streaming/metrics/vo/Reporting.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,19 @@
3232
* @class
3333
* @ignore
3434
*/
35+
36+
// TS 103 285 Clause 10.12.3.3
37+
const DEFAULT_DVB_PROBABILITY = 1000;
38+
3539
class Reporting {
3640
constructor() {
37-
// Reporting is a DescriptorType and doesn't have any additional fields
41+
3842
this.schemeIdUri = '';
3943
this.value = '';
44+
45+
// DVB Extensions
46+
this.dvb_reportingUrl = '';
47+
this.dvb_probability = DEFAULT_DVB_PROBABILITY;
4048
}
4149
}
4250

test/unit/streaming.constants.Constants.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,7 @@ describe('Constants', function () {
2727
expect(Constants.START_TIME).to.equal('starttime');
2828
expect(Constants.BAD_ARGUMENT_ERROR).to.equal('Invalid Arguments');
2929
expect(Constants.MISSING_CONFIG_ERROR).to.equal('Missing config parameter(s)');
30+
expect(Constants.DVB_REPORTING_URL).to.equal('dvb:reportingUrl');
31+
expect(Constants.DVB_PROBABILITY).to.equal('dvb:probability');
3032
});
3133
});

0 commit comments

Comments
 (0)