@ylink-sdk/mobile-web 0.1.8 → 0.1.9-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/e30037b8/VERSION +6 -0
- package/dist/e30037b8/libipvp-simd.d.ts +474 -0
- package/dist/e30037b8/libipvp-simd.js +3267 -0
- package/dist/e30037b8/libipvp-simd.prod.d.ts +474 -0
- package/dist/e30037b8/libipvp-simd.prod.js +184 -0
- package/dist/e30037b8/libipvp-simd.prod.wasm +0 -0
- package/dist/e30037b8/libipvp-simd.wasm +0 -0
- package/dist/e30037b8/libipvp.d.ts +474 -0
- package/dist/e30037b8/libipvp.js +3267 -0
- package/dist/e30037b8/libipvp.prod.d.ts +474 -0
- package/dist/e30037b8/libipvp.prod.js +184 -0
- package/dist/e30037b8/libipvp.prod.wasm +0 -0
- package/dist/e30037b8/libipvp.wasm +0 -0
- package/dist/e30037b8/librtc.d.ts +438 -0
- package/dist/e30037b8/librtc.global.js +5863 -0
- package/dist/e30037b8/librtc.global.prod.js +15 -0
- package/dist/e30037b8/libsfu-simd.d.ts +767 -0
- package/dist/e30037b8/libsfu-simd.js +4822 -0
- package/dist/e30037b8/libsfu-simd.prod.d.ts +767 -0
- package/dist/e30037b8/libsfu-simd.prod.js +209 -0
- package/dist/e30037b8/libsfu-simd.prod.wasm +0 -0
- package/dist/e30037b8/libsfu-simd.wasm +0 -0
- package/dist/e30037b8/libsfu.d.ts +767 -0
- package/dist/e30037b8/libsfu.js +4822 -0
- package/dist/e30037b8/libsfu.prod.d.ts +767 -0
- package/dist/e30037b8/libsfu.prod.js +209 -0
- package/dist/e30037b8/libsfu.prod.wasm +0 -0
- package/dist/e30037b8/libsfu.wasm +0 -0
- package/dist/e30037b8/libsvc-simd-m1.d.ts +767 -0
- package/dist/e30037b8/libsvc-simd-m1.js +4921 -0
- package/dist/e30037b8/libsvc-simd-m1.prod.d.ts +767 -0
- package/dist/e30037b8/libsvc-simd-m1.prod.js +209 -0
- package/dist/e30037b8/libsvc-simd-m1.prod.wasm +0 -0
- package/dist/e30037b8/libsvc-simd-m1.wasm +0 -0
- package/dist/e30037b8/libsvc-simd.d.ts +767 -0
- package/dist/e30037b8/libsvc-simd.js +4857 -0
- package/dist/e30037b8/libsvc-simd.prod.d.ts +767 -0
- package/dist/e30037b8/libsvc-simd.prod.js +209 -0
- package/dist/e30037b8/libsvc-simd.prod.wasm +0 -0
- package/dist/e30037b8/libsvc-simd.wasm +0 -0
- package/dist/e30037b8/libsvc.d.ts +767 -0
- package/dist/e30037b8/libsvc.js +4857 -0
- package/dist/e30037b8/libsvc.prod.d.ts +767 -0
- package/dist/e30037b8/libsvc.prod.js +209 -0
- package/dist/e30037b8/libsvc.prod.wasm +0 -0
- package/dist/e30037b8/libsvc.wasm +0 -0
- package/dist/e30037b8/native-audio-worker.global.js +1583 -0
- package/dist/e30037b8/native-audio-worker.global.prod.js +15 -0
- package/dist/e30037b8/native-video-worker.global.js +1960 -0
- package/dist/e30037b8/native-video-worker.global.prod.js +15 -0
- package/dist/e30037b8/worklet-audio-worker.global.js +900 -0
- package/dist/e30037b8/worklet-audio-worker.global.prod.js +15 -0
- package/dist/style.css +1 -1
- package/dist/ylink-sdk-mobile.umd.js +68 -68
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
!function(){"use strict";
|
|
2
|
+
/*! *****************************************************************************
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
***************************************************************************** */function e(e,t,n,s){return new(n||(n=Promise))((function(r,i){function a(e){try{c(s.next(e))}catch(t){i(t)}}function o(e){try{c(s.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((s=s.apply(e,t||[])).next())}))}function t(t){return(n,s)=>{let r=-1;const i=i=>e(this,void 0,void 0,(function*(){if(i<=r)return;r=i;let e=t[i];return i===t.length&&(e=s),e?e.length>1?e(n,a):(yield e(n,a),a()):void 0})),a=()=>i(r+1);return a()}}class n{constructor(e,t){this.middleware=[],this.pipe=t||Math.random().toString(36).slice(3),this.channel=e}get valid(){return this.channel.has(this.pipe)}implement(t,n){const s=(s,r)=>e(this,void 0,void 0,(function*(){const{method:e,params:i,status:a,required:o,attached:c={}}=s.data;if(t!==e)return r();let l=!1;const p=[],h={},u=e=>{l||(l=!0,this.channel.send(Object.assign(Object.assign(Object.assign({},s.data),{params:void 0,attached:h}),e),p))},f={transfer:(...e)=>(o&&p.push(...e),f),resolve:e=>{o?u({resolve:e,status:a+1}):l=!0},reject:e=>{o?u({status:a-1,reject:e}):l=!0},set:(e,t)=>(o&&(h[e]=t),f),get:e=>c[e]};try{Date.now();yield n(f,i,s.ports)}catch(d){l||f.reject(`${d}`)}s.data.touched=!0,l||(yield r())}));this.middleware.unshift(s);return()=>{const e=this.middleware.findIndex((e=>e===s));~e&&this.middleware.splice(e,1)}}reject(e=""){this.channel.reject(this,e)}as(){return this}callback(){return(n,s)=>e(this,void 0,void 0,(function*(){const{pipe:e,status:r}=n.data;return e!==this.pipe||r?s():t(this.middleware)(n,s)}))}toString(){return`${this.pipe}`}}class s{constructor(e,t){this.sequence=0,this.pendings=new Map,this.pipe=t||Math.random().toString(36).slice(3),this.channel=e,this.accepted=r()}get ready(){return this.accepted.promise}get valid(){return this.channel.has(this.pipe)}make(t){const n=[],s={},i=t=>e(this,void 0,void 0,(function*(){try{yield this.ready}catch(e){throw e}})),a=(e,r)=>{this.channel.send({pipe:this.pipe,sequence:++this.sequence,timestamp:Date.now(),method:t,status:0,params:e,required:r,attached:s},n)},o={transfer:(...e)=>(n.push(...e),o),post:(...t)=>e(this,void 0,void 0,(function*(){yield i(),a(t)})),invoke:(...t)=>e(this,void 0,void 0,(function*(){yield i(),a(t,!0);const e=r();return this.pendings.set(this.sequence,e),e.promise})),set:(e,t)=>(s[e]=t,o),get:e=>s[e]};return o}break(e=""){this.channel.break(this,e),this.pendings.forEach((e=>e.reject("broken"))),this.pendings.clear(),this.accepted.reject("broken"),this.accepted.promise=Promise.reject("broken"),this.accepted.promise.catch(i)}callback(){return(t,n)=>e(this,void 0,void 0,(function*(){const{pipe:e,sequence:s,status:r,reject:i,resolve:a}=t.data;if(e!==this.pipe)return n();if(!r)return n();const o=this.pendings.get(s);o&&(r<0?o.reject(i):o.resolve(a),this.pendings.delete(s))}))}toString(){return`${this.pipe}`}}function r(){const e={};return e.promise=new Promise(((t,n)=>{e.resolve=t,e.reject=n})),e.promise.catch(i),e}const i=()=>{};class a{constructor(e){this.remotes=new Map,this.receivers=new Map,this.pendingReceivers=new Set;const n=e.onmessage;this.transport=e,this.transport.onmessage=e=>{const{data:s,ports:r=[]}=e;if(o(s)){if(/^mojo/.test(s)){const[,t]=s.split(":"),r=this.receivers.get(`${t}`);return r?(this.send(`accept:${r}`),this.oninvitation&&this.oninvitation(t,r),void(r.onready&&r.onready())):(this.pendingReceivers.add(t),this.oninvitation&&this.oninvitation(t),void(this.pendingReceivers.has(t)&&n&&n.call(this.transport,e)))}if(/^accept/.test(s)){const[,e]=s.split(":"),t=this.remotes.get(e);if(!t)return;return t.accepted.resolve(),void(t.onaccept&&t.onaccept())}if(/^reject/.test(s)){const[,e,t="rejected"]=s.split(":"),n=this.remotes.get(e);if(!n)return;return this.remotes.delete(e),n.accepted.reject(t),void(n.onreject&&n.onreject(t))}if(/^break/.test(s)){const[,e,t="breaked"]=s.split(":");if(this.pendingReceivers.has(e))return void this.pendingReceivers.delete(e);const n=this.receivers.get(e);if(!n)return;return this.receivers.delete(e),void(n.onbreak&&n.onbreak(t))}return n?void n.call(this.transport,e):void 0}const i={data:s,ports:r};t([...Array.from(this.remotes.values()).map((e=>e.callback())),...Array.from(this.receivers.values()).map((e=>e.callback()))])(i,(()=>{n&&n.call(this.transport,e)}))}}fork(){return new a(this.transport)}has(e){return this.remotes.has(e)||this.receivers.has(e)}close(){this.remotes.forEach((e=>e.break())),this.remotes.clear(),this.receivers.forEach((e=>e.reject())),this.receivers.clear(),this.transport.onmessage=null,this.transport=null}send(e,t){this.transport.postMessage(e,t)}reject(e,t=""){this.send(`reject:${e}:${t}`),this.receivers.delete(`${e}`)}break(e,t=""){this.remotes.has(`${e}`)&&(this.send(`break:${e}:${t}`),this.remotes.delete(`${e}`))}remote(e){const t=new s(this,e&&`${e}`);return this.remotes.set(`${t}`,t),this.send(`mojo:${t}`),t}receiver(e){e&&this.receivers.has(`${e}`);const t=new n(this,e&&`${e}`);return this.receivers.set(`${t}`,t),this.pendingReceivers.has(`${t}`)&&(this.send(`accept:${t}`),this.pendingReceivers.delete(`${t}`),t.onready&&t.onready()),t}}const o=e=>"string"==typeof e;class c{constructor(e){const{length:t,numberOfChannels:n=1,sampleRate:s}=e;let{data:r}=e;this.length=t,this.numberOfChannels=n,this.sampleRate=s,this.duration=t/s,r&&r.length&&r[0].length||(r=[...Array(n)].map((()=>new Float32Array(t)))),this.data=r}static From(e){const{sampleRate:t,numberOfChannels:n,length:s}=e,r=[...Array(n).keys()].map((t=>e.getChannelData(t).slice()));return new c({length:s,numberOfChannels:n,sampleRate:t,data:r})}static Copy(e,t){const{numberOfChannels:n}=e,{numberOfChannels:s}=t;for(let r=0;r<n;r++)e.copyToChannel(t.getChannelData(Math.min(r,s-1)),r)}static Clip(e,t,n){const{sampleRate:s,numberOfChannels:r}=e,i=c.Data(e,t,n),{length:a}=i[0];return new c({length:a,numberOfChannels:r,sampleRate:s,data:i})}static Data(e,t,n){return[...Array(e.numberOfChannels)].map(((s,r)=>e.getChannelData(r).subarray(t,n)))}static Builder(e){const{length:t,numberOfChannels:n,sampleRate:s}=e;return{length:t,numberOfChannels:n,sampleRate:s,data:c.Data(e)}}copyFromChannel(e,t=0,n=0){if(t>=this.numberOfChannels)return;const s=this.getChannelData(t);if(n>=s.length)return;const r=s.subarray(n);e.set(r.subarray(0,Math.min(r.length,e.length)))}copyToChannel(e,t=0,n=0){if(t>=this.numberOfChannels)return;const s=this.getChannelData(t);if(n>=this.length)return;const r=Math.min(this.length-n,e.length),i=e.subarray(0,r);s.set(i,n)}getChannelData(e){return this.data[e]}}var l,p;!function(e){e[e.kVadActive=0]="kVadActive",e[e.kVadPassive=1]="kVadPassive",e[e.kVadUnknown=2]="kVadUnknown"}(l||(l={})),function(e){e[e.kNormalSpeech=0]="kNormalSpeech",e[e.kPLC=1]="kPLC",e[e.kCNG=2]="kCNG",e[e.kPLCCNG=3]="kPLCCNG",e[e.kCodecPLC=4]="kCodecPLC",e[e.kUndefined=5]="kUndefined"}(p||(p={}));class h{constructor(e){this.buffer=e.buffer,this.timestamp=e.timestamp,this.elapsedTimeMs=e.elapsedTimeMs,this.ntpTimeMs=e.ntpTimeMs,this.vad=e.vad||l.kVadUnknown,this.speech=e.speech||p.kUndefined}get sampleRate(){return this.buffer.sampleRate}get samples(){return this.buffer.length}get channels(){return this.buffer.numberOfChannels}get duration(){return this.buffer.duration}}function u(e,t=0,n,s=0,r=n.length){const{numberOfChannels:i}=e,{numberOfChannels:a}=n;for(let o=0;o<i;o++){const i=n.getChannelData(Math.min(o,a-1)).subarray(s,s+r);e.copyToChannel(i,o,t)}}function f(e,t,n=(e=>e)){const s=e.length,r=t(s*e[0].length);for(let i=0;i<s;i++){const t=e[i];for(let e=0;e<t.length;e++)r[e*s+i]=n(t[e])}return r}const d=function(e,t,n,s=(e=>e)){const r=[],i=e.length/t;for(let a=0;a<t;a++)r[a]=n(i,a);for(let a=0;a<e.length;a++){r[a%t][Math.floor(a/t)]=s(e[a])}return r};function m(e){return Math.min(Math.max(32767*e|0,-32768),32767)}function k(e){return e>=32768?-(65536-e)/32768:e/32767}class v{constructor(){this.queue=[],this.total=0,this.offset=0}get length(){return this.total}clear(){this.queue.length=0,this.total=0,this.offset=0}shift(){if(!this.total)return;return this.pull(this.queue[0].samples-this.offset)}push(e){const t=e=>{this.queue.push(e),this.total+=e.samples};if(!this.onpush)return void t(e);const{samples:n,callback:s,factory:r,reshape:i=!1}=this.onpush;let{reshaper:a}=this.onpush;for(i?(a||(a=function(e,t,n){let s,r=0;return i=>{const{samples:a,channels:o,sampleRate:l}=i;let p=0;for(;p<a;){const f=e-r,d=Math.min(a-p,f);f||(t(s),s=null),s||(s=n?n(e):new h({buffer:new c({length:e,numberOfChannels:o,sampleRate:l})}),r=0),u(s.buffer,r,i.buffer,p,d),p+=d,r+=d}}}(n,t,r),this.onpush.reshaper=a),a(e)):t(e);this.total-this.offset>=n;)s(i?this.shift():this.pull(n,r&&r(n)))}pull(e,t){if(e<=0)return;if(this.onpull){const{samples:t,callback:n,eager:s}=this.onpull;for(;this.total<Math.max(t,e)*(s?2:1);){const t=n(this.total,e);if(!t)break;this.queue.push(t),this.total+=t.samples}}if(this.total<e)return;let n=0,{offset:s}=this;for(;n<e;){const r=this.queue.shift(),i=r.samples-s,a=e-n,o=Math.min(i,a);if(i){if(!t&&!n&&i>=a){const e=c.Clip(r.buffer,s,s+a);t=new h({buffer:e}),i>a?(s+=o,this.queue.unshift(r)):s=0;break}if(!t){const n=new c({length:e,numberOfChannels:r.channels,sampleRate:r.sampleRate});t=new h({buffer:n})}if(u(t.buffer,n,r.buffer,s,o),n+=o,i>a){s+=o,this.queue.unshift(r);break}if(s=0,this.onpull){const{drain:e}=this.onpull;e&&e(r)}}}return this.total-=e,this.offset=s,t}}const g="HEAPU8";function _(e,t){return n=>{const{BYTES_PER_ELEMENT:s}=e[t||g],r=n*s,i=e._malloc(r);return{BYTES_PER_ELEMENT:s,pointer:i,length:n,bytes:r,tuple:()=>[i,r],view:(r=!0)=>{const a=e[t||g].subarray(i/s,i+n);return r&&void 0!==a.constructor?new a.constructor(a.buffer,a.byteOffset,n):a},free:()=>e._free(i)}}}function b(e,t){return(n,s,r=!0)=>{const i=e[t||g],{BYTES_PER_ELEMENT:a}=i,o=i.subarray(n/a,n+s);return r&&void 0!==o.constructor?new o.constructor(o.buffer,o.byteOffset,s):o}}const C=(e=>{let t;return(...n)=>(t||(t=e()),t(...n))})((()=>function(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const s=y(n);return(e,n)=>s.then((s=>n(s.transaction(t,e).objectStore(t))))}("LINE-UI","key-value")));function y(e){return new Promise(((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)}))}var w,R,T,O,S,P,j,D,E,M,A;let $,L,N,U,x;!function(e){e[e.kRTPDead=1]="kRTPDead",e[e.kGainCtrl=2]="kGainCtrl",e[e.kCSRCChange=3]="kCSRCChange",e[e.kCCIDChange=4]="kCCIDChange",e[e.kMicFramingDelay=5]="kMicFramingDelay",e[e.kSpkFramengDelay=6]="kSpkFramengDelay",e[e.kRTPViolate=7]="kRTPViolate",e[e.kSignalBreak=8]="kSignalBreak"}(w||(w={})),function(e){e[e.kOff=0]="kOff",e[e.kNormal=1]="kNormal",e[e.kEnhance=2]="kEnhance"}(R||(R={})),function(e){e[e.kOff=0]="kOff",e[e.kLow=1]="kLow",e[e.kMiddle=2]="kMiddle",e[e.kHigh=3]="kHigh"}(T||(T={})),function(e){e[e.kAdaptiveDigital=1]="kAdaptiveDigital",e[e.kAdaptiveAnalog=2]="kAdaptiveAnalog",e[e.kFixedDigital=4]="kFixedDigital",e[e.kUnchanged=8]="kUnchanged",e[e.kCustomTable=16]="kCustomTable",e[e.kDigitalAgcAdj=32]="kDigitalAgcAdj",e[e.kVadThresholdAdj=64]="kVadThresholdAdj"}(O||(O={})),function(e){e[e.kInvalid=-1]="kInvalid",e[e.kSpeech=0]="kSpeech",e[e.kPCM=1]="kPCM",e[e.kRTP=2]="kRTP",e[e.kRTCP=3]="kRTCP",e[e.kRFC2833=4]="kRFC2833",e[e.kCNG=5]="kCNG",e[e.kAVS=6]="kAVS",e[e.kRED=7]="kRED",e[e.kVQM=8]="kVQM",e[e.kSDES=9]="kSDES",e[e.kFEC=10]="kFEC"}(S||(S={})),function(e){e[e.kInactive=0]="kInactive",e[e.kRecvOnly=1]="kRecvOnly",e[e.kSendOnly=2]="kSendOnly",e[e.kSendRecv=3]="kSendRecv",e[e.kSendEvnt=4]="kSendEvnt",e[e.kPaging=8]="kPaging",e[e.kMax=15]="kMax"}(P||(P={})),function(e){e[e.kUnencryRTP=1]="kUnencryRTP",e[e.kUnencryRTCP=2]="kUnencryRTCP",e[e.kUnautoRTP=4]="kUnautoRTP"}(j||(j={})),function(e){e[e.kAmrWbIO=1]="kAmrWbIO",e[e.kHFOnly=2]="kHFOnly",e[e.kDTXSend=4]="kDTXSend",e[e.kDTXRecv=8]="kDTXRecv",e[e.kStero=16]="kStero",e[e.kInbandFEC=32]="kInbandFEC",e[e.kUseYLRTX=64]="kUseYLRTX"}(D||(D={})),function(e){e[e.kURL=0]="kURL",e[e.kFLEX=1]="kFLEX"}(E||(E={})),function(e){e[e.kNone=0]="kNone",e[e.kRecv=1]="kRecv",e[e.kSend=2]="kSend"}(M||(M={})),function(e){e[e.kNone=0]="kNone",e[e.kLocal=1]="kLocal",e[e.kNet=2]="kNet",e[e.kMix=4]="kMix",e[e.kAll=3]="kAll"}(A||(A={}));let F,I=1;const q=[],V=[-1,-1];function B(e){return q.findIndex((t=>t&&t.has(e)))}function G(e,t){q[t]||(q[t]=new Set),q[t].add(e)}function X(e){let t=-1;return q.forEach(((n,s)=>{n&&(n.has(e)&&(t=s),n.delete(e))})),t}function H(e=0,t){return q.slice(e,t).reduce(((e,t)=>e.concat(Array.from(t))),[])}function Y(e){return e<11}function W(e){return Y(e)?0:1}let Q,z,J,K,Z,ee,te,ne,se;const re="undefined"!=typeof worker;re&&worker.onMessage((e=>{worker.onmessage&&worker.onmessage({data:e})}));const ie=[],ae=new a(re?worker:self),oe=ae.receiver("audio-engine-host");oe.implement("init",((t,[n,s,r,i=!1])=>e(void 0,void 0,void 0,(function*(){let e,a;if(re){const t=e=>!e||e.endsWith("/")?e:`${e}/`,s=e=>e.substring(e.lastIndexOf("/")+1),[r,i=""]=n.split("?"),o=s(r);e=require(r),a=t(i)+o.replace(/\.js$/,".wasm")}else importScripts(n),e=LIBIPVP,a=n.replace(/\.js$/,".wasm");const o=re?a:yield function(e,t=C){return t("readonly",(t=>y(t.get(e))))}(a).catch((()=>null));$=yield e({wasmBinary:o}).catch((e=>{throw function(e=C){e("readwrite",(e=>(e.clear(),y(e.transaction))))}(),e})),L=_($),N=_($,"HEAPU16"),U=b($),x=b($,"HEAPU32"),Q=ae.remote(r);const c=ae.remote(s);ie.unshift((()=>{c.break(),Q.break(),Q=null})),$.ipvp_init(((e,t)=>{i&&console.log(t)}),((e,t,n,s,r)=>{if(e!==w.kRTPDead){if(e!==w.kGainCtrl){if(e===w.kCSRCChange){const e=[];return s&&n&&e.push(...x(s,n).filter(((e,t)=>t%2==0))),Q.make("speaking").post(F,e),void pe(e)}if(e===w.kCCIDChange){const e=[];return s&&n&&e.push(...x(s,n)),void Q.make("focusing").post(F,e)}}}else if(B(t)){$.ipvp_decode_stop(t);const e=X(t);Q&&Q.make("decodestop").post(t,e)}}),((e,t,n)=>{const s=new Uint8Array(U(t,n));c.make("send").transfer(s.buffer).post(e,s)}),((e,t)=>{})),t.resolve()})))),oe.implement("exit",(e=>{ie.forEach((e=>e())),ie.length=0,$.ipvp_exit(),e.resolve()})),oe.implement("debug",((e,[t])=>{I=t,e.resolve()})),oe.implement("mos",((e,[t,n,s=!1])=>{e.resolve($.ipvp_mos(t,n,s)/10)})),oe.implement("aec",((e,[t])=>{$.ipvp_config_aec(t),e.resolve()})),oe.implement("agc",((e,[t])=>{$.ipvp_config_agc(t),e.resolve()})),oe.implement("ans",((e,[t,n=t])=>{$.ipvp_config_ans(n,t),e.resolve()})),oe.implement("mute",((e,[t])=>{$.ipvp_set_mute(Number(t)),e.resolve()})),oe.implement("bypass",((e,[t])=>{t?($.ipvp_config_aec(R.kOff),$.ipvp_config_ans(T.kOff,T.kOff),$.ipvp_set_bypass(1)):($.ipvp_config_aec(R.kNormal),$.ipvp_config_ans(T.kLow,T.kLow),$.ipvp_set_bypass(0)),e.resolve()})),oe.implement("dtmf",((e,[t])=>{$.ipvp_dtmf_send(F,t,A.kNet),e.resolve()})),oe.implement("sendstats",(e=>{e.resolve($.ipvp_get_astats_tx(F))})),oe.implement("recvstats",((e,[t])=>{e.resolve(-1===t?H().map((e=>$.ipvp_get_astats_rx(e))):$.ipvp_get_astats_rx(t))})),oe.implement("bandwidth",(e=>{e.resolve($.ipvp_get_bandwidth())})),oe.implement("jitter",(e=>{e.resolve($.ipvp_get_jitter(F))})),oe.implement("sendstatsadv",(e=>{e.resolve($.ipvp_get_astats_tx_advance(F))})),oe.implement("recvstatsadv",((e,[t])=>{e.resolve(-1===t?H().map((e=>$.ipvp_get_astats_rx_advance(e))):$.ipvp_get_astats_rx_advance(t))})),oe.implement("report",(e=>{e.resolve($.ipvp_get_astats_report())})),oe.implement("micschedule",(e=>{e.resolve($.ipvp_get_mic_schedule())})),oe.implement("spkschedule",(e=>{e.resolve($.ipvp_get_spk_schedule())})),oe.implement("process",((e,[t])=>{if(!ee)return void e.reject();ee(t);const n=ne(t.length);n?e.transfer(...n.data.map((e=>e.buffer))).resolve(n):e.resolve()})),oe.implement("processdelay",((e,[t])=>{se?(se(t),e.resolve()):e.reject()})),oe.implement("push",((e,[t])=>{ee?(ee(t),e.resolve()):e.reject()})),oe.implement("pushref",((e,[t])=>{te?(te(t),e.resolve()):e.reject()})),oe.implement("pull",((e,[t])=>{const n=ne(t);n?e.transfer(...n.data.map((e=>e.buffer))).resolve(n):e.resolve()})),oe.implement("pulldelay",((e,[t])=>{se?(se(t),e.resolve()):e.reject()})),oe.implement("receive",((e,[t,n,s=0])=>{if(-1===B(t)){if(!n[18]&&!n[19])return void e.resolve();const r=$.ipvp_decode_start(t,t);if(r>0){const e=X(r);$.ipvp_decode_stop(r),$.ipvp_decode_start(t,t),Q&&Q.make("decodestop").post(r,e)}G(t,s),Q&&Q.make("decodestart").post(t,s);const i=V[W(s)];i>=0&&($.ipvp_decode_gain([[t,i]]),Q&&Q.make("gainchange").post(i,s))}else if(!q[s]||!q[s].has(t)){!function(e,t){X(e),G(e,t)}(t,s);const e=V[W(s)];if(e>=0)$.ipvp_decode_gain([[t,e]]),Q&&Q.make("gainchange").post(e,s);else{const e=Y(s)&&le?20:100;$.ipvp_decode_gain([[t,e]]),Q&&Q.make("gainchange").post(e,s)}pe()}const r=L(n.length);r.view().set(n),$.ipvp_net_data(t,r.pointer,r.bytes,S.kRTP),r.free(),e.resolve()})),oe.implement("setup",((e,[t,n,s=3],[r])=>{F=t,1&s&&($.ipvp_encode_start(t,t),ie.unshift((()=>$.ipvp_encode_stop(t)))),2&s&&ie.unshift((()=>H().forEach((e=>$.ipvp_decode_stop(e)))));const i=n/100;z=N(1*i),J=new v,K=new v,Z=new v,ie.unshift((()=>z.free())),$.ipvp_dev_config(n,1),J.onpush={samples:i,callback:e=>{const{buffer:t}=e;f([...Array(1)].map(((e,n)=>t.getChannelData(n))),(()=>z.view()),m),$.ipvp_mic_framing(z.pointer,z.bytes)}},Z.onpush={samples:i,callback:e=>{const{buffer:t}=e;f([...Array(1)].map(((e,n)=>t.getChannelData(n))),(()=>z.view()),m),$.ipvp_ref_framing(z.pointer,z.bytes)}},K.onpull={samples:i,callback:()=>{$.ipvp_spk_framing(z.pointer,z.bytes);const e=d(z.view(),1,(e=>new Float32Array(e)),k),t=new c({length:i,numberOfChannels:1,sampleRate:n,data:e}),s=new h({buffer:t});return o(3)&&$.ipvp_ref_framing(z.pointer,z.bytes),s}};const o=e=>!(s^e);ee=e=>{if(o(2))return;const t=new c(e),n=new h({buffer:t});J.push(n)},te=e=>{if(o(2))return;const t=new c(e),n=new h({buffer:t});Z.push(n)},ne=e=>{if(o(1))return;const t=K.pull(e);return t?c.Builder(t.buffer):void 0};let l=0;if(se=()=>{o(1)||l++},r){const e=new a(r),t=e.receiver("worklet-audio-processor-host");t.implement("process",((e,[t])=>{ee(t);let n=t.length;l>0&&(l--,n-=i);const s=ne(n);s?e.transfer(...s.data.map((e=>e.buffer))).resolve(s):e.resolve()})),t.implement("processdelay",((e,[t])=>{se(t),e.resolve()}));const n=e.receiver("worklet-audio-source-host");n.implement("onpush",((e,[t])=>{ee(t),e.resolve()})),n.implement("onref",((e,[t])=>{te(t),e.resolve()}));const s=e.receiver("worklet-audio-sink-host");s.implement("onpull",((e,[t])=>{const n=ne(t);n?e.transfer(...n.data.map((e=>e.buffer))).resolve(n):e.resolve()})),s.implement("ondelay",((e,[t])=>{se(t),e.resolve()})),ie.unshift((()=>{e.close(),r.close()}))}e.resolve()})),oe.implement("trackgain",((e,[t=-1,n=0])=>{const s=W(n);if(V[W(n)]=t,t>=0){const e=0===s?H(0,10):H(11);$.ipvp_decode_gain(e.map((e=>[e,t]))),Q&&Q.make("gainchange").post(t,n),0===s&&ue.cancel()}e.resolve()})),oe.implement("fec",((e,[t])=>{$.ipvp_config_fec(F,t),e.resolve()})),oe.implement("dumpstats",(e=>{$.ipvp_debug_dump_stat(),e.resolve()})),oe.implement("dumpparam",(e=>{$.ipvp_debug_dump_param(),e.resolve()})),oe.implement("dumptalk",(e=>{$.ipvp_debug_dump_talk(),e.resolve()}));let ce=[],le=!1;function pe(e=ce){ce=e;let t=V[0];if(t>=0)return;const n=H(11),s=H(0,10);if(n.some((t=>e.includes(t)))){t=20,ue.cancel(),he(s,t)}else{t=100,ue(s,t)}}function he(e,t){$.ipvp_decode_gain(e.map((e=>[e,t]))),Q&&Q.make("gainchange").post(t,0),le=100!==t}const ue=function(e,t){let n;function s(...s){clearTimeout(n),n=setTimeout((()=>e.call(this,...s)),t)}return s.cancel=()=>clearTimeout(n),s}(he,5e3)}();
|