mirror of
https://github.com/got-feedBack/feedBack-desktop.git
synced 2026-08-14 12:47:10 +00:00
fix(diag): compute busFlowing from per-poll counter deltas
Cumulative pushed/consumed never regress, so '> 0' stayed true forever after the first frame — a stalled renderer bus (one of the states this diagnostic exists to expose) would still report flowing. First sample after enable reports false (no baseline yet). Addresses CodeRabbit review on #95. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
ee7abe3dc9
commit
d069414300
@@ -341,12 +341,27 @@ export function initAudioBridge(): void {
|
|||||||
if (audio && isDebugEnabled()) {
|
if (audio && isDebugEnabled()) {
|
||||||
let lastSnapshot = '';
|
let lastSnapshot = '';
|
||||||
let lastLogged = 0;
|
let lastLogged = 0;
|
||||||
|
// busFlowing must reflect the CURRENT poll interval: cumulative
|
||||||
|
// pushed/consumed counters never regress, so "> 0" would stay true
|
||||||
|
// forever after the first frame — masking a stalled bus, which is
|
||||||
|
// one of the states this diagnostic exists to expose.
|
||||||
|
let prevBusCounts: { pushed: number; consumed: number } | null = null;
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
try {
|
try {
|
||||||
if (!audio) return;
|
if (!audio) return;
|
||||||
const running = !!audio.isAudioRunning?.();
|
const running = !!audio.isAudioRunning?.();
|
||||||
const dev = running ? audio.getCurrentDevice?.() : null;
|
const dev = running ? audio.getCurrentDevice?.() : null;
|
||||||
const bus = audio.getRendererBusMetrics?.() ?? null;
|
const bus = audio.getRendererBusMetrics?.() ?? null;
|
||||||
|
let busFlowing = false;
|
||||||
|
if (bus) {
|
||||||
|
if (prevBusCounts) {
|
||||||
|
busFlowing = bus.pushedFrames > prevBusCounts.pushed
|
||||||
|
&& bus.consumedFrames > prevBusCounts.consumed;
|
||||||
|
}
|
||||||
|
prevBusCounts = { pushed: bus.pushedFrames, consumed: bus.consumedFrames };
|
||||||
|
} else {
|
||||||
|
prevBusCounts = null;
|
||||||
|
}
|
||||||
const snapshot = JSON.stringify({
|
const snapshot = JSON.stringify({
|
||||||
running,
|
running,
|
||||||
inputType: dev?.inputType ?? '',
|
inputType: dev?.inputType ?? '',
|
||||||
@@ -357,9 +372,8 @@ export function initAudioBridge(): void {
|
|||||||
backingPlaying: !!audio.isBackingPlaying?.(),
|
backingPlaying: !!audio.isBackingPlaying?.(),
|
||||||
streamOutputActive: !!audio.isStreamOutputActive?.(),
|
streamOutputActive: !!audio.isStreamOutputActive?.(),
|
||||||
busEnabled: bus?.enabled ?? null,
|
busEnabled: bus?.enabled ?? null,
|
||||||
// pushed/consumed prove frames are flowing; deltas matter,
|
// per-poll delta ("moved this interval"), not cumulative.
|
||||||
// absolute counts churn — bucket to "moving or not".
|
busFlowing,
|
||||||
busFlowing: !!bus && bus.pushedFrames > 0 && bus.consumedFrames > 0,
|
|
||||||
busUnderflows: bus?.underflowCount ?? null,
|
busUnderflows: bus?.underflowCount ?? null,
|
||||||
busOverflows: bus?.overflowCount ?? null,
|
busOverflows: bus?.overflowCount ?? null,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user