Skip to content

Commit

Permalink
Merge pull request #52696 from Faless/js/4.x_worklet_rb_bug
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga authored Sep 15, 2021
2 parents 13d2928 + ba08f39 commit f18a6f2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions platform/javascript/js/libs/audio.worklet.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ class RingBuffer {
const mw = this.buffer.length - this.wpos;
if (mw >= to_write) {
this.buffer.set(p_buffer, this.wpos);
this.wpos += to_write;
if (mw === to_write) {
this.wpos = 0;
}
} else {
const high = p_buffer.subarray(0, to_write - mw);
const low = p_buffer.subarray(to_write - mw);
const high = p_buffer.subarray(0, mw);
const low = p_buffer.subarray(mw);
this.buffer.set(high, this.wpos);
this.buffer.set(low);
this.wpos = low.length;
}
let diff = to_write;
if (this.wpos + diff >= this.buffer.length) {
diff -= this.buffer.length;
}
this.wpos += diff;
Atomics.add(this.avail, 0, to_write);
Atomics.notify(this.avail, 0);
}
Expand Down

0 comments on commit f18a6f2

Please sign in to comment.