[Audio module]: segfault in the input_thread_Events INPUT_EVENT_TIME
Trace:
experimental.worker.js:172 Uncaught RuntimeError: memory access out of bounds
at input_thread_Events (wasm-function[13460]:0x9ccd88)
at EsOutVaPrivControlLocked (wasm-function[13272]:0x9b942b)
at EsOutPrivControl (wasm-function[13271]:0x9b8b7a)
at es_out_PrivControl (wasm-function[13310]:0x9bf4bf)
at CmdExecutePrivControl (wasm-function[13312]:0x9bf753)
at PrivControl (wasm-function[13309]:0x9bf3b1)
at es_out_PrivControl.1 (wasm-function[13344]:0x9c3acb)
at MainLoop (wasm-function[13332]:0x9c2d56)
at Run.5 (wasm-function[13330]:0x9c0940)
at dynCall_ii (wasm-function[16792]:0xa43808)
Steps to reproduce:
add this, to replace the Audio Worklet Processor code.
// std::string processorStr = "class Processor extends AudioWorkletProcessor{constructor(){super(),this.port.onmessage=(t=>{if('recv-audio-queue'!==t.data.type)throw'unexpected.';this.buf=t.data.data,this.capacity=t.data.sab_size/4,this.flag=new Uint32Array(this.buf,t.data.sab_ptr,1),this.head=new Uint32Array(this.buf,t.data.sab_ptr+4,1),this.tail=new Uint32Array(this.buf,t.data.sab_ptr+8,1),this.storage=new Float32Array(this.buf,t.data.sab_ptr+12,this.capacity)})}process(t,s,a){const r=s[0],e=r.length,i=r[0].length;if(0==this.head.buffer.byteLength)throw new Error('wasmMemory grew');for(var o=Atomics.load(this.head,0)/4,h=Atomics.load(this.tail,0)/4,c=0;h!=o&&c<i;){for(let t=0;t<e;++t)r[t][c]=this.storage[h],++h==this.capacity&&(h=0);c++}return Atomics.store(this.tail,0,4*h),!0}}registerProcessor('worklet-processor',Processor);";
it seems that if it fails, it will trigger another error, but I don't know if it's :
- when the audio buffer is full
- related to performance, because around that time in the video we usually have a freeze and frame drops because of late pictures
- some other reason
It seems the segfault occurs in src/player/input.c in :
case INPUT_EVENT_TIMES
input_thread_Events is called from :
priv->events_cb() from input_SendEvent() from input_SendEventParsing() from EsOutVaPrivControlLocked
Edited by Mehdi Sabwat