av-merge: Use .shift() instead of .pop() in appendQueue for FIFO

.pop() gives LIFO, but FIFO was the intention for appendQueue.
O(n) behavior is fine because appendQueue should be very small.

Signed-off-by: Jesús <heckyel@hyperbola.info>
This commit is contained in:
James Taylor 2021-08-30 19:53:48 -07:00 committed by Jesús
parent 85cf943850
commit 30e59081b1
No known key found for this signature in database
GPG Key ID: F6EE7BC59A315766

View File

@ -164,7 +164,7 @@ function Stream(avMerge, source, startTime, avRatio) {
});
this.updateendEvt = addEvent(this.sourceBuffer, 'updateend', (e) => {
if (this.appendQueue.length != 0) {
this.appendSegment(...this.appendQueue.pop());
this.appendSegment(...this.appendQueue.shift());
}
});
}