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
Feature/cmcd settings from mpd and steering report #4426
Changes from 65 commits
8447cb9
d8c3f47
b7994ee
a00f92e
590983f
b9039d5
5548427
28da772
ef3bfec
f027244
955dd7c
35552e1
4d8d528
08820b4
4b30d4a
2f378f0
cbf7bf9
9a2f677
ac55e3e
decb474
f736da2
f25c0b1
9aa67c0
e92571c
9be23b9
eeab520
e4d2f1c
13bbcbf
5ba262f
217bd75
ce110e5
5767a2b
664d0a6
0722581
258fcbb
0d5e391
8f52602
0a6a9c4
7d79c0b
1e0413c
4a9f236
0a7ad7e
27848c1
59263c6
9476750
394a7c9
e94e21b
1e97abb
7333104
6abee3e
87eb117
e1e652a
e862edd
e65fa09
3542d5b
884d79e
81950ca
a219855
cad2ada
697a5b7
624d60a
7d85be5
02e4716
17bc745
898eca2
acba39c
ecd8f75
97f616b
832630c
add7119
0e38da3
d5441f9
f217eee
4a01071
c246685
e4007c3
4cd0140
5491c81
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,7 +80,8 @@ function ServiceDescriptionController() { | |
minBitrate: {}, | ||
maxBitrate: {}, | ||
initialBitrate: {}, | ||
contentSteering: null | ||
contentSteering: null, | ||
clientDataReporting: null, | ||
}; | ||
prftOffsets = []; | ||
} | ||
|
@@ -128,6 +129,10 @@ function ServiceDescriptionController() { | |
if (sd.contentSteering) { | ||
_applyServiceDescriptionContentSteering(sd); | ||
} | ||
|
||
if (sd.clientDataReporting) { | ||
_applyServiceDescriptionClientDataReporting(sd); | ||
} | ||
} | ||
|
||
/** | ||
|
@@ -293,6 +298,15 @@ function ServiceDescriptionController() { | |
serviceDescriptionSettings.contentSteering = sd.contentSteering; | ||
} | ||
|
||
/** | ||
* Add information about client data reporting element. Handling is up to the ContentSteeringController | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handling is up to the |
||
* @param {object} sd | ||
* @private | ||
*/ | ||
function _applyServiceDescriptionClientDataReporting(sd) { | ||
serviceDescriptionSettings.clientDataReporting = sd.clientDataReporting; | ||
} | ||
|
||
/** | ||
* Returns the current calculated time offsets based on ProducerReferenceTime elements | ||
* @returns {array} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,7 @@ import Errors from '../../core/errors/Errors.js'; | |
import MpdLocation from '../vo/MpdLocation.js'; | ||
import PatchLocation from '../vo/PatchLocation.js'; | ||
import ContentProtection from '../vo/ContentProtection.js'; | ||
import ClientDataReporting from '../vo/ClientDataReporting.js'; | ||
|
||
function DashManifestModel() { | ||
let instance, | ||
|
@@ -1255,6 +1256,26 @@ function DashManifestModel() { | |
return entry; | ||
} | ||
|
||
function _createClientDataResportingInstance(element){ | ||
dsilhavy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const entry = new ClientDataReporting(); | ||
|
||
if (element.hasOwnProperty(DashConstants.CMCD_PARAMETERS)) { | ||
entry.CMCDParameters = element[DashConstants.CMCD_PARAMETERS]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See other comment for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dsilhavy Here is where I think I didn't understand your previous comment about creating a dedicated model class for Let me see if I'm understanding what you are saying:
I already created the class in my latest changes, so I have to put the checks for the mandatory fields now. |
||
} | ||
|
||
if (element.hasOwnProperty(DashConstants.SERVICE_LOCATIONS) && element[DashConstants.SERVICE_LOCATIONS] !== ''){ | ||
entry.serviceLocations = element[DashConstants.SERVICE_LOCATIONS]; | ||
entry.serviceLocationsArray = entry.serviceLocations.toString().split(' '); | ||
} | ||
|
||
if (element.hasOwnProperty(DashConstants.ADAPTATION_SETS) && element[DashConstants.ADAPTATION_SETS] !== ''){ | ||
entry.adaptationSets = element[DashConstants.ADAPTATION_SETS]; | ||
entry.adaptationSetsArray = entry.adaptationSets.toString().split(' '); | ||
} | ||
|
||
return entry; | ||
} | ||
|
||
function getLocation(manifest) { | ||
if (manifest && manifest.hasOwnProperty(DashConstants.LOCATION)) { | ||
return manifest[DashConstants.LOCATION].map((entry) => { | ||
|
@@ -1301,7 +1322,8 @@ function DashManifestModel() { | |
playbackRate = null, | ||
operatingQuality = null, | ||
operatingBandwidth = null, | ||
contentSteering = null; | ||
contentSteering = null, | ||
clientDataReporting = null; | ||
|
||
for (const prop in sd) { | ||
if (sd.hasOwnProperty(prop)) { | ||
|
@@ -1338,7 +1360,11 @@ function DashManifestModel() { | |
target: parseInt(sd[prop].target) | ||
} | ||
} else if (prop === DashConstants.CONTENT_STEERING) { | ||
contentSteering = _createContentSteeringInstance(sd[prop]) | ||
let element = sd[prop]; | ||
element = Array.isArray(element) ? element.at(element.length - 1) : element; | ||
contentSteering = _createContentSteeringInstance(element); | ||
} else if (prop === DashConstants.CLIENT_DATA_REPORTING) { | ||
clientDataReporting = _createClientDataResportingInstance(sd[prop]); | ||
} | ||
} | ||
} | ||
|
@@ -1350,7 +1376,8 @@ function DashManifestModel() { | |
playbackRate, | ||
operatingQuality, | ||
operatingBandwidth, | ||
contentSteering | ||
contentSteering, | ||
clientDataReporting | ||
}); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* The copyright in this software is being made available under the BSD License, | ||
* included below. This software may be subject to other third party and contributor | ||
* rights, including patent rights, and no such rights are granted under this license. | ||
* | ||
* Copyright (c) 2024, Dash Industry Forum. | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, | ||
* are permitted provided that the following conditions are met: | ||
* * Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation and/or | ||
* other materials provided with the distribution. | ||
* * Neither the name of Dash Industry Forum nor the names of its | ||
* contributors may be used to endorse or promote products derived from this software | ||
* without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY | ||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | ||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
/** | ||
* @class | ||
* @ignore | ||
*/ | ||
class ClientDataReporting { | ||
constructor() { | ||
this.CMCDParameters = null; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we make There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In addition, we might extend There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dsilhavy With the new changes that I pushed, Did I understand well? I created a |
||
this.serviceLocations = null; | ||
this.serviceLocationsArray = []; | ||
this.adaptationSets = null; | ||
this.adaptationSetsArray = []; | ||
} | ||
} | ||
|
||
export default ClientDataReporting; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -214,6 +214,22 @@ export default { | |
* @static | ||
*/ | ||
CMCD_MODE_HEADER: 'header', | ||
|
||
/** | ||
* @constant {string} CMCD_AVAILABLE_KEYS specifies all the availables keys for CDCD metrics. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo: |
||
* @memberof Constants# | ||
* @static | ||
*/ | ||
CMCD_AVAILABLE_KEYS: ['br', 'd', 'ot', 'tb', 'bl', 'dl', 'mtp', 'nor', 'nrr', 'su', 'bs', 'rtp', 'cid', 'pr', 'sf', 'sid', 'st', 'v'], | ||
|
||
/** | ||
* @constant {string} CMCD_AVAILABLE_REQUESTS specifies all the availables requests type for CDCD metrics. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo : |
||
* @memberof Constants# | ||
* @static | ||
*/ | ||
CMCD_AVAILABLE_REQUESTS: ['segment','mpd','xlink','steering'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
|
||
INITIALIZE: 'initialize', | ||
TEXT_SHOWING: 'showing', | ||
TEXT_HIDDEN: 'hidden', | ||
|
@@ -292,4 +308,3 @@ export default { | |
ID3_SCHEME_ID_URI: 'https://aomedia.org/emsg/ID3', | ||
COMMON_ACCESS_TOKEN_HEADER: 'common-access-token' | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/** | ||
* The copyright in this software is being made available under the BSD License, | ||
* included below. This software may be subject to other third party and contributor | ||
* rights, including patent rights, and no such rights are granted under this license. | ||
* | ||
* Copyright (c) 2024, Dash Industry Forum. | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, | ||
* are permitted provided that the following conditions are met: | ||
* * Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation and/or | ||
* other materials provided with the distribution. | ||
* * Neither the name of Dash Industry Forum nor the names of its | ||
* contributors may be used to endorse or promote products derived from this software | ||
* without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY | ||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | ||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
import FactoryMaker from '../../core/FactoryMaker.js'; | ||
import {HTTPRequest} from '../vo/metrics/HTTPRequest.js'; | ||
|
||
function ClientDataReportingModel() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest we call this controller instead of model to distinguish between There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dsilhavy So, you are saying that we should change There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, would be great if you can change it like this. Change |
||
|
||
let instance, | ||
serviceDescriptionController; | ||
|
||
function setConfig(config) { | ||
if (!config) return; | ||
|
||
if (config.serviceDescriptionController) { | ||
serviceDescriptionController = config.serviceDescriptionController; | ||
} | ||
} | ||
|
||
function serviceLocationIncluded(requestType, serviceLocation) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please rename to |
||
|
||
if (requestType == HTTPRequest.CONTENT_STEERING_TYPE) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use strong equality: |
||
return true; | ||
} | ||
|
||
const { serviceLocationsArray } = serviceDescriptionController?.getServiceDescriptionSettings()?.clientDataReporting ?? {}; | ||
const isServiceLocationIncluded = serviceLocationsArray ? (serviceLocationsArray?.length === 0 || serviceLocationsArray.includes(serviceLocation)) : true; | ||
return isServiceLocationIncluded; | ||
} | ||
|
||
function adaptationSetIncluded(adaptationSet) { | ||
const { adaptationSetsArray } = serviceDescriptionController?.getServiceDescriptionSettings()?.clientDataReporting ?? {}; | ||
const isAdaptationsIncluded = adaptationSetsArray ? (adaptationSetsArray?.length === 0 || adaptationSetsArray.includes(adaptationSet)) : true; | ||
return isAdaptationsIncluded; | ||
} | ||
|
||
instance = { | ||
setConfig:setConfig, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use simple syntax: setConfig,
adaptationSetIncluded,
serviceLocationIncluded, |
||
adaptationSetIncluded: adaptationSetIncluded, | ||
serviceLocationIncluded: serviceLocationIncluded, | ||
}; | ||
|
||
return instance; | ||
} | ||
|
||
ClientDataReportingModel.__dashjs_factory_name = 'ClientDataReportingModel'; | ||
export default FactoryMaker.getSingletonFactory(ClientDataReportingModel); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please adjust based on comment below for
Settings