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

Fix/4561 #4661

Open
wants to merge 3 commits into
base: development
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1055,14 +1055,17 @@ declare namespace dashjs {
applyServiceDescription?: boolean,
applyProducerReferenceTime?: boolean,
applyContentSteering?: boolean,
eventControllerRefreshDelay?: number,
enableManifestDurationMismatchFix?: boolean,
parseInbandPrft?: boolean,
enableManifestTimescaleMismatchFix?: boolean,
capabilities?: {
filterUnsupportedEssentialProperties?: boolean,
useMediaCapabilitiesApi?: boolean
},
events?: {
eventControllerRefreshDelay?: number,
deleteEventMessageDataAfterEventStarted?: boolean
}
timeShiftBuffer?: {
calcFromSegmentTimeline?: boolean
fallbackToSegmentTimeline?: boolean
Expand Down
23 changes: 19 additions & 4 deletions src/core/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ import Events from './events/Events.js';
* applyServiceDescription: true,
* applyProducerReferenceTime: true,
* applyContentSteering: true,
* eventControllerRefreshDelay: 100,
* enableManifestDurationMismatchFix: true,
* parseInbandPrft: false,
* enableManifestTimescaleMismatchFix: false,
Expand All @@ -86,6 +85,10 @@ import Events from './events/Events.js';
* filterVideoColorimetryEssentialProperties: false,
* filterHDRMetadataFormatEssentialProperties: false
* },
* events: {
* eventControllerRefreshDelay: 100,
* deleteEventMessageDataAfterEventStarted: true
* }
* timeShiftBuffer: {
* calcFromSegmentTimeline: false,
* fallbackToSegmentTimeline: true
Expand Down Expand Up @@ -342,6 +345,16 @@ import Events from './events/Events.js';
* In case the MPD uses \<SegmentTimeline\ and no segment is found within the DVR window the DVR window is calculated based on the entries in \<SegmentTimeline\>.
*/

/**
* @typedef {Object} EventSettings
* @property {number} [eventControllerRefreshDelay=100]
* Interval timer used by the EventController to check if events need to be triggered or removed.
* @property {boolean} [deleteEventMessageDataAfterEventStarted=true]
* If this flag is enabled the EventController will delete the message data of events after they have been started. This is to save memory in case events have a long duration and need to be persisted in the EventController.
* Note: Applications will receive a copy of the original event data when they subscribe to an event. This copy contains the original message data and is not affected by this setting.
* Only if an event is dispatched for the second time (e.g. when the user seeks back) the message data will not be included in the dispatched event.
*/

/**
* @typedef {Object} LiveDelay
* @property {number} [liveDelayFragmentCount=NaN]
Expand Down Expand Up @@ -937,8 +950,6 @@ 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 {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]
* Overwrite the manifest segments base information timescale attributes with the timescale set in initialization segments
* @property {boolean} [enableManifestTimescaleMismatchFix=false]
Expand All @@ -947,6 +958,7 @@ import Events from './events/Events.js';
* Set to true if dash.js should parse inband prft boxes (ProducerReferenceTime) and trigger events.
* @property {module:Settings~Metrics} metrics Metric settings
* @property {module:Settings~LiveDelay} delay Live Delay settings
* @property {module:Settings~EventSettings} events Event settings
* @property {module:Settings~TimeShiftBuffer} timeShiftBuffer TimeShiftBuffer settings
* @property {module:Settings~Protection} protection DRM related settings
* @property {module:Settings~Capabilities} capabilities Capability related settings
Expand Down Expand Up @@ -1078,7 +1090,6 @@ function Settings() {
applyServiceDescription: true,
applyProducerReferenceTime: true,
applyContentSteering: true,
eventControllerRefreshDelay: 100,
enableManifestDurationMismatchFix: true,
parseInbandPrft: false,
enableManifestTimescaleMismatchFix: false,
Expand All @@ -1099,6 +1110,10 @@ function Settings() {
filterVideoColorimetryEssentialProperties: false,
filterHDRMetadataFormatEssentialProperties: false
},
events: {
eventControllerRefreshDelay: 100,
deleteEventMessageDataAfterEventStarted: true
},
timeShiftBuffer: {
calcFromSegmentTimeline: false,
fallbackToSegmentTimeline: true
Expand Down
10 changes: 7 additions & 3 deletions src/streaming/controllers/EventController.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function EventController() {
try {
checkConfig();
logger.debug('Start Event Controller');
const refreshDelay = settings.get().streaming.eventControllerRefreshDelay;
const refreshDelay = settings.get().streaming.events.eventControllerRefreshDelay;
if (!isStarted && !isNaN(refreshDelay)) {
isStarted = true;
eventInterval = setInterval(_onEventTimer, refreshDelay);
Expand Down Expand Up @@ -474,7 +474,7 @@ function EventController() {
if (mode === MediaPlayerEvents.EVENT_MODE_ON_RECEIVE && !event.triggeredReceivedEvent) {
logger.debug(`Received event ${eventId}`);
event.triggeredReceivedEvent = true;
eventBus.trigger(event.eventStream.schemeIdUri, { event: event }, { mode });
eventBus.trigger(event.eventStream.schemeIdUri, { event: JSON.parse(JSON.stringify(event)) }, { mode });
return;
}

Expand All @@ -490,7 +490,11 @@ function EventController() {
_sendCallbackRequest(event.messageData);
} else {
logger.debug(`Starting event ${eventId} from period ${event.eventStream.period.id} at ${currentVideoTime}`);
eventBus.trigger(event.eventStream.schemeIdUri, { event: event }, { mode });
eventBus.trigger(event.eventStream.schemeIdUri, { event: JSON.parse(JSON.stringify(event)) }, { mode });
if (settings.get().streaming.events.deleteEventMessageDataAfterEventStarted) {
delete event.messageData;
delete event.parsedMessageData;
}
}
event.triggeredStartEvent = true;
}
Expand Down
Loading