From a76e4c064d740928cebfc3c43fa3e361c80fc5bb Mon Sep 17 00:00:00 2001 From: Amish Shah Date: Thu, 26 Oct 2017 00:32:14 +0100 Subject: [PATCH] Fix sequence and timestamp growing too large --- src/client/voice/dispatcher/StreamDispatcher.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/client/voice/dispatcher/StreamDispatcher.js b/src/client/voice/dispatcher/StreamDispatcher.js index 323616103..63294a5b0 100644 --- a/src/client/voice/dispatcher/StreamDispatcher.js +++ b/src/client/voice/dispatcher/StreamDispatcher.js @@ -50,6 +50,8 @@ class StreamDispatcher extends Writable { const next = FRAME_LENGTH + (this.startTime + (this._sdata.count * FRAME_LENGTH) - Date.now()); setTimeout(done.bind(this), next); // Do overflow checks here! + if (this._sdata.sequence === (2 ** 16) - 1) this._sdata.sequence = -1; + if (this._sdata.timestamp === (2 ** 32) - 1) this._sdata.timestamp = -1; this._sdata.sequence++; this._sdata.timestamp += 960; this._sdata.count++;