From 30e59081b14c98b49f718a1bc131ac46d09c84bf Mon Sep 17 00:00:00 2001 From: James Taylor Date: Mon, 30 Aug 2021 19:53:48 -0700 Subject: av-merge: Use .shift() instead of .pop() in appendQueue for FIFO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit .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 --- youtube/static/js/av-merge.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube/static/js/av-merge.js b/youtube/static/js/av-merge.js index 3198857..8a1deb8 100644 --- a/youtube/static/js/av-merge.js +++ b/youtube/static/js/av-merge.js @@ -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()); } }); } -- cgit v1.2.3