Javascript stalls due to emsg id handling
Created by: TobbeMobiTV
The browser stalls for big ids in emsg.
Events are added with its id as a index in an array in the addInbandEvents function in EventController.js.
addInbandEvents = function(values) {
var self = this;
for(var i=0;i<values.length;i++) {
var event = values[i];
inbandEvents[event.id] = event;
self.log("Add inband event with id "+event.id);
}
},
In the triggerEvents function, there is then a loop
if(events) {
for (var j = 0; j < events.length; j++) {
var curr = events[j];
which runs from 0 to the events.length, but in this case it becomes id due to the bad indexing.
This can be tested by using the dash-live-source-simualator with SCTE-35 Splice Insert events http://vm2.dashif.org/livesim-dev/scte35_2/testpic_2s/Manifest.mpd
The emsg ids are huge, such as 716411340, since they are based on time of the events.
A suggested fix is to change the triggerEvents lines to:
if(events) {
for (var j in events) {
var curr = events[j];
The same issue exists in removeEvents.
With these changed it worked to stream with the SCTE-35 events without any stalls.