mirror of
https://github.com/libretro/RetroArch.git
synced 2025-01-18 23:04:25 +00:00
Fix RWebAudioInit race condition
This commit is contained in:
parent
280dcb32f9
commit
58aafeec78
@ -35,6 +35,8 @@ var LibraryRWebAudio = {
|
||||
RA.buffers[RA.numBuffers - 1] = buf[0];
|
||||
i--;
|
||||
RA.bufIndex--;
|
||||
} else if (!RA.startTime) {
|
||||
RA.setStartTime();
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -74,7 +76,7 @@ var LibraryRWebAudio = {
|
||||
block: function() {
|
||||
do {
|
||||
RA.process();
|
||||
} while (RA.bufIndex === RA.numBuffers-2);
|
||||
} while (RA.bufIndex === RA.numBuffers);
|
||||
}
|
||||
},
|
||||
|
||||
@ -88,8 +90,6 @@ var LibraryRWebAudio = {
|
||||
RA.numBuffers = ((latency * RA.context.sampleRate) / (1000 * RA.BUFFER_SIZE))|0;
|
||||
if (RA.numBuffers < 2) RA.numBuffers = 2;
|
||||
|
||||
RA.numBuffers++;
|
||||
|
||||
for (var i = 0; i < RA.numBuffers; i++) {
|
||||
RA.buffers[i] = RA.context.createBuffer(2, RA.BUFFER_SIZE, RA.context.sampleRate);
|
||||
RA.buffers[i].endTime = 0
|
||||
@ -114,7 +114,7 @@ var LibraryRWebAudio = {
|
||||
var count = 0;
|
||||
|
||||
while (samples) {
|
||||
if (RA.bufIndex === RA.numBuffers-2) {
|
||||
if (RA.bufIndex === RA.numBuffers) {
|
||||
if (RA.nonblock) break;
|
||||
else RA.block();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user