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

Feature/cmcd settings from mpd and steering report #4426

Merged
Show file tree
Hide file tree
Changes from 69 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
8447cb9
Merge pull request #2 from Dash-Industry-Forum/development
santiagomintegui Jan 5, 2024
d8c3f47
parsing ClientDataResporting from MDP
santimintegui Jan 8, 2024
b7994ee
add applyCMCDParameters
santimintegui Jan 8, 2024
a00f92e
Using the CMCDParameters configuration under ClientDataReporting in t…
matiasrb97 Jan 8, 2024
590983f
Check if cmcd is enabled by checking mdp and player settings. Using m…
matiasrb97 Jan 9, 2024
b9039d5
apply serviceLocation filter to data reporting
santimintegui Jan 9, 2024
5548427
Send cmcd data to content steering server
matiasrb97 Jan 10, 2024
28da772
add adapter set filter
santimintegui Jan 11, 2024
ef3bfec
improve apply filters
santimintegui Jan 11, 2024
f027244
improve apply filters
santimintegui Jan 11, 2024
955dd7c
delete unnecessary atribute in client data reporting
santimintegui Jan 11, 2024
35552e1
Merge pull request #3 from qualabs/feature/cmcd-data-to-content-steering
matiasrb97 Jan 11, 2024
4d8d528
add client data reporting model
santimintegui Jan 11, 2024
08820b4
refactor client data reporting model
santimintegui Jan 12, 2024
4b30d4a
Merge branch 'feature/cmcd-content-steering-reporting' into feature/d…
santimintegui Jan 12, 2024
2f378f0
Merge pull request #4 from qualabs/feature/data-reporting-filters
santiagomintegui Jan 12, 2024
cbf7bf9
implemented include in request filter
santimintegui Jan 12, 2024
9a2f677
add none include request case
santimintegui Jan 16, 2024
ac55e3e
change segment type into filter
santimintegui Jan 16, 2024
decb474
Merge pull request #5 from qualabs/feature/include-in-request-filter
santiagomintegui Jan 16, 2024
f736da2
Add test to check if cmcd data from manifest is correct
santimintegui Jan 16, 2024
f25c0b1
delete comments
santimintegui Jan 16, 2024
9aa67c0
Update tests with latest changes for cmcd reporting data
matiasrb97 Jan 16, 2024
e92571c
Merge pull request #6 from qualabs/tests/cmcd-reporting
matiasrb97 Jan 16, 2024
9be23b9
Merge branch 'feature/cmcd-content-steering-reporting' into feature/u…
santimintegui Jan 17, 2024
eeab520
add test for getQueryParameter
santimintegui Jan 17, 2024
e4d2f1c
delete comment in streaming.models.CmcdModel.js
santiagomintegui Jan 17, 2024
13bbcbf
add test to get correctly cmcd data from getHeadersParameters()
santimintegui Jan 18, 2024
5ba262f
Adding tests for ClientDataReportingModel
matiasrb97 Jan 18, 2024
217bd75
Merge branch 'feature/unit-test-for-manifest-cmcd-data' of github.com…
matiasrb97 Jan 18, 2024
ce110e5
add test to get correctly cmcd data from getHeadersParameters()
santimintegui Jan 18, 2024
5767a2b
Merge branch 'feature/unit-test-for-manifest-cmcd-data' of github.com…
santimintegui Jan 18, 2024
664d0a6
add funcionality to service description controller mock
santimintegui Jan 18, 2024
0722581
reset serviceDescriptionControllerMock after tests run
matiasrb97 Jan 18, 2024
258fcbb
More tests added for ClientDataReportingModel
matiasrb97 Jan 18, 2024
0d5e391
Add tests for applyCMCDParameters setting
matiasrb97 Jan 18, 2024
8f52602
Merge pull request #7 from qualabs/feature/unit-test-for-manifest-cmc…
santiagomintegui Jan 19, 2024
0a6a9c4
Add includeInRequests attribute to player settings
matiasrb97 Jan 23, 2024
7d79c0b
Send latest video cmcd to content steering server
matiasrb97 Jan 23, 2024
1e0413c
Merge pull request #8 from qualabs/feature/cmcd-player-settings
N1Knight Feb 8, 2024
4a9f236
fix edge case
N1Knight Feb 8, 2024
0a7ad7e
- add logger
N1Knight Feb 9, 2024
27848c1
improve edge cases checks
N1Knight Feb 9, 2024
59263c6
fix a detail
N1Knight Feb 9, 2024
9476750
fix parsing
N1Knight Feb 13, 2024
394a7c9
fix parsing keys
N1Knight Feb 13, 2024
e94e21b
Merge pull request #9 from qualabs/feature/cmcd-steering-request-incl…
N1Knight Feb 13, 2024
1e97abb
improve error messages
N1Knight Feb 13, 2024
7333104
Merge pull request #10 from qualabs/feature/cmcd-logger-and-edge-cases
N1Knight Feb 13, 2024
6abee3e
Merge branch 'feature/cmcd-content-steering-reporting' into feature/c…
N1Knight Feb 14, 2024
87eb117
add support for audio only files
N1Knight Feb 14, 2024
e1e652a
remove unnecessary spaces
N1Knight Feb 14, 2024
e862edd
improve lastMediaTypeRequest logic
N1Knight Feb 16, 2024
e65fa09
remove unnecessary spaces
N1Knight Feb 16, 2024
3542d5b
Merge pull request #11 from qualabs/feature/cmcd-data-to-content-stee…
N1Knight Feb 16, 2024
884d79e
improve _lastMediaTypeRequest behaviour
N1Knight Feb 16, 2024
81950ca
Merge branch 'development' into feature/cmcd-settings-from-mpd-and-st…
matiasrb97 Mar 14, 2024
a219855
Fix tests after merging development into feature/cmcd-settings-from-m…
matiasrb97 Mar 14, 2024
cad2ada
Added new test cases for ClientDataReportingModel.js
matiasrb97 Mar 14, 2024
697a5b7
Fix isIncludedFilters
matiasrb97 Mar 14, 2024
624d60a
Check if element parsed for ContentSteering from mpd is an array or a…
matiasrb97 Mar 14, 2024
7d85be5
Update AUTHORS.md
matiasrb97 Mar 18, 2024
02e4716
Update AUTHORS.md
matiasrb97 Mar 18, 2024
17bc745
Merge branch 'development' into feature/cmcd-settings-from-mpd-and-st…
matiasrb97 Mar 18, 2024
898eca2
Merge branch 'development' into feature/cmcd-settings-from-mpd-and-st…
matiasrb97 Mar 25, 2024
acba39c
Merge branch 'development' into feature/cmcd-settings-from-mpd-and-st…
matiasrb97 Apr 8, 2024
ecd8f75
Refactors from PR review: change applyCMCDParameters name to applyPar…
Apr 9, 2024
97f616b
Merge branch 'development' into feature/cmcd-settings-from-mpd-and-st…
Apr 9, 2024
832630c
Fix import
Apr 9, 2024
add7119
Move ClientDataReportingModel to controllers folder and change the na…
Apr 15, 2024
0e38da3
Update _canBeEnabled function and create a dedicated private function…
Apr 15, 2024
d5441f9
Update includeInRequest default value to segment and update the tests
Apr 15, 2024
f217eee
Merge branch 'development' into feature/cmcd-settings-from-mpd-and-st…
matiasrb97 Apr 15, 2024
4a01071
Implement schemeIdUri for CMCDParameters using urn:mpeg:dash:cta-5004…
Apr 15, 2024
c246685
Remove console.log
Apr 15, 2024
e4007c3
Add sample page for CMCD triggered via the MPD
Apr 15, 2024
4cd0140
Merge branch 'development' into feature/cmcd-settings-from-mpd-and-st…
matiasrb97 Apr 15, 2024
5491c81
Merge branch 'development' into feature/cmcd-settings-from-mpd-and-st…
matiasrb97 Apr 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions AUTHORS.md
Expand Up @@ -49,3 +49,6 @@
* @adripanico [Adrian Caballero, Epic Labs]
* @ahfarmer [Andrew Farmer, Rhombus Systems]
* @matvp91 [Matthias Van Parijs]
* @matiasrb97 [Matías Rodriguez, Qualabs]
* @santimintegui [Santiago Mintegui, Qualabs]
* @N1Knight [Nicolás Caballero, Qualabs]
1 change: 1 addition & 0 deletions index.d.ts
Expand Up @@ -1258,6 +1258,7 @@ declare namespace dashjs {
}
},
cmcd?: {
applyParametersFromMpd?:boolean,
enabled?: boolean,
sid?: string | null,
dsilhavy marked this conversation as resolved.
Show resolved Hide resolved
cid?: string | null,
Expand Down
10 changes: 9 additions & 1 deletion src/core/Settings.js
Expand Up @@ -851,6 +851,10 @@ import Events from './events/Events.js';
* If not specified this value defaults to 'query'.
* @property {Array.<string>} [enabledKeys]
* This value is used to specify the desired CMCD parameters. Parameters not included in this list are not reported.
* @property {Array.<string>} [includeInRequests]
* Specifies which HTTP GET requests shall carry parameters.
*
* If not specified this value defaults to ['mpd', 'segment', 'other'].
*/

/**
Expand Down Expand Up @@ -895,6 +899,8 @@ import Events from './events/Events.js';
* Set to true if dash.js should use the parameters defined in ProducerReferenceTime elements in combination with ServiceDescription elements.
* @property {boolean} [applyContentSteering=true]
* Set to true if dash.js should apply content steering during playback.
* @property {boolean} [applyParametersFromMpd=true]
* Set to true if dash.js should use the cmcd parameters defined in MDP or js elements.
* @property {number} [eventControllerRefreshDelay=100]
* For multi-period streams, overwrite the manifest mediaPresentationDuration attribute with the sum of period durations if the manifest mediaPresentationDuration is greater than the sum of period durations
* @property {boolean} [enableManifestDurationMismatchFix=true]
Expand Down Expand Up @@ -1272,13 +1278,15 @@ function Settings() {
}
},
cmcd: {
applyParametersFromMpd: true,
enabled: false,
sid: null,
cid: null,
rtp: null,
rtpSafetyFactor: 5,
mode: Constants.CMCD_MODE_QUERY,
enabledKeys: ['br', 'd', 'ot', 'tb', 'bl', 'dl', 'mtp', 'nor', 'nrr', 'su', 'bs', 'rtp', 'cid', 'pr', 'sf', 'sid', 'st', 'v']
enabledKeys: Constants.CMCD_AVAILABLE_KEYS,
includeInRequests: ['mpd', 'segment', 'other']
},
cmsd: {
enabled: false,
Expand Down
4 changes: 4 additions & 0 deletions src/dash/constants/DashConstants.js
Expand Up @@ -36,6 +36,7 @@
export default {
ACCESSIBILITY: 'Accessibility',
ADAPTATION_SET: 'AdaptationSet',
ADAPTATION_SETS: 'adaptationSets',
ADAPTATION_SET_SWITCHING_SCHEME_ID_URI: 'urn:mpeg:dash:adaptation-set-switching:2016',
ADD: 'add',
ASSET_IDENTIFIER: 'AssetIdentifier',
Expand All @@ -51,7 +52,9 @@ export default {
BITSTREAM_SWITCHING_MINUS: 'bitstreamSwitching',
BYTE_RANGE: 'byteRange',
CENC_DEFAULT_KID: 'cenc:default_KID',
CLIENT_DATA_REPORTING: 'ClientDataReporting',
CLIENT_REQUIREMENT: 'clientRequirement',
CMCD_PARAMETERS: 'CMCDParameters',
CODECS: 'codecs',
CODEC_PRIVATE_DATA: 'codecPrivateData',
CODING_DEPENDENCY: 'codingDependency',
Expand Down Expand Up @@ -160,6 +163,7 @@ export default {
SERVICE_DESCRIPTION_PLAYBACK_RATE: 'PlaybackRate',
SERVICE_DESCRIPTION_SCOPE: 'Scope',
SERVICE_LOCATION: 'serviceLocation',
SERVICE_LOCATIONS: 'serviceLocations',
SOURCE_URL: 'sourceURL',
START: 'start',
START_NUMBER: 'startNumber',
Expand Down
16 changes: 15 additions & 1 deletion src/dash/controllers/ServiceDescriptionController.js
Expand Up @@ -80,7 +80,8 @@ function ServiceDescriptionController() {
minBitrate: {},
maxBitrate: {},
initialBitrate: {},
contentSteering: null
contentSteering: null,
clientDataReporting: null,
};
prftOffsets = [];
}
Expand Down Expand Up @@ -128,6 +129,10 @@ function ServiceDescriptionController() {
if (sd.contentSteering) {
_applyServiceDescriptionContentSteering(sd);
}

if (sd.clientDataReporting) {
_applyServiceDescriptionClientDataReporting(sd);
}
}

/**
Expand Down Expand Up @@ -293,6 +298,15 @@ function ServiceDescriptionController() {
serviceDescriptionSettings.contentSteering = sd.contentSteering;
}

/**
* Add information about client data reporting element. Handling is up to the CMCDModel
* @param {object} sd
* @private
*/
function _applyServiceDescriptionClientDataReporting(sd) {
serviceDescriptionSettings.clientDataReporting = sd.clientDataReporting;
}

/**
* Returns the current calculated time offsets based on ProducerReferenceTime elements
* @returns {array}
Expand Down
35 changes: 32 additions & 3 deletions src/dash/models/DashManifestModel.js
Expand Up @@ -50,6 +50,8 @@ 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';
import CMCDParameters from '../vo/CMCDParameters.js';

function DashManifestModel() {
let instance,
Expand Down Expand Up @@ -1255,6 +1257,27 @@ function DashManifestModel() {
return entry;
}

function _createClientDataReportingInstance(element){
const entry = new ClientDataReporting();

if (element.hasOwnProperty(DashConstants.CMCD_PARAMETERS)) {
entry.cmcdParameters = new CMCDParameters();
entry.cmcdParameters.init(element[DashConstants.CMCD_PARAMETERS]);
}

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) => {
Expand Down Expand Up @@ -1301,7 +1324,8 @@ function DashManifestModel() {
playbackRate = null,
operatingQuality = null,
operatingBandwidth = null,
contentSteering = null;
contentSteering = null,
clientDataReporting = null;

for (const prop in sd) {
if (sd.hasOwnProperty(prop)) {
Expand Down Expand Up @@ -1338,7 +1362,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 = _createClientDataReportingInstance(sd[prop]);
}
}
}
Expand All @@ -1350,7 +1378,8 @@ function DashManifestModel() {
playbackRate,
operatingQuality,
operatingBandwidth,
contentSteering
contentSteering,
clientDataReporting
});
}
}
Expand Down
63 changes: 63 additions & 0 deletions src/dash/vo/CMCDParameters.js
@@ -0,0 +1,63 @@
/**
* 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 DescriptorType from './DescriptorType.js';

/**
* @class
* @ignore
*/
class CMCDParameters extends DescriptorType {
constructor() {
super();
this.version = null;
this.sessionID = null;
this.contentID = null;
this.mode = null;
this.keys = null;
this.includeInRequests = null;
}

init(data) {
super.init(data);

if (data) {
this.version = data.version;
this.sessionID = data.sessionID;
this.contentID = data.contentID;
this.mode = data.mode;
this.keys = data.keys ? data.keys.split(' ') : null;
this.includeInRequests = data.includeInRequests ? data.includeInRequests.split(' ') : null;
dsilhavy marked this conversation as resolved.
Show resolved Hide resolved
}
}
}

export default CMCDParameters;
45 changes: 45 additions & 0 deletions src/dash/vo/ClientDataReporting.js
@@ -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;
this.serviceLocations = null;
this.serviceLocationsArray = [];
this.adaptationSets = null;
this.adaptationSetsArray = [];
}
}

export default ClientDataReporting;
11 changes: 10 additions & 1 deletion src/streaming/MediaPlayer.js
Expand Up @@ -52,6 +52,7 @@ import SchemeLoaderFactory from './net/SchemeLoaderFactory.js';
import VideoModel from './models/VideoModel.js';
import CmcdModel from './models/CmcdModel.js';
import CmsdModel from './models/CmsdModel.js';
import ClientDataReportingModel from './models/ClientDataReportingModel.js';
import DOMStorage from './utils/DOMStorage.js';
import Debug from './../core/Debug.js';
import Errors from './../core/errors/Errors.js';
Expand Down Expand Up @@ -165,6 +166,7 @@ function MediaPlayer() {
manifestModel,
cmcdModel,
cmsdModel,
clientDataReportingModel,
videoModel,
uriFragmentModel,
domStorage,
Expand Down Expand Up @@ -350,6 +352,8 @@ function MediaPlayer() {

cmsdModel = CmsdModel(context).getInstance();

clientDataReportingModel = ClientDataReportingModel(context).getInstance();

dashMetrics = DashMetrics(context).getInstance({
settings: settings
});
Expand Down Expand Up @@ -2340,9 +2344,14 @@ function MediaPlayer() {
abrController,
dashMetrics,
playbackController,
throughputController
serviceDescriptionController,
throughputController,
});

clientDataReportingModel.setConfig({
serviceDescriptionController
})

cmsdModel.setConfig({});

// initializes controller
Expand Down
17 changes: 16 additions & 1 deletion src/streaming/constants/Constants.js
Expand Up @@ -214,6 +214,22 @@ export default {
* @static
*/
CMCD_MODE_HEADER: 'header',

/**
* @constant {string} CMCD_AVAILABLE_KEYS specifies all the availables keys for CMCD metrics.
* @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 CMCD metrics.
* @memberof Constants#
* @static
*/
CMCD_AVAILABLE_REQUESTS: ['segment', 'mpd', 'xlink', 'steering', 'other'],


INITIALIZE: 'initialize',
TEXT_SHOWING: 'showing',
TEXT_HIDDEN: 'hidden',
Expand Down Expand Up @@ -292,4 +308,3 @@ export default {
ID3_SCHEME_ID_URI: 'https://aomedia.org/emsg/ID3',
COMMON_ACCESS_TOKEN_HEADER: 'common-access-token'
}