MCPcopy
hub / github.com/mudler/LocalAI / startDiagnostics

Function startDiagnostics

core/http/static/talk.js:417–442  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

415}
416
417function startDiagnostics() {
418 if (!audioPlayback.srcObject) return;
419
420 // Create AudioContext and connect the remote stream to an AnalyserNode
421 if (!audioCtx) {
422 audioCtx = new AudioContext();
423 const source = audioCtx.createMediaStreamSource(audioPlayback.srcObject);
424 analyser = audioCtx.createAnalyser();
425 analyser.fftSize = 8192;
426 analyser.smoothingTimeConstant = 0.3;
427 source.connect(analyser);
428
429 document.getElementById('statSampleRate').textContent = audioCtx.sampleRate + ' Hz';
430 }
431
432 // Start rendering loop
433 if (!diagAnimFrame) {
434 drawDiagnostics();
435 }
436
437 // Start WebRTC stats polling
438 if (!statsInterval) {
439 pollWebRTCStats();
440 statsInterval = setInterval(pollWebRTCStats, 1000);
441 }
442}
443
444function stopDiagnostics() {
445 if (diagAnimFrame) {

Callers 2

connectFunction · 0.70
toggleDiagnosticsFunction · 0.70

Calls 3

drawDiagnosticsFunction · 0.70
pollWebRTCStatsFunction · 0.70
connectMethod · 0.45

Tested by

no test coverage detected