debug(bounce): EVT_REG/BRIDGE_EVT_RX/WI_QUERY diag + fix PUSH_SENT typo

This commit is contained in:
2026-08-25 08:11:02 +07:00
parent 8ef1935068
commit 662383e538
4 changed files with 20 additions and 6 deletions
@@ -54,6 +54,7 @@
var self = this;
try {
window.__TAURI__.event.listen('bridge-audio', function (e) {
if (!self._evtDiagAt || Date.now() - self._evtDiagAt >= 1000) { self._evtDiagAt = Date.now(); if (window.__sfDiag) window.__sfDiag('BRIDGE_EVT_RX cb=' + (self._audioCb ? 'yes' : 'no') + ' len=' + (e.payload && e.payload.l ? e.payload.l.length : 0)); }
// Bridge recovered after bridge-down (or never bootstrapped):
// audio frames flow again -> re-establish routing (Fix C).
if (!self.isBridgeConnected) self._reconnectIfNeeded();
@@ -71,6 +72,7 @@
if (window.AudioRoutingEngine) window.AudioRoutingEngine.disconnect();
console.warn('[BridgeService] bridge-down event received.');
});
if (window.__sfDiag) window.__sfDiag('EVT_REG ok');
} catch (e) {
console.warn('[BridgeService] event listen failed:', e);
}
@@ -136,7 +138,7 @@
default: byteCmd = cmd === 'NOTE_ON' ? 0x9 : 0x8; break;
}
this._pushSent = (this._pushSent || 0) + 1;
if (this.pushSent % 100 === 0 && window.__sfDiag) window.__sfDiag('PUSH_SENT ' + _pushSent);
if (this._pushSent % 100 === 0 && window.__sfDiag) window.__sfDiag('PUSH_SENT ' + this._pushSent);
// DIAG: Promise.race 800ms — invoke gửi đi nhưng không settle -> timeout
// (phan biet main-thread block vs Rust hang).
Promise.race([