Skip to content

Commit

Permalink
Fix events without presentation time and id (#3851)
Browse files Browse the repository at this point in the history
* Fix a memory leak in the EventController.js. For events without id and presentationTime the list of outdated events was not cleaned up

* Default to id null for inline events
  • Loading branch information
dsilhavy committed Jan 7, 2022
1 parent 0f4196e commit cd63ff0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/dash/models/DashManifestModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -849,14 +849,17 @@ function DashManifestModel() {

if (currentMpdEvent.hasOwnProperty(DashConstants.PRESENTATION_TIME)) {
event.presentationTime = currentMpdEvent.presentationTime;
const presentationTimeOffset = eventStream.presentationTimeOffset ? eventStream.presentationTimeOffset / eventStream.timescale : 0;
event.calculatedPresentationTime = event.presentationTime / eventStream.timescale + period.start - presentationTimeOffset;
}
const presentationTimeOffset = eventStream.presentationTimeOffset ? eventStream.presentationTimeOffset / eventStream.timescale : 0;
event.calculatedPresentationTime = event.presentationTime / eventStream.timescale + period.start - presentationTimeOffset;

if (currentMpdEvent.hasOwnProperty(DashConstants.DURATION)) {
event.duration = currentMpdEvent.duration / eventStream.timescale;
}
if (currentMpdEvent.hasOwnProperty(DashConstants.ID)) {
event.id = currentMpdEvent.id;
} else {
event.id = null;
}

if (currentMpdEvent.Signal && currentMpdEvent.Signal.Binary) {
Expand Down
2 changes: 1 addition & 1 deletion src/streaming/controllers/EventController.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ function EventController() {
const id = event.id;

events[schemeIdUri] = events[schemeIdUri].filter((e) => {
return (value && e.eventStream.value && e.eventStream.value !== value) || (e.id !== id);
return (value && e.eventStream.value && e.eventStream.value !== value) || e.id !== id;
});

if (events[schemeIdUri].length === 0) {
Expand Down

0 comments on commit cd63ff0

Please sign in to comment.